xref: /freebsd/share/man/man4/pty.4 (revision dc318a4ffabcbfa23bb56a33403aad36e6de30af)
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 October 28, 2019
31.Dt PTY 4
32.Os
33.Sh NAME
34.Nm pty
35.Nd old-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 before it was replaced by
43.Xr pts 4 .
44This traditional naming is still used in Linux.
45When the device
46.Pa /dev/ptyXX
47is being opened, a new terminal shall be created with the
48.Xr pts 4
49driver.
50A device node for this terminal shall be created, which has the name
51.Pa /dev/ttyXX .
52.Pp
53The
54.Nm
55driver also provides a cloning System V
56.Pa /dev/ptmx
57device.
58.Pp
59New code should not try to allocate pseudo-terminals using this
60interface.
61It is only provided for compatibility with older C libraries
62that tried to open such devices when
63.Xr posix_openpt 2
64was being called,
65and for running Linux binaries.
66.Sh FILES
67The BSD-style compatibility pseudo-terminal driver uses the following
68device names:
69.Bl -tag -width ".Pa /dev/pty[l-sL-S][0-9a-v]"
70.It Pa /dev/pty[l-sL-S][0-9a-v]
71Pseudo-terminal master devices.
72.It Pa /dev/tty[l-sL-S][0-9a-v]
73Pseudo-terminal slave devices.
74.It Pa /dev/ptmx
75Control device, returns a file descriptor to a new master
76pseudo-terminal when opened.
77.El
78.Sh DIAGNOSTICS
79None.
80.Sh SEE ALSO
81.Xr posix_openpt 2 ,
82.Xr pts 4 ,
83.Xr tty 4
84.Sh HISTORY
85A
86pseudo-terminal driver appeared in
87.Bx 4.2 .
88.Sh BUGS
89Unlike previous implementations, the master and slave device nodes are
90destroyed when the PTY becomes unused.
91A call to
92.Xr stat 2
93on a nonexistent master device will already cause a new master device
94node to be created.
95The master device can only be destroyed by opening and closing it.
96.Pp
97The
98.Nm
99driver cannot be unloaded, because it cannot determine if it is being
100used.
101