posix_openpt
(3)open a pseudoterminal device
#include <stdlib.h> #include <fcntl.h> int posix_openpt(int flags); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): posix_openpt(): _XOPEN_SOURCE >= 600
LIBRARY
DESCRIPTION
RETURN VALUE
ERRORS
ATTRIBUTES
STANDARDS
HISTORY
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:
int
posix_openpt(int flags)
{
return open("/dev/ptmx", flags);
}
Calling posix_openpt() creates a pathname for the corresponding pseudoterminal slave device. The pathname of the slave device can be obtained using ptsname(3). The slave device pathname exists only as long as the master device is open.