Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

posix_openpt(3) [netbsd man page]

POSIX_OPENPT(3) 					   BSD Library Functions Manual 					   POSIX_OPENPT(3)

NAME
posix_openpt -- open a pseudo-terminal device LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> #include <fcntl.h> int posix_openpt(int oflag); DESCRIPTION
The posix_openpt() function searches for an unused master pseudo-terminal device, opens it, and returns a file descriptor associated with the now used pseudo-terminal device. The oflag argument has the same meaning as in the open(2) call. RETURN VALUES
If successful, posix_openpt() returns a non-negative integer, which corresponds to a file descriptor pointing to the master pseudo-terminal device. Otherwise, a value of -1 is returned and errno is set to indicate the error. SEE ALSO
ioctl(2), open(2), grantpt(3), ptsname(3), unlockpt(3) RATIONALE
The standards committee did not want to directly expose the cloning device, thus decided to wrap the functionality in this function. The equivalent code would be: int posix_openpt(int oflag) { return open("/dev/ptmx", oflag); } STANDARDS
The posix_openpt() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). BSD
May 25, 2004 BSD

Check Out this Related Man Page

posix_openpt(3C)														  posix_openpt(3C)

NAME
posix_openpt() - open a pseudo-terminal master device SYNOPSIS
Parameters oflag indicates the file status flags and file access modes of the open file description. Values for oflag are constructed by a bit- wise-inclusive OR of flags from the following list, defined in Open for reading and writing. If set will not cause the terminal device to become the controlling terminal for the process. DESCRIPTION
The 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 opens a master pseudo-terminal device and returns a non-negative integer representing the lowest numbered unused file descriptor. Otherwise, returns -1 and is set to indicate the error. ERRORS
On failure sets one of the following values for OPEN_MAX file descriptors are currently open in the calling process. The maximum allowable number of files are currently open on the system. The value of oflag is not valid. Out of pseudo-terminal resources. Out of STREAMS resources. AUTHOR
was developed by HP. SEE ALSO
open(2), grantpt(3C), ptsname(3C), unlockpt(3C), ptm(7), pts(7). posix_openpt(3C)
Man Page