OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[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., \fItty\fP).
24 The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
25 .PP
26 The behavior of
27 .BR grantpt ()
28 is unspecified if a signal handler is installed to catch
29 .B SIGCHLD
30 signals.
31 .SH RETURN VALUE
32 When successful,
33 .BR grantpt ()
34 returns 0.
35 Otherwise, it returns \-1 and sets
36 .I errno
37 appropriately.
38 .SH ERRORS
39 .TP
40 .B EACCES
41 The corresponding slave pseudoterminal could not be accessed.
42 .TP
43 .B EBADF
44 The
45 .I fd
46 argument is not a valid open file descriptor.
47 .TP
48 .B EINVAL
49 The
50 .I fd
51 argument is valid but not associated with a master pseudoterminal.
52 .SH VERSIONS
53 .BR grantpt ()
54 is provided in glibc since version 2.1.
55 .SH CONFORMING TO
56 POSIX.1-2001.
57 .SH NOTES
58 This is part of the UNIX 98 pseudoterminal support, see
59 .BR pts (4).
60 Many systems implement this function via a set-user-ID helper binary
61 called "pt_chown".
62 With Linux devpts no such helper binary is required.
63 .SH SEE ALSO
64 .BR open (2),
65 .BR posix_openpt (3),
66 .BR ptsname (3),
67 .BR unlockpt (3),
68 .BR pts (4),
69 .BR pty (7)