GRANTPT(3C) Standard C Library Functions GRANTPT(3C)
NAME
grantpt - grant access to the subsidiary device of a pseudo-terminal
SYNOPSIS
#include <stdlib.h> int grantpt(
int fildes);
DESCRIPTION
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.
RETURN VALUES
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.
EXAMPLES
See
posix_openpt(3C) for an example that includes a call to
grantpt().
ERRORS
The
grantpt() function may fail if:
EBADF The
fildes argument is not a valid open file
descriptor.
EINVAL The
fildes argument is not associated with a pseudo-
terminal manager device.
EACCES The corresponding pseudo-terminal subsidiary device
could not be accessed.
INTERFACE STABILITY
CommittedMT LEVEL
SafeSEE ALSO
open(2),
posix_openpt(3C),
ptsname(3C),
unlockpt(3C),
ptm(4D),
attributes(7),
standards(7)illumos February 5, 2022 illumos