OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man3 / grantpt.3
1 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
2 .\" This page is in the public domain. - aeb
3 .\" %%%LICENSE_END
4 .\"
5 .TH GRANTPT 3 2008-06-14 "GNU" "Linux Programmer's Manual"
6 .SH NAME
7 grantpt \- grant access to the slave pseudoterminal
8 .SH SYNOPSIS
9 .nf
10 .BR "#define _XOPEN_SOURCE" "       /* See feature_test_macros(7) */"
11 .br
12 .B #include <stdlib.h>
13 .sp
14 .BI "int grantpt(int " fd ");"
15 .fi
16 .SH DESCRIPTION
17 The
18 .BR grantpt ()
19 function changes the mode and owner of the slave pseudoterminal device
20 corresponding to the master pseudoterminal referred to by
21 .IR fd .
22 The user ID of the slave is set to the real UID of the calling process.
23 The group ID is set to an unspecified value (e.g.,
24 .IR tty ).
25 The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
26 .PP
27 The behavior of
28 .BR grantpt ()
29 is unspecified if a signal handler is installed to catch
30 .B SIGCHLD
31 signals.
32 .SH RETURN VALUE
33 When successful,
34 .BR grantpt ()
35 returns 0.
36 Otherwise, it returns \-1 and sets
37 .I errno
38 appropriately.
39 .SH ERRORS
40 .TP
41 .B EACCES
42 The corresponding slave pseudoterminal could not be accessed.
43 .TP
44 .B EBADF
45 The
46 .I fd
47 argument is not a valid open file descriptor.
48 .TP
49 .B EINVAL
50 The
51 .I fd
52 argument is valid but not associated with a master pseudoterminal.
53 .SH VERSIONS
54 .BR grantpt ()
55 is provided in glibc since version 2.1.
56 .SH CONFORMING TO
57 POSIX.1-2001.
58 .SH NOTES
59 This is part of the UNIX 98 pseudoterminal support, see
60 .BR pts (4).
61 Many systems implement this function via a set-user-ID helper binary
62 called "pt_chown".
63 With Linux devpts no such helper binary is required.
64 .SH SEE ALSO
65 .BR open (2),
66 .BR posix_openpt (3),
67 .BR ptsname (3),
68 .BR unlockpt (3),
69 .BR pts (4),
70 .BR pty (7)
71 .SH COLOPHON
72 This page is part of release 3.68 of the Linux
73 .I man-pages
74 project.
75 A description of the project,
76 information about reporting bugs,
77 and the latest version of this page,
78 can be found at
79 \%http://www.kernel.org/doc/man\-pages/.