nightly: remove unused BINARCHIVE
[unleashed.git] / share / man / man3c / grantpt.3c
blob7e523af80b974a35b9170b43d5e7c933682ac996
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
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>
55 \fBint\fR \fBgrantpt\fR(\fBint\fR \fIfildes\fR);
56 .fi
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
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
96 .sp
97 .ne 2
98 .na
99 \fB\fBEACCES\fR\fR
101 .RS 10n
102 The corresponding slave pseudo-terminal device could not be accessed.
105 .SH ATTRIBUTES
108 See \fBattributes\fR(5) for descriptions of the following attributes:
113 box;
114 c | c
115 l | l .
116 ATTRIBUTE TYPE  ATTRIBUTE VALUE
118 Interface Stability     Standard
120 MT-Level        Safe
123 .SH SEE ALSO
126 \fBopen\fR(2), \fBptsname\fR(3C), \fBunlockpt\fR(3C), \fBattributes\fR(5),
127 \fBstandards\fR(5)
130 \fISTREAMS Programming Guide\fR