1 .\" Copyright (C) 2004 Michael Kerrisk
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH POSIX_OPENPT 3 2016-03-15 "" "Linux Programmer's Manual"
27 posix_openpt \- open a pseudoterminal device
30 .B #include <stdlib.h>
33 .BI "int posix_openpt(int " flags ");"
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
43 _XOPEN_SOURCE\ >=\ 600
48 function opens an unused pseudoterminal master device, returning a
49 file descriptor that can be used to refer to that device.
53 argument is a bit mask that ORs together zero or more of
57 Open the device for both reading and writing.
58 It is usual to specify this flag.
61 Do not make this device the controlling terminal for the process.
65 returns a nonnegative file descriptor which is the lowest
66 numbered unused file descriptor.
67 On failure, \-1 is returned, and
69 is set to indicate the error.
76 has been provided since version 2.2.1.
78 For an explanation of the terms used in this section, see
84 Interface Attribute Value
87 T} Thread safety MT-Safe
90 POSIX.1-2001, POSIX.1-2008.
93 is part of the UNIX 98 pseudoterminal support (see
96 Some older UNIX implementations that support System V
97 (aka UNIX 98) pseudoterminals don't have this function, but it
103 posix_openpt(int flags)
105 return open("/dev/ptmx", flags);
112 creates a pathname for the corresponding pseudoterminal slave device.
113 The pathname of the slave device can be obtained using
115 The slave device pathname exists only as long as the master device is open.