1getpt(3)                   Library Functions Manual                   getpt(3)
2
3
4

NAME

6       getpt - open a new pseudoterminal master
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #define _GNU_SOURCE             /* See feature_test_macros(7) */
13       #include <stdlib.h>
14
15       int getpt(void);
16

DESCRIPTION

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

RETURN VALUE

28       getpt() returns an open file  descriptor  upon  successful  completion.
29       Otherwise, it returns -1 and sets errno to indicate the error.
30

ERRORS

32       getpt() can fail with various errors described in open(2).
33

ATTRIBUTES

35       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
36       tributes(7).
37
38       ┌────────────────────────────────────────────┬───────────────┬─────────┐
39Interface                                   Attribute     Value   
40       ├────────────────────────────────────────────┼───────────────┼─────────┤
41getpt()                                     │ Thread safety │ MT-Safe │
42       └────────────────────────────────────────────┴───────────────┴─────────┘
43

VERSIONS

45       Use posix_openpt(3) instead.
46

STANDARDS

48       GNU.
49

HISTORY

51       glibc 2.1.
52

SEE ALSO

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)
Impressum