1 GRANTPT(3C)              Standard C Library Functions              GRANTPT(3C)
   2 
   3 NAME
   4      grantpt - grant access to the subsidiary device of a pseudo-terminal
   5 
   6 SYNOPSIS
   7      #include <stdlib.h>
   8 
   9      int
  10      grantpt(int fildes);
  11 
  12 DESCRIPTION
  13      The grantpt() function changes the mode and ownership of the pseudo-
  14      terminal subsidiary device associated with its pseudo-terminal manager
  15      counterpart.
  16 
  17      The fildes argument is the file descriptor returned from a successful
  18      open(2) of the pseudo-terminal manager device; e.g., by calling
  19      posix_openpt(3C) or by performing an open(2) of the ptm(7D) device.
  20 
  21      The user ID owner of the subsidiary device is set to the real user ID of
  22      the calling process.  The group ID owner is set to a reserved group.
  23 
  24      The permission mode of the subsidiary device is set to be readable and
  25      writable by the owner, and writable by the group.
  26 
  27 RETURN VALUES
  28      The grantpt() function returns the value 0 if successful; otherwise the
  29      value -1 is returned and the global variable errno is set to indicate the
  30      error.
  31 
  32 EXAMPLES
  33      See posix_openpt(3C) for an example that includes a call to grantpt().
  34 
  35 ERRORS
  36      The grantpt() function may fail if:
  37 
  38      EBADF              The fildes argument is not a valid open file
  39                         descriptor.
  40 
  41      EINVAL             The fildes argument is not associated with a pseudo-
  42                         terminal manager device.
  43 
  44      EACCES             The corresponding pseudo-terminal subsidiary device
  45                         could not be accessed.
  46 
  47 INTERFACE STABILITY
  48      Committed
  49 
  50 MT LEVEL
  51      Safe
  52 
  53 SEE ALSO
  54      open(2), posix_openpt(3C), ptsname(3C), unlockpt(3C), attributes(5),
  55      standards(5), ptm(7D)
  56 
  57 illumos                        February 5, 2022                        illumos