NAME
posix_openpt() — open a pseudo-terminal master device
SYNOPSIS
#include <stdlib.h>
#include <fcntl.h>
int posix_openpt(int oflag);
Parameters
- oflag
indicates the file status flags and file access modes of the open file
description. Values for
oflag
are constructed by a bitwise-inclusive OR
of flags from the following list,
defined in
<fcntl.h>:
- O_RDWR
Open for reading and writing.
- O_NOCTTY
If set
posix_openpt()
will not cause the terminal device to become the
controlling terminal for the process.
DESCRIPTION
The
posix_openpt()
function establishes a connection between a master device for a
pseudo-terminal and a file descriptor. This file descriptor can
be used to refer that device.
The file status flags and file access modes of the opened file
descriptor will be set according to the value of
oflag.
RETURN VALUE
Upon successful completion
posix_openpt()
opens a master
pseudo-terminal device and returns a non-negative integer representing
the lowest numbered unused file descriptor. Otherwise,
posix_openpt()
returns -1 and
errno
is set to indicate the error.
ERRORS
On failure
posix_openpt()
sets one of the following values for
errno:
- EMFILE
OPEN_MAX
file descriptors are currently open in the calling process.
- ENFILE
The maximum allowable number of files are currently open on the system.
- EINVAL
The value of
oflag
is not valid.
- EAGAIN
Out of pseudo-terminal resources.
- ENOSR
Out of STREAMS resources.
AUTHOR
posix_openpt()
was developed by HP.