]> git.ipfire.org Git - thirdparty/man-pages.git/blame_incremental - man3/grantpt.3
glob.3: wfix
[thirdparty/man-pages.git] / man3 / grantpt.3
... / ...
CommitLineData
1.\" %%%LICENSE_START(PUBLIC_DOMAIN)
2.\" This page is in the public domain. - aeb
3.\" %%%LICENSE_END
4.\"
5.TH GRANTPT 3 2015-03-02 "GNU" "Linux Programmer's Manual"
6.SH NAME
7grantpt \- grant access to the slave pseudoterminal
8.SH SYNOPSIS
9.nf
10.BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
11.br
12.B #include <stdlib.h>
13.sp
14.BI "int grantpt(int " fd ");"
15.fi
16.SH DESCRIPTION
17The
18.BR grantpt ()
19function changes the mode and owner of the slave pseudoterminal device
20corresponding to the master pseudoterminal referred to by
21.IR fd .
22The user ID of the slave is set to the real UID of the calling process.
23The group ID is set to an unspecified value (e.g.,
24.IR tty ).
25The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
26.PP
27The behavior of
28.BR grantpt ()
29is unspecified if a signal handler is installed to catch
30.B SIGCHLD
31signals.
32.SH RETURN VALUE
33When successful,
34.BR grantpt ()
35returns 0.
36Otherwise, it returns \-1 and sets
37.I errno
38appropriately.
39.SH ERRORS
40.TP
41.B EACCES
42The corresponding slave pseudoterminal could not be accessed.
43.TP
44.B EBADF
45The
46.I fd
47argument is not a valid open file descriptor.
48.TP
49.B EINVAL
50The
51.I fd
52argument is valid but not associated with a master pseudoterminal.
53.SH VERSIONS
54.BR grantpt ()
55is provided in glibc since version 2.1.
56.SH ATTRIBUTES
57For an explanation of the terms used in this section, see
58.BR attributes (7).
59.TS
60allbox;
61lb lb lb
62l l l.
63Interface Attribute Value
64T{
65.BR grantpt ()
66T} Thread safety MT-Safe locale
67.TE
68
69.SH CONFORMING TO
70POSIX.1-2001.
71.SH NOTES
72This is part of the UNIX 98 pseudoterminal support, see
73.BR pts (4).
74Many systems implement this function via a set-user-ID helper binary
75called "pt_chown".
76With Linux devpts no such helper binary is required.
77.SH SEE ALSO
78.BR open (2),
79.BR posix_openpt (3),
80.BR ptsname (3),
81.BR unlockpt (3),
82.BR pts (4),
83.BR pty (7)