| POSIX_OPENPT(3) | Library Functions Manual | POSIX_OPENPT(3) |
posix_openpt —
open a pseudo-terminal device
#include
<stdlib.h>
#include <fcntl.h>
int
posix_openpt(int
oflag);
The
posix_openpt()
function finds the next available pseudo-terminal and returns an open file
descriptor for its master device. The path name of the slave device may be
determined via the
ptsname()
function. Note that the
unlockpt()
and
grantpt()
functions should be called before opening the slave device.
The oflag argument is formed by
bitwise-inclusive OR'ing the following values defined in
<fcntl.h>:
The O_RDWR flag must
be specified in oflag. If oflag
contains values other than those listed above,
posix_openpt()
will return an error.
If successful, posix_openpt() returns a
non-negative integer, the file descriptor for the pseudo-terminal master
device. Otherwise, a value of -1 is returned and errno
is set to indicate the error.
The posix_openpt() function will fail
if:
The posix_openpt() function conforms to
IEEE Std 1003.1-2001 (“POSIX.1”).
The posix_openpt() function appeared in
OpenBSD 5.3.
| January 25, 2019 | Debian |