xref: /illumos-gate/usr/src/man/man3c/grantpt.3c (revision bbf215553c7233fbab8a0afdf1fac74c44781867)
166492cf0SYuri Pankov.\"
266492cf0SYuri Pankov.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
366492cf0SYuri Pankov.\" permission to reproduce portions of its copyrighted documentation.
466492cf0SYuri Pankov.\" Original documentation from The Open Group can be obtained online at
566492cf0SYuri Pankov.\" http://www.opengroup.org/bookstore/.
666492cf0SYuri Pankov.\"
766492cf0SYuri Pankov.\" The Institute of Electrical and Electronics Engineers and The Open
866492cf0SYuri Pankov.\" Group, have given us permission to reprint portions of their
966492cf0SYuri Pankov.\" documentation.
1066492cf0SYuri Pankov.\"
1166492cf0SYuri Pankov.\" In the following statement, the phrase ``this text'' refers to portions
1266492cf0SYuri Pankov.\" of the system documentation.
1366492cf0SYuri Pankov.\"
1466492cf0SYuri Pankov.\" Portions of this text are reprinted and reproduced in electronic form
1566492cf0SYuri Pankov.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
1666492cf0SYuri Pankov.\" Standard for Information Technology -- Portable Operating System
1766492cf0SYuri Pankov.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
1866492cf0SYuri Pankov.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
1966492cf0SYuri Pankov.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
2066492cf0SYuri Pankov.\" between these versions and the original IEEE and The Open Group
2166492cf0SYuri Pankov.\" Standard, the original IEEE and The Open Group Standard is the referee
2266492cf0SYuri Pankov.\" document.  The original Standard can be obtained online at
2366492cf0SYuri Pankov.\" http://www.opengroup.org/unix/online.html.
2466492cf0SYuri Pankov.\"
2566492cf0SYuri Pankov.\" This notice shall appear on any product containing this material.
2666492cf0SYuri Pankov.\"
2766492cf0SYuri Pankov.\" The contents of this file are subject to the terms of the
2866492cf0SYuri Pankov.\" Common Development and Distribution License (the "License").
2966492cf0SYuri Pankov.\" You may not use this file except in compliance with the License.
3066492cf0SYuri Pankov.\"
3166492cf0SYuri Pankov.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3266492cf0SYuri Pankov.\" or http://www.opensolaris.org/os/licensing.
3366492cf0SYuri Pankov.\" See the License for the specific language governing permissions
3466492cf0SYuri Pankov.\" and limitations under the License.
3566492cf0SYuri Pankov.\"
3666492cf0SYuri Pankov.\" When distributing Covered Code, include this CDDL HEADER in each
3766492cf0SYuri Pankov.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3866492cf0SYuri Pankov.\" If applicable, add the following below this CDDL HEADER, with the
3966492cf0SYuri Pankov.\" fields enclosed by brackets "[]" replaced with your own identifying
4066492cf0SYuri Pankov.\" information: Portions Copyright [yyyy] [name of copyright owner]
4166492cf0SYuri Pankov.\"
4266492cf0SYuri Pankov.\"
43c10c16deSRichard Lowe.\" Copyright 1989 AT&T
44c10c16deSRichard Lowe.\" Portions Copyright (c) 1994, X/Open Company Limited.  All Rights Reserved.
4566492cf0SYuri Pankov.\" Copyright (c) 2006, Sun Microsystems, Inc.  All Rights Reserved.
461fa2a664SJoshua M. Clulow.\" Copyright 2022 Oxide Computer Company
4766492cf0SYuri Pankov.\"
481fa2a664SJoshua M. Clulow.Dd February 5, 2022
491fa2a664SJoshua M. Clulow.Dt GRANTPT 3C
501fa2a664SJoshua M. Clulow.Os
511fa2a664SJoshua M. Clulow.Sh NAME
521fa2a664SJoshua M. Clulow.Nm grantpt
531fa2a664SJoshua M. Clulow.Nd grant access to the subsidiary device of a pseudo-terminal
541fa2a664SJoshua M. Clulow.Sh SYNOPSIS
551fa2a664SJoshua M. Clulow.In stdlib.h
561fa2a664SJoshua M. Clulow.Ft int
571fa2a664SJoshua M. Clulow.Fo grantpt
581fa2a664SJoshua M. Clulow.Fa "int fildes"
591fa2a664SJoshua M. Clulow.Fc
601fa2a664SJoshua M. Clulow.Sh DESCRIPTION
611fa2a664SJoshua M. ClulowThe
621fa2a664SJoshua M. Clulow.Fn grantpt
631fa2a664SJoshua M. Clulowfunction changes the mode and ownership of the pseudo-terminal subsidiary
641fa2a664SJoshua M. Clulowdevice associated with its pseudo-terminal manager counterpart.
651fa2a664SJoshua M. Clulow.Pp
661fa2a664SJoshua M. ClulowThe
671fa2a664SJoshua M. Clulow.Fa fildes
681fa2a664SJoshua M. Clulowargument is the file descriptor returned from a successful
691fa2a664SJoshua M. Clulow.Xr open 2
701fa2a664SJoshua M. Clulowof the pseudo-terminal manager device; e.g., by calling
711fa2a664SJoshua M. Clulow.Xr posix_openpt 3C
721fa2a664SJoshua M. Clulowor by performing an
731fa2a664SJoshua M. Clulow.Xr open 2
741fa2a664SJoshua M. Clulowof the
75*bbf21555SRichard Lowe.Xr ptm 4D
76c10c16deSRichard Lowedevice.
771fa2a664SJoshua M. Clulow.Pp
781fa2a664SJoshua M. ClulowThe user ID owner of the subsidiary device is set to the real user ID of the
791fa2a664SJoshua M. Clulowcalling process.
801fa2a664SJoshua M. ClulowThe group ID owner is set to a reserved group.
811fa2a664SJoshua M. Clulow.Pp
821fa2a664SJoshua M. ClulowThe permission mode of the subsidiary device is set to be readable and writable
831fa2a664SJoshua M. Clulowby the owner, and writable by the group.
841fa2a664SJoshua M. Clulow.Sh RETURN VALUES
851fa2a664SJoshua M. Clulow.Rv -std grantpt
861fa2a664SJoshua M. Clulow.Sh EXAMPLES
871fa2a664SJoshua M. ClulowSee
881fa2a664SJoshua M. Clulow.Xr posix_openpt 3C
891fa2a664SJoshua M. Clulowfor an example that includes a call to
901fa2a664SJoshua M. Clulow.Fn grantpt .
911fa2a664SJoshua M. Clulow.Sh ERRORS
921fa2a664SJoshua M. ClulowThe
931fa2a664SJoshua M. Clulow.Fn grantpt
941fa2a664SJoshua M. Clulowfunction may fail if:
951fa2a664SJoshua M. Clulow.Bl -tag -width Er
961fa2a664SJoshua M. Clulow.It Er EBADF
971fa2a664SJoshua M. ClulowThe
981fa2a664SJoshua M. Clulow.Fa fildes
991fa2a664SJoshua M. Clulowargument is not a valid open file descriptor.
1001fa2a664SJoshua M. Clulow.It Er EINVAL
1011fa2a664SJoshua M. ClulowThe
1021fa2a664SJoshua M. Clulow.Fa fildes
1031fa2a664SJoshua M. Clulowargument is not associated with a pseudo-terminal manager device.
1041fa2a664SJoshua M. Clulow.It Er EACCES
1051fa2a664SJoshua M. ClulowThe corresponding pseudo-terminal subsidiary device could not be accessed.
1061fa2a664SJoshua M. Clulow.El
1071fa2a664SJoshua M. Clulow.Sh INTERFACE STABILITY
1081fa2a664SJoshua M. Clulow.Sy Committed
1091fa2a664SJoshua M. Clulow.Sh MT LEVEL
1101fa2a664SJoshua M. Clulow.Sy Safe
1111fa2a664SJoshua M. Clulow.Sh SEE ALSO
1121fa2a664SJoshua M. Clulow.Xr open 2 ,
1131fa2a664SJoshua M. Clulow.Xr posix_openpt 3C ,
1141fa2a664SJoshua M. Clulow.Xr ptsname 3C ,
1151fa2a664SJoshua M. Clulow.Xr unlockpt 3C ,
116*bbf21555SRichard Lowe.Xr ptm 4D ,
117*bbf21555SRichard Lowe.Xr attributes 7 ,
118*bbf21555SRichard Lowe.Xr standards 7
119