]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getpt.3
dlinfo.3: ATTRIBUTES: Note function that is thread-safe
[thirdparty/man-pages.git] / 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 2015-03-02 "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 For an explanation of the terms used in this section, see
44 .BR attributes (7).
45 .TS
46 allbox;
47 lb lb lb
48 l l l.
49 Interface Attribute Value
50 T{
51 .BR getpt ()
52 T} Thread safety MT-Safe
53 .TE
54 .SH CONFORMING TO
55 .BR getpt ()
56 is glibc-specific;
57 use
58 .BR posix_openpt (3)
59 instead.
60 .SH SEE ALSO
61 .BR grantpt (3),
62 .BR posix_openpt (3),
63 .BR ptsname (3),
64 .BR unlockpt (3),
65 .BR ptmx (4),
66 .BR pty (7)