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