]>
Commit | Line | Data |
---|---|---|
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 | 9 | getpt \- 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 | 19 | opens a pseudoterminal master and returns its file descriptor. |
fea681da | 20 | It is equivalent to |
207050fa MK |
21 | .PP |
22 | .in +4n | |
23 | .EX | |
378e5745 | 24 | open("/dev/ptmx", O_RDWR); |
207050fa MK |
25 | .EE |
26 | .in | |
27 | .PP | |
b218b023 | 28 | on Linux systems, though the pseudoterminal master is located |
fea681da | 29 | elsewhere on some systems that use GNU Libc. |
47297adb | 30 | .SH RETURN VALUE |
63aa9df0 | 31 | .BR getpt () |
c13182ef MK |
32 | returns an open file descriptor upon successful completion. |
33 | Otherwise, it | |
8729177b | 34 | returns \-1 and sets |
fea681da MK |
35 | .I errno |
36 | to indicate the error. | |
7e563680 MK |
37 | .SH ERRORS |
38 | .BR getpt () | |
39 | can fail with various errors described in | |
40 | .BR open (2). | |
c343e74c MK |
41 | .SH VERSIONS |
42 | .BR getpt () | |
43 | is provided in glibc since version 2.1. | |
3c768224 | 44 | .SH ATTRIBUTES |
f1ea82e1 MK |
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{ | |
3c768224 | 53 | .BR getpt () |
f1ea82e1 MK |
54 | T} Thread safety MT-Safe |
55 | .TE | |
fea681da | 56 | .SH CONFORMING TO |
63aa9df0 | 57 | .BR getpt () |
f5f6fdda MK |
58 | is glibc-specific; |
59 | use | |
60 | .BR posix_openpt (3) | |
61 | instead. | |
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) |