OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / getpt.3
1 .\" This man page was written by Jeremy Phelps <jphelps@notreached.net>.
2 .\"
3 .\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
4 .\" Redistribute and modify at will.
5 .\" %%%LICENSE_END
6 .\"
7 .TH GETPT 3 2014-04-01 "GNU" "Linux Programmer's Manual"
8 .SH NAME
9 getpt \- open the pseudoterminal master (PTM)
10 .SH SYNOPSIS
11 .nf
12 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
13 .B #include <stdlib.h>
14 .sp
15 .B "int getpt(void);"
16 .fi
17 .SH DESCRIPTION
18 .BR getpt ()
19 opens a pseudoterminal master and returns its file descriptor.
20 It is equivalent to
21 .nf
22
23     open(/dev/ptmx, O_RDWR | O_NOCTTY);
24
25 .fi
26 on Linux systems, though the pseudoterminal master is located
27 elsewhere on some systems that use GNU Libc.
28 .SH RETURN VALUE
29 .BR getpt ()
30 returns an open file descriptor upon successful completion.
31 Otherwise, it
32 returns \-1 and sets
33 .I errno
34 to indicate the error.
35 .SH ERRORS
36 .BR getpt ()
37 can fail with various errors described in
38 .BR open (2).
39 .SH VERSIONS
40 .BR getpt ()
41 is provided in glibc since version 2.1.
42 .SH ATTRIBUTES
43 .SS Multithreading (see pthreads(7))
44 The
45 .BR getpt ()
46 function is thread-safe.
47 .SH CONFORMING TO
48 .BR getpt ()
49 is glibc-specific;
50 use
51 .BR posix_openpt (3)
52 instead.
53 .SH SEE ALSO
54 .BR grantpt (3),
55 .BR posix_openpt (3),
56 .BR ptsname (3),
57 .BR unlockpt (3),
58 .BR ptmx (4),
59 .BR pty (7)
60 .SH COLOPHON
61 This page is part of release 3.79 of the Linux
62 .I man-pages
63 project.
64 A description of the project,
65 information about reporting bugs,
66 and the latest version of this page,
67 can be found at
68 \%http://www.kernel.org/doc/man\-pages/.