]>
Commit | Line | Data |
---|---|---|
1 | .\" %%%LICENSE_START(PUBLIC_DOMAIN) | |
2 | .\" This page is in the public domain. - aeb | |
3 | .\" %%%LICENSE_END | |
4 | .\" | |
5 | .TH GRANTPT 3 2015-03-02 "GNU" "Linux Programmer's Manual" | |
6 | .SH NAME | |
7 | grantpt \- grant access to the slave pseudoterminal | |
8 | .SH SYNOPSIS | |
9 | .nf | |
10 | .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */" | |
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 () | |
19 | function changes the mode and owner of the slave pseudoterminal device | |
20 | corresponding to the master pseudoterminal referred to by | |
21 | .IR fd . | |
22 | The user ID of the slave is set to the real UID of the calling process. | |
23 | The group ID is set to an unspecified value (e.g., | |
24 | .IR tty ). | |
25 | The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-). | |
26 | .PP | |
27 | The behavior of | |
28 | .BR grantpt () | |
29 | is unspecified if a signal handler is installed to catch | |
30 | .B SIGCHLD | |
31 | signals. | |
32 | .SH RETURN VALUE | |
33 | When successful, | |
34 | .BR grantpt () | |
35 | returns 0. | |
36 | Otherwise, it returns \-1 and sets | |
37 | .I errno | |
38 | appropriately. | |
39 | .SH ERRORS | |
40 | .TP | |
41 | .B EACCES | |
42 | The corresponding slave pseudoterminal could not be accessed. | |
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 | |
52 | argument is valid but not associated with a master pseudoterminal. | |
53 | .SH VERSIONS | |
54 | .BR grantpt () | |
55 | is provided in glibc since version 2.1. | |
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 | ||
69 | .SH CONFORMING TO | |
70 | POSIX.1-2001. | |
71 | .SH NOTES | |
72 | This is part of the UNIX 98 pseudoterminal support, see | |
73 | .BR pts (4). | |
74 | Many systems implement this function via a set-user-ID helper binary | |
75 | called "pt_chown". | |
76 | With Linux devpts no such helper binary is required. | |
77 | .SH SEE ALSO | |
78 | .BR open (2), | |
79 | .BR posix_openpt (3), | |
80 | .BR ptsname (3), | |
81 | .BR unlockpt (3), | |
82 | .BR pts (4), | |
83 | .BR pty (7) |