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