Print this page
14249 pseudo-terminal nomenclature should reflect POSIX
Change-Id: Ib4a3cef899ff4c71b09cb0dc6878863c5e8357bc


  26 .\"
  27 .\" The contents of this file are subject to the terms of the
  28 .\" Common Development and Distribution License (the "License").
  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Copyright 1989 AT&T
  44 .\" Portions Copyright (c) 1994, X/Open Company Limited.  All Rights Reserved.
  45 .\" Copyright (c) 2006, Sun Microsystems, Inc.  All Rights Reserved.

  46 .\"
  47 .TH GRANTPT 3C "Aug 14, 2006"
  48 .SH NAME
  49 grantpt \- grant access to the slave pseudo-terminal device
  50 .SH SYNOPSIS
  51 .LP
  52 .nf
  53 #include <stdlib.h>
  54 
  55 \fBint\fR \fBgrantpt\fR(\fBint\fR \fIfildes\fR);
  56 .fi
  57 
  58 .SH DESCRIPTION
  59 .sp
  60 .LP
  61 The \fBgrantpt()\fR function changes the mode and ownership of the slave
  62 pseudo-terminal device associated with its master  pseudo-terminal counterpart.
  63 \fIfildes\fR is the file descriptor returned from a successful open of the
  64 master pseudo-terminal device. The user ID of the slave is set to the real UID
  65 of the calling process and the group ID is set to a reserved group. The
  66 permission mode of the slave pseudo-terminal is set to readable and writable by
  67 the owner and writable by the group.
  68 .SH RETURN VALUES
  69 .sp
  70 .LP
  71 Upon successful completion, \fBgrantpt()\fR returns \fB0\fR. Otherwise, it
  72 returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
  73 .SH ERRORS
  74 .sp
  75 .LP
  76 The \fBgrantpt()\fR function may fail if:
  77 .sp
  78 .ne 2
  79 .na
  80 \fB\fBEBADF\fR\fR
  81 .ad
  82 .RS 10n
  83 The \fIfildes\fR argument is not a valid open file descriptor.
  84 .RE
  85 
  86 .sp
  87 .ne 2
  88 .na
  89 \fB\fBEINVAL\fR\fR
  90 .ad
  91 .RS 10n
  92 The \fIfildes\fR argument is not associated with a master pseudo-terminal
  93 device.
  94 .RE
  95 
  96 .sp
  97 .ne 2
  98 .na
  99 \fB\fBEACCES\fR\fR
 100 .ad
 101 .RS 10n
 102 The corresponding slave pseudo-terminal device could not be accessed.
 103 .RE
 104 
 105 .SH ATTRIBUTES
 106 .sp
 107 .LP
 108 See \fBattributes\fR(5) for descriptions of the following attributes:
 109 .sp
 110 
 111 .sp
 112 .TS
 113 box;
 114 c | c
 115 l | l .
 116 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 117 _
 118 Interface Stability     Standard
 119 _
 120 MT-Level        Safe
 121 .TE
 122 
 123 .SH SEE ALSO
 124 .sp
 125 .LP
 126 \fBopen\fR(2), \fBptsname\fR(3C), \fBunlockpt\fR(3C), \fBattributes\fR(5),
 127 \fBstandards\fR(5)
 128 .sp
 129 .LP
 130 \fISTREAMS Programming Guide\fR







  26 .\"
  27 .\" The contents of this file are subject to the terms of the
  28 .\" Common Development and Distribution License (the "License").
  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Copyright 1989 AT&T
  44 .\" Portions Copyright (c) 1994, X/Open Company Limited.  All Rights Reserved.
  45 .\" Copyright (c) 2006, Sun Microsystems, Inc.  All Rights Reserved.
  46 .\" Copyright 2022 Oxide Computer Company
  47 .\"
  48 .Dd February 5, 2022
  49 .Dt GRANTPT 3C
  50 .Os
  51 .Sh NAME
  52 .Nm grantpt
  53 .Nd grant access to the subsidiary device of a pseudo-terminal
  54 .Sh SYNOPSIS
  55 .In stdlib.h
  56 .Ft int
  57 .Fo grantpt
  58 .Fa "int fildes"
  59 .Fc
  60 .Sh DESCRIPTION
  61 The
  62 .Fn grantpt
  63 function changes the mode and ownership of the pseudo-terminal subsidiary
  64 device associated with its pseudo-terminal manager counterpart.
  65 .Pp
  66 The
  67 .Fa fildes
  68 argument is the file descriptor returned from a successful
  69 .Xr open 2
  70 of the pseudo-terminal manager device; e.g., by calling
  71 .Xr posix_openpt 3C
  72 or by performing an
  73 .Xr open 2
  74 of the
  75 .Xr ptm 7D


















  76 device.
  77 .Pp
  78 The user ID owner of the subsidiary device is set to the real user ID of the
  79 calling process.
  80 The group ID owner is set to a reserved group.
  81 .Pp
  82 The permission mode of the subsidiary device is set to be readable and writable
  83 by the owner, and writable by the group.
  84 .Sh RETURN VALUES
  85 .Rv -std grantpt
  86 .Sh EXAMPLES
  87 See
  88 .Xr posix_openpt 3C
  89 for an example that includes a call to
  90 .Fn grantpt .
  91 .Sh ERRORS
  92 The
  93 .Fn grantpt
  94 function may fail if:
  95 .Bl -tag -width Er
  96 .It Er EBADF
  97 The
  98 .Fa fildes
  99 argument is not a valid open file descriptor.
 100 .It Er EINVAL
 101 The
 102 .Fa fildes
 103 argument is not associated with a pseudo-terminal manager device.
 104 .It Er EACCES
 105 The corresponding pseudo-terminal subsidiary device could not be accessed.
 106 .El
 107 .Sh INTERFACE STABILITY
 108 .Sy Committed
 109 .Sh MT LEVEL
 110 .Sy Safe
 111 .Sh SEE ALSO
 112 .Xr open 2 ,
 113 .Xr posix_openpt 3C ,
 114 .Xr ptsname 3C ,
 115 .Xr unlockpt 3C ,
 116 .Xr attributes 5 ,
 117 .Xr standards 5 ,
 118 .Xr ptm 7D