1 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
2 .\" This page is in the public domain. - aeb
5 .TH GRANTPT 3 2021-03-22 "GNU" "Linux Programmer's Manual"
7 grantpt \- grant access to the slave pseudoterminal
10 .B #include <stdlib.h>
12 .BI "int grantpt(int " fd ");"
16 Feature Test Macro Requirements for glibc (see
17 .BR feature_test_macros (7)):
24 .\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
25 Glibc 2.23 and earlier:
31 function changes the mode and owner of the slave pseudoterminal device
32 corresponding to the master pseudoterminal referred to by the file descriptor
34 The user ID of the slave is set to the real UID of the calling process.
35 The group ID is set to an unspecified value (e.g.,
37 The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
41 is unspecified if a signal handler is installed to catch
48 Otherwise, it returns \-1 and sets
50 to indicate the error.
54 The corresponding slave pseudoterminal could not be accessed.
59 argument is not a valid open file descriptor.
64 argument is valid but not associated with a master pseudoterminal.
67 is provided in glibc since version 2.1.
69 For an explanation of the terms used in this section, see
77 Interface Attribute Value
80 T} Thread safety MT-Safe locale
86 POSIX.1-2001, POSIX.1-2008.
88 This is part of the UNIX 98 pseudoterminal support, see
91 Many systems implement this function via a set-user-ID helper binary
93 On Linux systems with a devpts filesystem (present since Linux 2.2),
94 the kernel normally sets the correct ownership and permissions
95 for the pseudoterminal slave when the master is opened
96 .RB ( posix_openpt (3)),
97 so that nothing must be done by
99 Thus, no such helper binary is required
100 (and indeed it is configured to be absent during the
101 glibc build that is typical on many systems).
104 .BR posix_openpt (3),