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 sets
26 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 POSIX.1-2001
37
39 This is part of the Unix98 pty support, see pts(4). Many systems
40 implement this function via a set-user-ID helper binary called
41 "pt_chown". With Linux devpts no such helper binary is required.
42
44 open(2), posix_openpt(3), ptsname(3), unlockpt(3), pts(4), fea‐
45 ture_test_macros(7), pty(7)
46
47
48
49PTY Control 2003-01-30 GRANTPT(3)