share/mk/: Remove unused variable
[man-pages.git] / man3 / grantpt.3
blob94526691b591a0591ee26c387718fae4213e1cfd
1 '\" t
2 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
3 .\" This page is in the public domain. - aeb
4 .\" %%%LICENSE_END
5 .\"
6 .TH grantpt 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 grantpt \- grant access to the slave pseudoterminal
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <stdlib.h>
16 .BI "int grantpt(int " fd ");"
17 .fi
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
24 .BR grantpt ():
25 .nf
26     Since glibc 2.24:
27         _XOPEN_SOURCE >= 500
28 .\"        || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
29     glibc 2.23 and earlier:
30         _XOPEN_SOURCE
31 .fi
32 .SH DESCRIPTION
33 The
34 .BR grantpt ()
35 function changes the mode and owner of the slave pseudoterminal device
36 corresponding to the master pseudoterminal referred to by the file descriptor
37 .IR fd .
38 The user ID of the slave is set to the real UID of the calling process.
39 The group ID is set to an unspecified value (e.g.,
40 .IR tty ).
41 The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
43 The behavior of
44 .BR grantpt ()
45 is unspecified if a signal handler is installed to catch
46 .B SIGCHLD
47 signals.
48 .SH RETURN VALUE
49 When successful,
50 .BR grantpt ()
51 returns 0.
52 Otherwise, it returns \-1 and sets
53 .I errno
54 to indicate the error.
55 .SH ERRORS
56 .TP
57 .B EACCES
58 The corresponding slave pseudoterminal could not be accessed.
59 .TP
60 .B EBADF
61 The
62 .I fd
63 argument is not a valid open file descriptor.
64 .TP
65 .B EINVAL
66 The
67 .I fd
68 argument is valid but not associated with a master pseudoterminal.
69 .SH ATTRIBUTES
70 For an explanation of the terms used in this section, see
71 .BR attributes (7).
72 .TS
73 allbox;
74 lbx lb lb
75 l l l.
76 Interface       Attribute       Value
78 .na
79 .nh
80 .BR grantpt ()
81 T}      Thread safety   MT-Safe locale
82 .TE
83 .SH STANDARDS
84 POSIX.1-2008.
85 .SH HISTORY
86 glibc 2.1.
87 POSIX.1-2001.
89 This is part of the UNIX 98 pseudoterminal support, see
90 .BR pts (4).
92 Historical systems implemented this function via a set-user-ID helper binary
93 called "pt_chown".
94 glibc on Linux before glibc 2.33 could do so as well,
95 in order to support configurations with only BSD pseudoterminals;
96 this support has been removed.
97 On modern systems this is either a no-op
98 \[em]with permissions configured on pty allocation, as is the case on Linux\[em]
99 or an
100 .BR ioctl (2).
101 .SH SEE ALSO
102 .BR open (2),
103 .BR posix_openpt (3),
104 .BR ptsname (3),
105 .BR unlockpt (3),
106 .BR pts (4),
107 .BR pty (7)