]>
Commit | Line | Data |
---|---|---|
2d6c6dd1 | 1 | .\" %%%LICENSE_START(PUBLIC_DOMAIN) |
fea681da | 2 | .\" This page is in the public domain. - aeb |
2d6c6dd1 | 3 | .\" %%%LICENSE_END |
fea681da | 4 | .\" |
4b8c67d9 | 5 | .TH GRANTPT 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da | 6 | .SH NAME |
14f840aa | 7 | grantpt \- grant access to the slave pseudoterminal |
fea681da | 8 | .SH SYNOPSIS |
fea681da | 9 | .B #include <stdlib.h> |
68e4db0a | 10 | .PP |
fea681da | 11 | .BI "int grantpt(int " fd ");" |
68e4db0a | 12 | .PP |
c2ba3716 FT |
13 | .in -4n |
14 | Feature Test Macro Requirements for glibc (see | |
15 | .BR feature_test_macros (7)): | |
16 | .in | |
17 | .PP | |
18 | .ad l | |
19 | .BR grantpt (): | |
20 | .br | |
21 | .RS 4 | |
22 | Since glibc 2.24: | |
23 | _XOPEN_SOURCE\ >=\ 500 || | |
24 | (_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) | |
25 | .br | |
26 | Glibc 2.23 and earlier: | |
27 | _XOPEN_SOURCE | |
28 | .RE | |
29 | .ad | |
fea681da MK |
30 | .SH DESCRIPTION |
31 | The | |
32 | .BR grantpt () | |
14f840aa | 33 | function changes the mode and owner of the slave pseudoterminal device |
6d4268df | 34 | corresponding to the master pseudoterminal referred to by |
fea681da MK |
35 | .IR fd . |
36 | The user ID of the slave is set to the real UID of the calling process. | |
c9942389 MK |
37 | The group ID is set to an unspecified value (e.g., |
38 | .IR tty ). | |
fea681da MK |
39 | The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-). |
40 | .PP | |
41 | The behavior of | |
42 | .BR grantpt () | |
8bd58774 MK |
43 | is unspecified if a signal handler is installed to catch |
44 | .B SIGCHLD | |
45 | signals. | |
47297adb | 46 | .SH RETURN VALUE |
c13182ef | 47 | When successful, |
fea681da | 48 | .BR grantpt () |
677f4766 MK |
49 | returns 0. |
50 | Otherwise, it returns \-1 and sets | |
fea681da MK |
51 | .I errno |
52 | appropriately. | |
53 | .SH ERRORS | |
54 | .TP | |
55 | .B EACCES | |
6d4268df | 56 | The corresponding slave pseudoterminal could not be accessed. |
fea681da MK |
57 | .TP |
58 | .B EBADF | |
59 | The | |
60 | .I fd | |
61 | argument is not a valid open file descriptor. | |
62 | .TP | |
63 | .B EINVAL | |
64 | The | |
65 | .I fd | |
6d4268df | 66 | argument is valid but not associated with a master pseudoterminal. |
c343e74c MK |
67 | .SH VERSIONS |
68 | .BR grantpt () | |
69 | is provided in glibc since version 2.1. | |
f4a23dc2 MS |
70 | .SH ATTRIBUTES |
71 | For an explanation of the terms used in this section, see | |
72 | .BR attributes (7). | |
73 | .TS | |
74 | allbox; | |
75 | lb lb lb | |
76 | l l l. | |
77 | Interface Attribute Value | |
78 | T{ | |
79 | .BR grantpt () | |
80 | T} Thread safety MT-Safe locale | |
81 | .TE | |
847e0d88 | 82 | .sp 1 |
47297adb | 83 | .SH CONFORMING TO |
21a28f3a | 84 | POSIX.1-2001, POSIX.1-2008. |
fea681da | 85 | .SH NOTES |
6d4268df | 86 | This is part of the UNIX 98 pseudoterminal support, see |
fea681da | 87 | .BR pts (4). |
847e0d88 | 88 | .PP |
880f5b4b | 89 | Many systems implement this function via a set-user-ID helper binary |
ca7b3c18 | 90 | called "pt_chown". |
6dcadb9b MK |
91 | On Linux systems with a devpts filesystem (present since Linux 2.2), |
92 | the kernel normally sets the correct ownership and permissions | |
93 | for the pseudoterminal slave when the master is opened | |
94 | .RB ( posix_openpt (3)), | |
95 | so that nothing must be done by | |
96 | .BR grantpt (). | |
97 | Thus, no such helper binary is required | |
98 | (and indeed it is configured to be absent during the | |
99 | glibc build that is typical on many systems). | |
47297adb | 100 | .SH SEE ALSO |
fea681da | 101 | .BR open (2), |
a856c2ea | 102 | .BR posix_openpt (3), |
fea681da MK |
103 | .BR ptsname (3), |
104 | .BR unlockpt (3), | |
88ab292b MK |
105 | .BR pts (4), |
106 | .BR pty (7) |