1GRANTPT(3P) POSIX Programmer's Manual GRANTPT(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 grantpt — grant access to the slave pseudo-terminal device
14
16 #include <stdlib.h>
17
18 int grantpt(int fildes);
19
21 The grantpt() function shall change the mode and ownership of the slave
22 pseudo-terminal device associated with its master pseudo-terminal coun‐
23 terpart. The fildes argument is a file descriptor that refers to a mas‐
24 ter pseudo-terminal device. The user ID of the slave shall be set to
25 the real UID of the calling process and the group ID shall be set to an
26 unspecified group ID. The permission mode of the slave pseudo-terminal
27 shall be set to readable and writable by the owner, and writable by the
28 group.
29
30 The behavior of the grantpt() function is unspecified if the applica‐
31 tion has installed a signal handler to catch SIGCHLD signals.
32
34 Upon successful completion, grantpt() shall return 0; otherwise, it
35 shall return −1 and set errno to indicate the error.
36
38 The grantpt() function may fail if:
39
40 EBADF The fildes argument is not a valid open file descriptor.
41
42 EINVAL The fildes argument is not associated with a master pseudo-ter‐
43 minal device.
44
45 EACCES The corresponding slave pseudo-terminal device could not be
46 accessed.
47
48 The following sections are informative.
49
51 None.
52
54 None.
55
57 See the RATIONALE section for posix_openpt().
58
60 None.
61
63 open(), posix_openpt(), ptsname(), unlockpt()
64
65 The Base Definitions volume of POSIX.1‐2008, <stdlib.h>
66
68 Portions of this text are reprinted and reproduced in electronic form
69 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
70 -- Portable Operating System Interface (POSIX), The Open Group Base
71 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
72 cal and Electronics Engineers, Inc and The Open Group. (This is
73 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
74 event of any discrepancy between this version and the original IEEE and
75 The Open Group Standard, the original IEEE and The Open Group Standard
76 is the referee document. The original Standard can be obtained online
77 at http://www.unix.org/online.html .
78
79 Any typographical or formatting errors that appear in this page are
80 most likely to have been introduced during the conversion of the source
81 files to man page format. To report such errors, see https://www.ker‐
82 nel.org/doc/man-pages/reporting_bugs.html .
83
84
85
86IEEE/The Open Group 2013 GRANTPT(3P)