xref: /freebsd/share/man/man4/pty.4 (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Portions of this software were developed under sponsorship from Snow
5.\" B.V., the Netherlands.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" $FreeBSD$
29.\"
30.Dd August 20, 2008
31.Dt PTY 4
32.Os
33.Sh NAME
34.Nm pty
35.Nd BSD-style and System V-style compatibility pseudo-terminal driver
36.Sh SYNOPSIS
37.Cd "device pty"
38.Sh DESCRIPTION
39The
40.Nm
41driver provides support for the traditional BSD naming scheme that was
42used for accessing pseudo-terminals.
43When the device
44.Pa /dev/ptyXX
45is being opened, a new terminal shall be created with the
46.Xr pts 4
47driver.
48A device node for this terminal shall be created, which has the name
49.Pa /dev/ttyXX .
50.Pp
51The
52.Nm
53driver also provides a cloning System V
54.Pa /dev/ptmx
55device.
56.Pp
57New code should not try to allocate pseudo-terminals using this
58interface.
59It is only provided for compatibility with older C libraries
60that tried to open such devices when
61.Xr posix_openpt 2
62was being called.
63.Sh FILES
64The BSD-style compatibility pseudo-terminal driver uses the following
65device names:
66.Bl -tag -width ".Pa /dev/pty[l-sL-S][0-9a-v]"
67.It Pa /dev/pty[l-sL-S][0-9a-v]
68Pseudo-terminal master devices.
69.It Pa /dev/tty[l-sL-S][0-9a-v]
70Pseudo-terminal slave devices.
71.It Pa /dev/ptmx
72Control device, returns a file descriptor to a new master
73pseudo-terminal when opened.
74.El
75.Sh DIAGNOSTICS
76None.
77.Sh SEE ALSO
78.Xr posix_openpt 2 ,
79.Xr pts 4 ,
80.Xr tty 4
81.Sh HISTORY
82A
83pseudo-terminal driver appeared in
84.Bx 4.2 .
85.Sh BUGS
86Unlike previous implementations, the master and slave device nodes are
87destroyed when the PTY becomes unused.
88A call to
89.Xr stat 2
90on a nonexistent master device will already cause a new master device
91node to be created.
92The master device can only be destroyed by opening and closing it.
93.Pp
94The
95.Nm
96driver cannot be unloaded, because it cannot determine if it is being
97used.
98