1GRANTPT(3) Linux Programmer's Manual GRANTPT(3)
2
3
4
6 grantpt - grant access to the slave pseudoterminal
7
9 #define _XOPEN_SOURCE /* See feature_test_macros(7) */
10 #include <stdlib.h>
11
12 int grantpt(int fd);
13
15 The grantpt() function changes the mode and owner of the slave pseu‐
16 doterminal device corresponding to the master pseudoterminal referred
17 to by fd. The user ID of the slave is set to the real UID of the call‐
18 ing process. The group ID is set to an unspecified value (e.g., tty).
19 The mode of the slave is set to 0620 (crw--w----).
20
21 The behavior of grantpt() is unspecified if a signal handler is
22 installed to catch SIGCHLD signals.
23
25 When successful, grantpt() returns 0. Otherwise, it returns -1 and
26 sets errno appropriately.
27
29 EACCES The corresponding slave pseudoterminal could not be accessed.
30
31 EBADF The fd argument is not a valid open file descriptor.
32
33 EINVAL The fd argument is valid but not associated with a master pseu‐
34 doterminal.
35
37 grantpt() is provided in glibc since version 2.1.
38
40 POSIX.1-2001.
41
43 This is part of the UNIX 98 pseudoterminal support, see pts(4). Many
44 systems implement this function via a set-user-ID helper binary called
45 "pt_chown". With Linux devpts no such helper binary is required.
46
48 open(2), posix_openpt(3), ptsname(3), unlockpt(3), pts(4), pty(7)
49
51 This page is part of release 3.53 of the Linux man-pages project. A
52 description of the project, and information about reporting bugs, can
53 be found at http://www.kernel.org/doc/man-pages/.
54
55
56
57GNU 2008-06-14 GRANTPT(3)