]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getpt.3
_exit.2, bpf.2, cacheflush.2, capget.2, chdir.2, chmod.2, chroot.2, clock_getres...
[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.\"
fe0fefbf 7.TH GETPT 3 2015-03-02 "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
c31765d3
MK
21.nf
22
23 open(/dev/ptmx, O_RDWR | O_NOCTTY);
24
25.fi
b218b023 26on Linux systems, though the pseudoterminal master is located
fea681da 27elsewhere on some systems that use GNU Libc.
47297adb 28.SH RETURN VALUE
63aa9df0 29.BR getpt ()
c13182ef
MK
30returns an open file descriptor upon successful completion.
31Otherwise, it
8729177b 32returns \-1 and sets
fea681da
MK
33.I errno
34to indicate the error.
7e563680
MK
35.SH ERRORS
36.BR getpt ()
37can fail with various errors described in
38.BR open (2).
c343e74c
MK
39.SH VERSIONS
40.BR getpt ()
41is provided in glibc since version 2.1.
3c768224 42.SH ATTRIBUTES
f1ea82e1
MK
43For an explanation of the terms used in this section, see
44.BR attributes (7).
45.TS
46allbox;
47lb lb lb
48l l l.
49Interface Attribute Value
50T{
3c768224 51.BR getpt ()
f1ea82e1
MK
52T} Thread safety MT-Safe
53.TE
fea681da 54.SH CONFORMING TO
63aa9df0 55.BR getpt ()
f5f6fdda
MK
56is glibc-specific;
57use
58.BR posix_openpt (3)
59instead.
47297adb 60.SH SEE ALSO
fea681da 61.BR grantpt (3),
a856c2ea 62.BR posix_openpt (3),
f0c34053 63.BR ptsname (3),
fea681da 64.BR unlockpt (3),
88ab292b
MK
65.BR ptmx (4),
66.BR pty (7)