]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/grantpt.3
sync
[thirdparty/man-pages.git] / man3 / grantpt.3
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\" This page is in the public domain. - aeb
3.\"
4.TH GRANTPT 3 "2003-01-30" "PTY Control" "Linux Programmer's Manual"
5.SH NAME
3124d276 6grantpt \- grant access to the slave pseudo-terminal
fea681da
MK
7.SH SYNOPSIS
8.nf
9.B #define _XOPEN_SOURCE
10.br
11.B #include <stdlib.h>
12.sp
13.BI "int grantpt(int " fd ");"
14.fi
15.SH DESCRIPTION
16The
17.BR grantpt ()
18function changes the mode and owner of the slave pseudo-terminal device
19(pty) corresponding to the master pty referred to by
20.IR fd .
21The user ID of the slave is set to the real UID of the calling process.
22The group ID is set to an unspecified value (e.g. tty).
23The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
24.PP
25The behavior of
26.BR grantpt ()
27is unspecified if a signal handler is installed to catch SIGCHLD signals.
28.SH "RETURN VALUE"
29When successful,
30.BR grantpt ()
31returns 0. Otherwise, it returns \-1 and sets
32.I errno
33appropriately.
34.SH ERRORS
35.TP
36.B EACCES
37The corresponding slave pty could not be accessed.
38.TP
39.B EBADF
40The
41.I fd
42argument is not a valid open file descriptor.
43.TP
44.B EINVAL
45The
46.I fd
47argument is valid but not associated with a master pty.
48.SH "CONFORMING TO"
68e1685c 49POSIX.1-2001
fea681da
MK
50.SH NOTES
51This is part of the Unix98 pty support, see
52.BR pts (4).
880f5b4b 53Many systems implement this function via a set-user-ID helper binary
fea681da
MK
54called "pt_chown". With Linux devpts no such helper binary is required.
55.SH "SEE ALSO"
56.BR open (2),
a856c2ea 57.BR posix_openpt (3),
fea681da
MK
58.BR ptsname (3),
59.BR unlockpt (3),
88ab292b 60.BR pts (4),
0a90178c 61.BR feature_test_macros (7),
88ab292b 62.BR pty (7)