]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/grantpt.3
glob.3: wfix
[thirdparty/man-pages.git] / man3 / grantpt.3
CommitLineData
2d6c6dd1 1.\" %%%LICENSE_START(PUBLIC_DOMAIN)
fea681da 2.\" This page is in the public domain. - aeb
2d6c6dd1 3.\" %%%LICENSE_END
fea681da 4.\"
fe0fefbf 5.TH GRANTPT 3 2015-03-02 "GNU" "Linux Programmer's Manual"
fea681da 6.SH NAME
14f840aa 7grantpt \- grant access to the slave pseudoterminal
fea681da
MK
8.SH SYNOPSIS
9.nf
b80f966b 10.BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
fea681da
MK
11.br
12.B #include <stdlib.h>
13.sp
14.BI "int grantpt(int " fd ");"
15.fi
16.SH DESCRIPTION
17The
18.BR grantpt ()
14f840aa 19function changes the mode and owner of the slave pseudoterminal device
6d4268df 20corresponding to the master pseudoterminal referred to by
fea681da
MK
21.IR fd .
22The user ID of the slave is set to the real UID of the calling process.
c9942389
MK
23The group ID is set to an unspecified value (e.g.,
24.IR tty ).
fea681da
MK
25The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
26.PP
27The behavior of
28.BR grantpt ()
8bd58774
MK
29is unspecified if a signal handler is installed to catch
30.B SIGCHLD
31signals.
47297adb 32.SH RETURN VALUE
c13182ef 33When successful,
fea681da 34.BR grantpt ()
677f4766
MK
35returns 0.
36Otherwise, it returns \-1 and sets
fea681da
MK
37.I errno
38appropriately.
39.SH ERRORS
40.TP
41.B EACCES
6d4268df 42The corresponding slave pseudoterminal could not be accessed.
fea681da
MK
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
6d4268df 52argument is valid but not associated with a master pseudoterminal.
c343e74c
MK
53.SH VERSIONS
54.BR grantpt ()
55is provided in glibc since version 2.1.
f4a23dc2
MS
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
47297adb 69.SH CONFORMING TO
44a2c328 70POSIX.1-2001.
fea681da 71.SH NOTES
6d4268df 72This is part of the UNIX 98 pseudoterminal support, see
fea681da 73.BR pts (4).
880f5b4b 74Many systems implement this function via a set-user-ID helper binary
ca7b3c18
MK
75called "pt_chown".
76With Linux devpts no such helper binary is required.
47297adb 77.SH SEE ALSO
fea681da 78.BR open (2),
a856c2ea 79.BR posix_openpt (3),
fea681da
MK
80.BR ptsname (3),
81.BR unlockpt (3),
88ab292b
MK
82.BR pts (4),
83.BR pty (7)