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
12 grantpt — grant access to the slave pseudo-terminal device
13
15 #include <stdlib.h>
16
17 int grantpt(int fildes);
18
20 The grantpt() function shall change the mode and ownership of the slave
21 pseudo-terminal device associated with its master pseudo-terminal coun‐
22 terpart. The fildes argument is a file descriptor that refers to a mas‐
23 ter pseudo-terminal device. The user ID of the slave shall be set to
24 the real UID of the calling process and the group ID shall be set to an
25 unspecified group ID. The permission mode of the slave pseudo-terminal
26 shall be set to readable and writable by the owner, and writable by the
27 group.
28
29 The behavior of the grantpt() function is unspecified if the applica‐
30 tion has installed a signal handler to catch SIGCHLD signals.
31
33 Upon successful completion, grantpt() shall return 0; otherwise, it
34 shall return -1 and set errno to indicate the error.
35
37 The grantpt() function may fail if:
38
39 EACCES The corresponding slave pseudo-terminal device could not be
40 accessed.
41
42 EBADF The fildes argument is not a valid open file descriptor.
43
44 EINVAL The fildes argument is not associated with a master pseudo-ter‐
45 minal device.
46
47 The following sections are informative.
48
50 None.
51
53 None.
54
56 See the RATIONALE section for posix_openpt().
57
59 None.
60
62 open(), posix_openpt(), ptsname(), unlockpt()
63
64 The Base Definitions volume of POSIX.1‐2017, <stdlib.h>
65
67 Portions of this text are reprinted and reproduced in electronic form
68 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
69 table Operating System Interface (POSIX), The Open Group Base Specifi‐
70 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
71 Electrical and Electronics Engineers, Inc and The Open Group. In the
72 event of any discrepancy between this version and the original IEEE and
73 The Open Group Standard, the original IEEE and The Open Group Standard
74 is the referee document. The original Standard can be obtained online
75 at http://www.opengroup.org/unix/online.html .
76
77 Any typographical or formatting errors that appear in this page are
78 most likely to have been introduced during the conversion of the source
79 files to man page format. To report such errors, see https://www.ker‐
80 nel.org/doc/man-pages/reporting_bugs.html .
81
82
83
84IEEE/The Open Group 2017 GRANTPT(3P)