GRANTPT(3C) | Standard C Library Functions | GRANTPT(3C) |
grantpt
— grant
access to the subsidiary device of a pseudo-terminal
#include
<stdlib.h>
int
grantpt
(int fildes);
The
grantpt
()
function changes the mode and ownership of the pseudo-terminal subsidiary
device associated with its pseudo-terminal manager counterpart.
The fildes argument is the file descriptor returned from a successful open(2) of the pseudo-terminal manager device; e.g., by calling posix_openpt(3C) or by performing an open(2) of the ptm(4D) device.
The user ID owner of the subsidiary device is set to the real user ID of the calling process. The group ID owner is set to a reserved group.
The permission mode of the subsidiary device is set to be readable and writable by the owner, and writable by the group.
The grantpt
() function returns the
value 0 if successful; otherwise the value -1 is returned and
the global variable errno is set to indicate the
error.
See posix_openpt(3C)
for an example that includes a call to
grantpt
().
The grantpt
() function may fail if:
open(2), posix_openpt(3C), ptsname(3C), unlockpt(3C), ptm(4D), attributes(7), standards(7)
February 5, 2022 | OmniOS |