1getpt(3) Library Functions Manual getpt(3)
2
3
4
6 getpt - open a new pseudoterminal master
7
9 Standard C library (libc, -lc)
10
12 #define _GNU_SOURCE /* See feature_test_macros(7) */
13 #include <stdlib.h>
14
15 int getpt(void);
16
18 getpt() opens a new pseudoterminal device and returns a file descriptor
19 that refers to that device. It is equivalent to opening the pseudoter‐
20 minal multiplexor device
21
22 open("/dev/ptmx", O_RDWR);
23
24 on Linux systems, though the pseudoterminal multiplexor device is lo‐
25 cated elsewhere on some systems that use the GNU C library.
26
28 getpt() returns an open file descriptor upon successful completion.
29 Otherwise, it returns -1 and sets errno to indicate the error.
30
32 getpt() can fail with various errors described in open(2).
33
35 For an explanation of the terms used in this section, see at‐
36 tributes(7).
37
38 ┌────────────────────────────────────────────┬───────────────┬─────────┐
39 │Interface │ Attribute │ Value │
40 ├────────────────────────────────────────────┼───────────────┼─────────┤
41 │getpt() │ Thread safety │ MT-Safe │
42 └────────────────────────────────────────────┴───────────────┴─────────┘
43
45 Use posix_openpt(3) instead.
46
48 GNU.
49
51 glibc 2.1.
52
54 grantpt(3), posix_openpt(3), ptsname(3), unlockpt(3), ptmx(4), pty(7)
55
56
57
58Linux man-pages 6.05 2023-07-20 getpt(3)