]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getpt.3
tcp.7: Update info on tcp_syn_retries default value
[thirdparty/man-pages.git] / man3 / getpt.3
CommitLineData
fea681da 1.\" This man page was written by Jeremy Phelps <jphelps@notreached.net>.
2297bf0e 2.\"
a62be572 3.\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
fea681da 4.\" Redistribute and modify at will.
8ff7380d 5.\" %%%LICENSE_END
fea681da 6.\"
6b621d05 7.TH GETPT 3 2020-02-09 "GNU" "Linux Programmer's Manual"
fea681da 8.SH NAME
b218b023 9getpt \- open the pseudoterminal master (PTM)
fea681da
MK
10.SH SYNOPSIS
11.nf
86b91fdf 12.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
fea681da 13.B #include <stdlib.h>
68e4db0a 14.PP
5ed9e72d 15.B "int getpt(void);"
fea681da
MK
16.fi
17.SH DESCRIPTION
63aa9df0 18.BR getpt ()
b218b023 19opens a pseudoterminal master and returns its file descriptor.
fea681da 20It is equivalent to
207050fa
MK
21.PP
22.in +4n
23.EX
378e5745 24open("/dev/ptmx", O_RDWR);
207050fa
MK
25.EE
26.in
27.PP
b218b023 28on Linux systems, though the pseudoterminal master is located
fea681da 29elsewhere on some systems that use GNU Libc.
47297adb 30.SH RETURN VALUE
63aa9df0 31.BR getpt ()
c13182ef
MK
32returns an open file descriptor upon successful completion.
33Otherwise, it
8729177b 34returns \-1 and sets
fea681da
MK
35.I errno
36to indicate the error.
7e563680
MK
37.SH ERRORS
38.BR getpt ()
39can fail with various errors described in
40.BR open (2).
c343e74c
MK
41.SH VERSIONS
42.BR getpt ()
43is provided in glibc since version 2.1.
3c768224 44.SH ATTRIBUTES
f1ea82e1
MK
45For an explanation of the terms used in this section, see
46.BR attributes (7).
47.TS
48allbox;
49lb lb lb
50l l l.
51Interface Attribute Value
52T{
3c768224 53.BR getpt ()
f1ea82e1
MK
54T} Thread safety MT-Safe
55.TE
fea681da 56.SH CONFORMING TO
63aa9df0 57.BR getpt ()
f5f6fdda
MK
58is glibc-specific;
59use
60.BR posix_openpt (3)
61instead.
47297adb 62.SH SEE ALSO
fea681da 63.BR grantpt (3),
a856c2ea 64.BR posix_openpt (3),
f0c34053 65.BR ptsname (3),
fea681da 66.BR unlockpt (3),
88ab292b
MK
67.BR ptmx (4),
68.BR pty (7)