]>
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 | .\" |
fe0fefbf | 5 | .TH GRANTPT 3 2015-03-02 "GNU" "Linux Programmer's Manual" |
fea681da | 6 | .SH NAME |
14f840aa | 7 | grantpt \- grant access to the slave pseudoterminal |
fea681da MK |
8 | .SH SYNOPSIS |
9 | .nf | |
b80f966b | 10 | .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */" |
fea681da MK |
11 | .br |
12 | .B #include <stdlib.h> | |
13 | .sp | |
14 | .BI "int grantpt(int " fd ");" | |
15 | .fi | |
16 | .SH DESCRIPTION | |
17 | The | |
18 | .BR grantpt () | |
14f840aa | 19 | function changes the mode and owner of the slave pseudoterminal device |
6d4268df | 20 | corresponding to the master pseudoterminal referred to by |
fea681da MK |
21 | .IR fd . |
22 | The user ID of the slave is set to the real UID of the calling process. | |
c9942389 MK |
23 | The group ID is set to an unspecified value (e.g., |
24 | .IR tty ). | |
fea681da MK |
25 | The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-). |
26 | .PP | |
27 | The behavior of | |
28 | .BR grantpt () | |
8bd58774 MK |
29 | is unspecified if a signal handler is installed to catch |
30 | .B SIGCHLD | |
31 | signals. | |
47297adb | 32 | .SH RETURN VALUE |
c13182ef | 33 | When successful, |
fea681da | 34 | .BR grantpt () |
677f4766 MK |
35 | returns 0. |
36 | Otherwise, it returns \-1 and sets | |
fea681da MK |
37 | .I errno |
38 | appropriately. | |
39 | .SH ERRORS | |
40 | .TP | |
41 | .B EACCES | |
6d4268df | 42 | The corresponding slave pseudoterminal could not be accessed. |
fea681da MK |
43 | .TP |
44 | .B EBADF | |
45 | The | |
46 | .I fd | |
47 | argument is not a valid open file descriptor. | |
48 | .TP | |
49 | .B EINVAL | |
50 | The | |
51 | .I fd | |
6d4268df | 52 | argument is valid but not associated with a master pseudoterminal. |
c343e74c MK |
53 | .SH VERSIONS |
54 | .BR grantpt () | |
55 | is provided in glibc since version 2.1. | |
f4a23dc2 MS |
56 | .SH ATTRIBUTES |
57 | For an explanation of the terms used in this section, see | |
58 | .BR attributes (7). | |
59 | .TS | |
60 | allbox; | |
61 | lb lb lb | |
62 | l l l. | |
63 | Interface Attribute Value | |
64 | T{ | |
65 | .BR grantpt () | |
66 | T} Thread safety MT-Safe locale | |
67 | .TE | |
68 | ||
47297adb | 69 | .SH CONFORMING TO |
44a2c328 | 70 | POSIX.1-2001. |
fea681da | 71 | .SH NOTES |
6d4268df | 72 | This is part of the UNIX 98 pseudoterminal support, see |
fea681da | 73 | .BR pts (4). |
880f5b4b | 74 | Many systems implement this function via a set-user-ID helper binary |
ca7b3c18 MK |
75 | called "pt_chown". |
76 | With Linux devpts no such helper binary is required. | |
47297adb | 77 | .SH SEE ALSO |
fea681da | 78 | .BR open (2), |
a856c2ea | 79 | .BR posix_openpt (3), |
fea681da MK |
80 | .BR ptsname (3), |
81 | .BR unlockpt (3), | |
88ab292b MK |
82 | .BR pts (4), |
83 | .BR pty (7) |