]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/grantpt.3
Wrap source lines at sentence breaks.
[thirdparty/man-pages.git] / man3 / grantpt.3
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 "GNU" "Linux Programmer's Manual"
5 .SH NAME
6 grantpt \- grant access to the slave pseudo-terminal
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
16 The
17 .BR grantpt ()
18 function changes the mode and owner of the slave pseudo-terminal device
19 (pty) corresponding to the master pty referred to by
20 .IR fd .
21 The user ID of the slave is set to the real UID of the calling process.
22 The group ID is set to an unspecified value (e.g. tty).
23 The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
24 .PP
25 The behavior of
26 .BR grantpt ()
27 is unspecified if a signal handler is installed to catch SIGCHLD signals.
28 .SH "RETURN VALUE"
29 When successful,
30 .BR grantpt ()
31 returns 0.
32 Otherwise, it returns \-1 and sets
33 .I errno
34 appropriately.
35 .SH ERRORS
36 .TP
37 .B EACCES
38 The corresponding slave pty could not be accessed.
39 .TP
40 .B EBADF
41 The
42 .I fd
43 argument is not a valid open file descriptor.
44 .TP
45 .B EINVAL
46 The
47 .I fd
48 argument is valid but not associated with a master pty.
49 .SH "CONFORMING TO"
50 POSIX.1-2001
51 .SH NOTES
52 This is part of the Unix98 pty support, see
53 .BR pts (4).
54 Many systems implement this function via a set-user-ID helper binary
55 called "pt_chown". With Linux devpts no such helper binary is required.
56 .SH "SEE ALSO"
57 .BR open (2),
58 .BR posix_openpt (3),
59 .BR ptsname (3),
60 .BR unlockpt (3),
61 .BR pts (4),
62 .BR feature_test_macros (7),
63 .BR pty (7)