]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getpt.3
isatty.3: Most non-tty files nowadays result in the error ENOTTY
[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 .PP
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 .PP
22 .in +4n
23 .EX
24 open(/dev/ptmx, O_RDWR | O_NOCTTY);
25 .EE
26 .in
27 .PP
28 on Linux systems, though the pseudoterminal master is located
29 elsewhere on some systems that use GNU Libc.
30 .SH RETURN VALUE
31 .BR getpt ()
32 returns an open file descriptor upon successful completion.
33 Otherwise, it
34 returns \-1 and sets
35 .I errno
36 to indicate the error.
37 .SH ERRORS
38 .BR getpt ()
39 can fail with various errors described in
40 .BR open (2).
41 .SH VERSIONS
42 .BR getpt ()
43 is provided in glibc since version 2.1.
44 .SH ATTRIBUTES
45 For an explanation of the terms used in this section, see
46 .BR attributes (7).
47 .TS
48 allbox;
49 lb lb lb
50 l l l.
51 Interface Attribute Value
52 T{
53 .BR getpt ()
54 T} Thread safety MT-Safe
55 .TE
56 .SH CONFORMING TO
57 .BR getpt ()
58 is glibc-specific;
59 use
60 .BR posix_openpt (3)
61 instead.
62 .SH SEE ALSO
63 .BR grantpt (3),
64 .BR posix_openpt (3),
65 .BR ptsname (3),
66 .BR unlockpt (3),
67 .BR ptmx (4),
68 .BR pty (7)