xref: /netbsd-src/share/man/man4/ptm.4 (revision e5548b402ae4c44fb816de42c7bba9581ce23ef5)
1.\"        $NetBSD: ptm.4,v 1.5 2005/11/12 18:53:47 christos Exp $
2.\"
3.\" Copyright (c) 2004 Thomas Klausner
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. The name of the author may not be used to endorse or promote products
15.\"    derived from this software without specific prior written permission
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.Dd November 12, 2005
29.Dt PTM 4
30.Os
31.Sh NAME
32.Nm ptm
33.Nd pseudo-terminal multiplexor device
34.Sh SYNOPSIS
35.Cd pseudo-device pty Op Ar count
36.Sh DESCRIPTION
37The
38.Nm
39driver is the backend for the
40.Pa /dev/ptm
41device.
42It supports three
43.Xr ioctl 2 Ns s .
44The first is
45.Dv TIOCPTMGET ,
46which allocates a free pseudo-terminal device, sets its user ID to
47the calling user,
48.Xr revoke 2 Ns s
49it, and returns the opened file descriptors for both the master
50and the slave pseudo-terminal device to the caller in a
51.Va struct ptmget .
52This struct has the following content:
53.Bd -literal -offset indent
54struct ptmget {
55        int     cfd;
56        int     sfd;
57        char    cn[16];
58        char    sn[16];
59};
60.Ed
61.Pp
62where
63.Va cfd
64and
65.Va sfd
66contain the master resp. slave device's file descriptor and
67.Va cn
68and
69.Va sn
70the corresponding paths in the file system.
71.Pp
72The
73.Pa /dev/ptmx
74device supports two more
75.Xr ioctl 2 Ns s ,
76.Dv TIOCGRANTPT ,
77which is used by
78.Xr grantpt 3 ,
79.Dv TIOCPTSNAME ,
80which is used by
81.Xr ptsname 3 .
82.Pp
83The
84.Nm
85device is included with the pseudo-device
86.Xr pty 4 .
87It can be disabled by adding
88.Dq Cd options NO_DEV_PTM
89to the kernel configuration.
90.Sh FILES
91.Bl -tag
92.It Pa /dev/ptm
93.Nm
94access device
95.It Pa /dev/ptmx
96.Nm
97cloning device, used to implement Unix98 ptys
98.El
99.Sh SEE ALSO
100.Xr grantpt 3 ,
101.Xr openpty 3 ,
102.Xr posix_openpt 3 ,
103.Xr ptsname 3 ,
104.Xr unlockpt 3 ,
105.Xr pty 4
106.Sh HISTORY
107The
108.Pa /dev/ptm
109device appeared in
110.Ox 3.5
111and was ported to
112.Nx 3.0 .
113