OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[linuxjm/LDP_man-pages.git] / original / 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 2008-06-14 "GNU" "Linux Programmer's Manual"
5 .SH NAME
6 grantpt \- grant access to the slave pseudoterminal
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 pseudoterminal device
19 corresponding to the master pseudoterminal 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., \fItty\fP).
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
28 .B SIGCHLD
29 signals.
30 .SH "RETURN VALUE"
31 When successful,
32 .BR grantpt ()
33 returns 0.
34 Otherwise, it returns \-1 and sets
35 .I errno
36 appropriately.
37 .SH ERRORS
38 .TP
39 .B EACCES
40 The corresponding slave pseudoterminal could not be accessed.
41 .TP
42 .B EBADF
43 The
44 .I fd
45 argument is not a valid open file descriptor.
46 .TP
47 .B EINVAL
48 The
49 .I fd
50 argument is valid but not associated with a master pseudoterminal.
51 .SH VERSIONS
52 .BR grantpt ()
53 is provided in glibc since version 2.1.
54 .SH "CONFORMING TO"
55 POSIX.1-2001.
56 .SH NOTES
57 This is part of the UNIX 98 pseudoterminal support, see
58 .BR pts (4).
59 Many systems implement this function via a set-user-ID helper binary
60 called "pt_chown".
61 With Linux devpts no such helper binary is required.
62 .SH "SEE ALSO"
63 .BR open (2),
64 .BR posix_openpt (3),
65 .BR ptsname (3),
66 .BR unlockpt (3),
67 .BR pts (4),
68 .BR feature_test_macros (7),
69 .BR pty (7)