xref: /freebsd/share/man/man4/pty.4 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
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.Dd October 28, 2019
29.Dt PTY 4
30.Os
31.Sh NAME
32.Nm pty
33.Nd old-style compatibility pseudo-terminal driver
34.Sh SYNOPSIS
35.Cd "device pty"
36.Sh DESCRIPTION
37The
38.Nm
39driver provides support for the traditional BSD naming scheme that was
40used for accessing pseudo-terminals before it was replaced by
41.Xr pts 4 .
42This traditional naming is still used in Linux.
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,
63and for running Linux binaries.
64.Sh FILES
65The BSD-style compatibility pseudo-terminal driver uses the following
66device names:
67.Bl -tag -width ".Pa /dev/pty[l-sL-S][0-9a-v]"
68.It Pa /dev/pty[l-sL-S][0-9a-v]
69Pseudo-terminal master devices.
70.It Pa /dev/tty[l-sL-S][0-9a-v]
71Pseudo-terminal slave devices.
72.It Pa /dev/ptmx
73Control device, returns a file descriptor to a new master
74pseudo-terminal when opened.
75.El
76.Sh DIAGNOSTICS
77None.
78.Sh SEE ALSO
79.Xr posix_openpt 2 ,
80.Xr pts 4 ,
81.Xr tty 4
82.Sh HISTORY
83A
84pseudo-terminal driver appeared in
85.Bx 4.2 .
86.Sh BUGS
87Unlike previous implementations, the master and slave device nodes are
88destroyed when the PTY becomes unused.
89A call to
90.Xr stat 2
91on a nonexistent master device will already cause a new master device
92node to be created.
93The master device can only be destroyed by opening and closing it.
94.Pp
95The
96.Nm
97driver cannot be unloaded, because it cannot determine if it is being
98used.
99