1GETPT(3) Linux Programmer's Manual GETPT(3)
2
3
4
6 getpt - open a new pseudoterminal master
7
9 #define _GNU_SOURCE /* See feature_test_macros(7) */
10 #include <stdlib.h>
11
12 int getpt(void);
13
15 getpt() opens a new pseudoterminal device and returns a file descriptor
16 that refers to that device. It is equivalent to opening the pseudoter‐
17 minal multiplexor device
18
19 open("/dev/ptmx", O_RDWR);
20
21 on Linux systems, though the pseudoterminal multiplexor device is lo‐
22 cated elsewhere on some systems that use the GNU C library.
23
25 getpt() returns an open file descriptor upon successful completion.
26 Otherwise, it returns -1 and sets errno to indicate the error.
27
29 getpt() can fail with various errors described in open(2).
30
32 getpt() is provided in glibc since version 2.1.
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 └──────────┴───────────────┴─────────┘
44 getpt() is glibc-specific; use posix_openpt(3) instead.
45
47 grantpt(3), posix_openpt(3), ptsname(3), unlockpt(3), ptmx(4), pty(7)
48
50 This page is part of release 5.10 of the Linux man-pages project. A
51 description of the project, information about reporting bugs, and the
52 latest version of this page, can be found at
53 https://www.kernel.org/doc/man-pages/.
54
55
56
57GNU 2020-08-13 GETPT(3)