summaryrefslogtreecommitdiffstats
path: root/man3/posix_openpt.3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:40:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:40:15 +0000
commit399644e47874bff147afb19c89228901ac39340e (patch)
tree1c4c0b733f4c16b5783b41bebb19194a9ef62ad1 /man3/posix_openpt.3
parentInitial commit. (diff)
downloadmanpages-399644e47874bff147afb19c89228901ac39340e.tar.xz
manpages-399644e47874bff147afb19c89228901ac39340e.zip
Adding upstream version 6.05.01.upstream/6.05.01
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man3/posix_openpt.3')
-rw-r--r--man3/posix_openpt.3108
1 files changed, 108 insertions, 0 deletions
diff --git a/man3/posix_openpt.3 b/man3/posix_openpt.3
new file mode 100644
index 0000000..09733d0
--- /dev/null
+++ b/man3/posix_openpt.3
@@ -0,0 +1,108 @@
+'\" t
+.\" Copyright (C) 2004 Michael Kerrisk
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH posix_openpt 3 2023-07-20 "Linux man-pages 6.05.01"
+.SH NAME
+posix_openpt \- open a pseudoterminal device
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <stdlib.h>
+.B #include <fcntl.h>
+.PP
+.BI "int posix_openpt(int " flags ");"
+.fi
+.PP
+.RS -4
+Feature Test Macro Requirements for glibc (see
+.BR feature_test_macros (7)):
+.RE
+.PP
+.BR posix_openpt ():
+.nf
+ _XOPEN_SOURCE >= 600
+.fi
+.SH DESCRIPTION
+The
+.BR posix_openpt ()
+function opens an unused pseudoterminal master device, returning a
+file descriptor that can be used to refer to that device.
+.PP
+The
+.I flags
+argument is a bit mask that ORs together zero or more of
+the following flags:
+.TP
+.B O_RDWR
+Open the device for both reading and writing.
+It is usual to specify this flag.
+.TP
+.B O_NOCTTY
+Do not make this device the controlling terminal for the process.
+.SH RETURN VALUE
+On success,
+.BR posix_openpt ()
+returns a file descriptor (a nonnegative integer) which is the lowest
+numbered unused file descriptor.
+On failure, \-1 is returned, and
+.I errno
+is set to indicate the error.
+.SH ERRORS
+See
+.BR open (2).
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR posix_openpt ()
+T} Thread safety MT-Safe
+.TE
+.sp 1
+.SH STANDARDS
+POSIX.1-2008.
+.SH HISTORY
+glibc 2.2.1.
+POSIX.1-2001.
+.PP
+It is part of the UNIX 98 pseudoterminal support (see
+.BR pts (4)).
+.SH NOTES
+Some older UNIX implementations that support System V
+(aka UNIX 98) pseudoterminals don't have this function, but it
+can be easily implemented by opening the pseudoterminal multiplexor device:
+.PP
+.in +4n
+.EX
+int
+posix_openpt(int flags)
+{
+ return open("/dev/ptmx", flags);
+}
+.EE
+.in
+.PP
+Calling
+.BR posix_openpt ()
+creates a pathname for the corresponding pseudoterminal slave device.
+The pathname of the slave device can be obtained using
+.BR ptsname (3).
+The slave device pathname exists only as long as the master device is open.
+.SH SEE ALSO
+.BR open (2),
+.BR getpt (3),
+.BR grantpt (3),
+.BR ptsname (3),
+.BR unlockpt (3),
+.BR pts (4),
+.BR pty (7)