]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getpt.3
All pages: Remove the 5th argument to .TH
[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 2021-03-22 "Linux man-pages (unreleased)"
8 .SH NAME
9 getpt \- open a new pseudoterminal master
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ", " \-lc )
13 .SH SYNOPSIS
14 .nf
15 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
16 .B #include <stdlib.h>
17 .PP
18 .B "int getpt(void);"
19 .fi
20 .SH DESCRIPTION
21 .BR getpt ()
22 opens a new pseudoterminal device and returns a file descriptor
23 that refers to that device.
24 It is equivalent to opening the pseudoterminal multiplexor device
25 .PP
26 .in +4n
27 .EX
28 open("/dev/ptmx", O_RDWR);
29 .EE
30 .in
31 .PP
32 on Linux systems, though the pseudoterminal multiplexor device is located
33 elsewhere on some systems that use the GNU C library.
34 .SH RETURN VALUE
35 .BR getpt ()
36 returns an open file descriptor upon successful completion.
37 Otherwise, it
38 returns \-1 and sets
39 .I errno
40 to indicate the error.
41 .SH ERRORS
42 .BR getpt ()
43 can fail with various errors described in
44 .BR open (2).
45 .SH VERSIONS
46 .BR getpt ()
47 is provided in glibc since version 2.1.
48 .SH ATTRIBUTES
49 For an explanation of the terms used in this section, see
50 .BR attributes (7).
51 .ad l
52 .nh
53 .TS
54 allbox;
55 lbx lb lb
56 l l l.
57 Interface Attribute Value
58 T{
59 .BR getpt ()
60 T} Thread safety MT-Safe
61 .TE
62 .hy
63 .ad
64 .sp 1
65 .SH STANDARDS
66 .BR getpt ()
67 is glibc-specific;
68 use
69 .BR posix_openpt (3)
70 instead.
71 .SH SEE ALSO
72 .BR grantpt (3),
73 .BR posix_openpt (3),
74 .BR ptsname (3),
75 .BR unlockpt (3),
76 .BR ptmx (4),
77 .BR pty (7)