]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/grantpt.3
accept.2, bind.2, connect.2, getpeername.2, getpriority.2, getsockname.2, getsockopt...
[thirdparty/man-pages.git] / man3 / grantpt.3
CommitLineData
fea681da
MK
1.\" This page is in the public domain. - aeb
2.\"
c343e74c 3.TH GRANTPT 3 2008-06-14 "GNU" "Linux Programmer's Manual"
fea681da 4.SH NAME
14f840aa 5grantpt \- grant access to the slave pseudoterminal
fea681da
MK
6.SH SYNOPSIS
7.nf
b80f966b 8.BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
fea681da
MK
9.br
10.B #include <stdlib.h>
11.sp
12.BI "int grantpt(int " fd ");"
13.fi
14.SH DESCRIPTION
15The
16.BR grantpt ()
14f840aa 17function changes the mode and owner of the slave pseudoterminal device
6d4268df 18corresponding to the master pseudoterminal referred to by
fea681da
MK
19.IR fd .
20The user ID of the slave is set to the real UID of the calling process.
3f282501 21The group ID is set to an unspecified value (e.g., \fItty\fP).
fea681da
MK
22The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
23.PP
24The behavior of
25.BR grantpt ()
8bd58774
MK
26is unspecified if a signal handler is installed to catch
27.B SIGCHLD
28signals.
47297adb 29.SH RETURN VALUE
c13182ef 30When successful,
fea681da 31.BR grantpt ()
677f4766
MK
32returns 0.
33Otherwise, it returns \-1 and sets
fea681da
MK
34.I errno
35appropriately.
36.SH ERRORS
37.TP
38.B EACCES
6d4268df 39The corresponding slave pseudoterminal could not be accessed.
fea681da
MK
40.TP
41.B EBADF
42The
43.I fd
44argument is not a valid open file descriptor.
45.TP
46.B EINVAL
47The
48.I fd
6d4268df 49argument is valid but not associated with a master pseudoterminal.
c343e74c
MK
50.SH VERSIONS
51.BR grantpt ()
52is provided in glibc since version 2.1.
47297adb 53.SH CONFORMING TO
44a2c328 54POSIX.1-2001.
fea681da 55.SH NOTES
6d4268df 56This is part of the UNIX 98 pseudoterminal support, see
fea681da 57.BR pts (4).
880f5b4b 58Many systems implement this function via a set-user-ID helper binary
ca7b3c18
MK
59called "pt_chown".
60With Linux devpts no such helper binary is required.
47297adb 61.SH SEE ALSO
fea681da 62.BR open (2),
a856c2ea 63.BR posix_openpt (3),
fea681da
MK
64.BR ptsname (3),
65.BR unlockpt (3),
88ab292b
MK
66.BR pts (4),
67.BR pty (7)