1 .\" Copyright (c) OpenBSD Group
2 .\" All rights reserved.
4 .\" SPDX-License-Identifier: BSD-3-Clause
6 .\" Converted into a manpage again by Martin Schulze <joey@infodrom.org>
8 .\" Added -lutil remark, 030718
10 .TH openpty 3 (date) "Linux man-pages (unreleased)"
12 openpty, login_tty, forkpty \- terminal utility functions
14 System utilities library
15 .RI ( libutil ", " \-lutil )
20 .BI "int openpty(int *" amaster ", int *" aslave ", char *" name ,
21 .BI " const struct termios *" termp ,
22 .BI " const struct winsize *" winp );
23 .BI "pid_t forkpty(int *" amaster ", char *" name ,
24 .BI " const struct termios *" termp ,
25 .BI " const struct winsize *" winp );
29 .BI "int login_tty(int " fd );
34 function finds an available pseudoterminal and returns file descriptors
35 for the master and slave in
41 is not NULL, the filename of the slave is returned in
45 is not NULL, the terminal parameters of the slave will be set to the
50 is not NULL, the window size of the slave will be set to the values in
55 function prepares for a login on the terminal
56 referred to by the file descriptor
58 (which may be a real terminal device, or the slave of a pseudoterminal as
61 by creating a new session, making
63 the controlling terminal for the calling process, setting
65 to be the standard input, output, and error streams of the current
76 to create a new process operating in a pseudoterminal.
77 A file descriptor referring to
78 master side of the pseudoterminal is returned in
82 is not NULL, the buffer it points to is used to return the
83 filename of the slave.
88 arguments, if not NULL,
89 will determine the terminal attributes and window size of the slave
90 side of the pseudoterminal.
97 is not successful, \-1 is returned and
99 is set to indicate the error.
103 and the child process of
105 return 0, and the parent process of
107 returns the process ID of the child process.
113 There are no available terminals.
120 to the controlling terminal of the calling process.
129 For an explanation of the terms used in this section, see
137 Interface Attribute Value
141 T} Thread safety MT-Safe locale
144 T} Thread safety MT-Unsafe race:ttyname
150 These are BSD functions, present in glibc.
151 They are not standardized in POSIX.
155 modifiers were added to the structure pointer arguments of
161 In versions of glibc before 2.0.92,
163 returns file descriptors for a BSD pseudoterminal pair;
165 it first attempts to open a UNIX 98 pseudoterminal pair,
166 and falls back to opening a BSD pseudoterminal pair if that fails.
168 Nobody knows how much space should be reserved for