]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" This page is in the public domain. - aeb |
2 | .\" | |
c343e74c | 3 | .TH GRANTPT 3 2008-06-14 "GNU" "Linux Programmer's Manual" |
fea681da | 4 | .SH NAME |
14f840aa | 5 | grantpt \- grant access to the slave pseudoterminal |
fea681da MK |
6 | .SH SYNOPSIS |
7 | .nf | |
b80f966b | 8 | .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */" |
fea681da MK |
9 | .br |
10 | .B #include <stdlib.h> | |
11 | .sp | |
12 | .BI "int grantpt(int " fd ");" | |
13 | .fi | |
14 | .SH DESCRIPTION | |
15 | The | |
16 | .BR grantpt () | |
14f840aa | 17 | function changes the mode and owner of the slave pseudoterminal device |
6d4268df | 18 | corresponding to the master pseudoterminal referred to by |
fea681da MK |
19 | .IR fd . |
20 | The user ID of the slave is set to the real UID of the calling process. | |
3f282501 | 21 | The group ID is set to an unspecified value (e.g., \fItty\fP). |
fea681da MK |
22 | The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-). |
23 | .PP | |
24 | The behavior of | |
25 | .BR grantpt () | |
8bd58774 MK |
26 | is unspecified if a signal handler is installed to catch |
27 | .B SIGCHLD | |
28 | signals. | |
47297adb | 29 | .SH RETURN VALUE |
c13182ef | 30 | When successful, |
fea681da | 31 | .BR grantpt () |
677f4766 MK |
32 | returns 0. |
33 | Otherwise, it returns \-1 and sets | |
fea681da MK |
34 | .I errno |
35 | appropriately. | |
36 | .SH ERRORS | |
37 | .TP | |
38 | .B EACCES | |
6d4268df | 39 | The corresponding slave pseudoterminal could not be accessed. |
fea681da MK |
40 | .TP |
41 | .B EBADF | |
42 | The | |
43 | .I fd | |
44 | argument is not a valid open file descriptor. | |
45 | .TP | |
46 | .B EINVAL | |
47 | The | |
48 | .I fd | |
6d4268df | 49 | argument is valid but not associated with a master pseudoterminal. |
c343e74c MK |
50 | .SH VERSIONS |
51 | .BR grantpt () | |
52 | is provided in glibc since version 2.1. | |
47297adb | 53 | .SH CONFORMING TO |
44a2c328 | 54 | POSIX.1-2001. |
fea681da | 55 | .SH NOTES |
6d4268df | 56 | This is part of the UNIX 98 pseudoterminal support, see |
fea681da | 57 | .BR pts (4). |
880f5b4b | 58 | Many systems implement this function via a set-user-ID helper binary |
ca7b3c18 MK |
59 | called "pt_chown". |
60 | With Linux devpts no such helper binary is required. | |
47297adb | 61 | .SH SEE ALSO |
fea681da | 62 | .BR open (2), |
a856c2ea | 63 | .BR posix_openpt (3), |
fea681da MK |
64 | .BR ptsname (3), |
65 | .BR unlockpt (3), | |
88ab292b MK |
66 | .BR pts (4), |
67 | .BR pty (7) |