2 .\" Copyright (c) 2002 The FreeBSD Project, Inc.
3 .\" All rights reserved.
5 .\" This software includes code contributed to the FreeBSD Project
6 .\" by Ryan Younce of North Carolina State University.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the FreeBSD Project nor the names of its
17 .\" contributors may be used to endorse or promote products derived from
18 .\" this software without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT AND CONTRIBUTORS
21 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 .\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT
24 .\" OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26 .\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 .\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 .\" $FreeBSD: src/lib/libc/stdlib/grantpt.3,v 1.3 2003/09/14 13:41:57 ru Exp $
43 .Nd pseudo-terminal access functions
78 functions allow access to pseudo-terminal devices.
79 The first four functions accept a file descriptor
80 that references the master half of a pseudo-terminal pair.
81 This file descriptor is created with
86 function is used to establish ownership and permissions
87 of the slave device counterpart to the master device
90 The slave device's ownership is set to the real user ID
91 of the calling process; its permissions are set to
92 user readable-writable and group writable.
93 The group owner of the slave device is also set to the group
95 if it exists on the system; otherwise, it
102 functions return the full pathname of the slave device
103 counterpart to the master device specified with
105 This value can be used
106 to subsequently open the appropriate slave after
110 have been called. The
112 function is not guaranteed to be reentrant or thread safe. The
114 function takes a buffer and length as arguments to avoid this problem.
118 function unlocks the slave pseudo-terminal device associated
119 with the master device to which
125 function opens the first available master pseudo-terminal
126 device and returns a descriptor to it.
130 specifies the flags used for opening the device:
131 .Bl -tag -width ".Dv O_NOCTTY"
133 Open for reading and writing.
135 If set, do not allow the terminal to become
136 the controlling terminal for the calling process.
139 .Rv -std grantpt unlockpt
143 function returns a pointer to the name
144 of the slave device on success; otherwise a
146 pointer is returned and the global variable
148 is set to indicate the error.
152 function returns 0 if successful. On failure, it returns -1 and the global variable
154 is set to indicate the error.
158 function returns a file descriptor to the first
159 available master pseudo-terminal device on success;
160 otherwise \-1 is returned and the global variable
162 is set to indicate the error.
170 functions may fail and set
176 is not a master pseudo-terminal device.
194 argument is smaller than the length of the string to be returned.
204 The slave pseudo-terminal device could not be accessed.
209 function may fail and set
215 consists of an invalid mode bit.
217 The system has no available pseudo-terminal devices.
226 functions may also fail and set
228 for any of the errors specified for the
234 function may also fail and set
236 for any of the errors specified for the
240 .Fd #include <stdlib.h>
241 .Fd #include <fcntl.h>
261 .Fd #include <fcntl.h>