2 .\" Copyright (c) 1996 Joerg Wunsch
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\" $FreeBSD: head/lib/libutil/pty.3 206622 2010-04-14 19:08:06Z uqs $
34 .Nd auxiliary functions to obtain a pseudo-terminal
43 .Fn openpty "int *amaster" "int *aslave" "char *name" "struct termios *termp" "struct winsize *winp"
45 .Fn forkpty "int *amaster" "char *name" "struct termios *termp" "struct winsize *winp"
49 attempts to obtain the next available pseudo-terminal from the system (see
51 If it successfully finds one, it subsequently changes the
52 ownership of the slave device to the real UID of the current process,
53 the group membership to the group
55 (if such a group exists in the system), the access permissions for
56 reading and writing by the owner, and for writing by the group, and
57 invalidates any current use of the line by calling
65 copies the pathname of the slave pty to this area.
67 responsible for allocating the required space in this array.
76 initializes the termios and window size settings from the structures
77 these arguments point to, respectively.
79 Upon return, the open file descriptors for the master and slave side
80 of the pty are returned in the locations pointed to by
90 to obtain the next available pseudo-terminal from the system.
92 it forks off a new process.
93 In the child process, it closes the descriptor
94 for the master side of the pty, and calls
97 In the parent process, it closes the descriptor for the
98 slave side of the pty.
105 have the same meaning as described for
110 function returns 0 on success, or -1 on failure.
114 function returns -1 on failure, 0 in the slave process, and the process ID of
115 the slave process in the parent process.
119 function may fail and set the global variable
121 for any of the errors specified for the
133 may set it to any value as described for