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.
40 .Nd pseudo-terminal access functions
46 .Fn grantpt "int fildes"
48 .Fn ptsname "int fildes"
50 .Fn ptsname_r "int fildes" "char *buffer" "size_t buflen"
52 .Fn unlockpt "int fildes"
59 functions allow access to pseudo-terminal devices.
60 These three functions accept a file descriptor that references the
61 master half of a pseudo-terminal pair.
62 This file descriptor is created with
67 function is used to establish ownership and permissions
68 of the slave device counterpart to the master device
71 The slave device's ownership is set to the real user ID
72 of the calling process, and the permissions are set to
73 user readable-writable and group writable.
74 The group owner of the slave device is also set to the
80 function returns the full pathname of the slave device
81 counterpart to the master device specified with
83 This value can be used
84 to subsequently open the appropriate slave after
92 function is the thread-safe version of
94 The caller must provide storage for the results of the full pathname of
95 the slave device in the
103 function clears the lock held on the pseudo-terminal pair
104 for the master device specified with
107 .Rv -std grantpt ptsname_r unlockpt
111 function returns a pointer to the name
112 of the slave device on success; otherwise a
122 functions may fail and set
128 is not a valid open file descriptor.
131 is not a master pseudo-terminal device.
141 The buffer was too small.
151 The slave pseudo-terminal device could not be accessed.
163 This implementation of
169 because it depends on
171 to create the pseudo-terminal device with proper permissions in place.
172 It only validates whether
174 is a valid pseudo-terminal master device.
175 Future revisions of the specification will likely allow this behaviour,
176 as stated by the Austin Group.
183 functions appeared in