1GRANTPT(3) Linux Programmer's Manual GRANTPT(3)
2
3
4
6 grantpt - grant access to the slave pseudo-terminal
7
9 #define _XOPEN_SOURCE
10 #include <stdlib.h>
11
12 int grantpt(int fd);
13
15 The grantpt() function changes the mode and owner of the slave pseudo-
16 terminal device (pty) corresponding to the master pty referred to by
17 fd. The user ID of the slave is set to the real UID of the calling
18 process. The group ID is set to an unspecified value (e.g., tty). The
19 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 pty 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 pty.
34
36 grantpt() is provided in glibc since version 2.1.
37
39 POSIX.1-2001.
40
42 This is part of the Unix98 pty support, see pts(4). Many systems
43 implement this function via a set-user-ID helper binary called
44 "pt_chown". With Linux devpts no such helper binary is required.
45
47 open(2), posix_openpt(3), ptsname(3), unlockpt(3), pts(4), fea‐
48 ture_test_macros(7), pty(7)
49
51 This page is part of release 3.22 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)