NetBSD/share/man/man4/ptm.4

111 lines
2.8 KiB
Groff

.\" $NetBSD: ptm.4,v 1.8 2013/12/01 00:17:14 christos Exp $
.\"
.\" Copyright (c) 2004 Thomas Klausner
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 30, 2013
.Dt PTM 4
.Os
.Sh NAME
.Nm ptm
.Nd pseudo-terminal multiplexor device
.Sh SYNOPSIS
.Cd pseudo-device pty
.Sh DESCRIPTION
The
.Nm
driver is the backend for the
.Pa /dev/ptm
device.
It supports three
.Xr ioctl 2 Ns s .
The first is
.Dv TIOCPTMGET ,
which allocates a free pseudo-terminal device, sets its user ID to
the calling user,
.Xr revoke 2 Ns s
it, and returns the opened file descriptors for both the master
and the slave pseudo-terminal device to the caller in a
.Va struct ptmget .
This struct has the following content:
.Bd -literal -offset indent
struct ptmget {
int cfd;
int sfd;
char cn[PATH_MAX];
char sn[PATH_MAX];
};
.Ed
.Pp
where
.Va cfd
and
.Va sfd
contain the master resp. slave device's file descriptor and
.Va cn
and
.Va sn
the corresponding paths in the file system.
.Pp
The
.Pa /dev/ptmx
device supports two more
.Xr ioctl 2 Ns s ,
.Dv TIOCGRANTPT ,
which is used by
.Xr grantpt 3 ,
.Dv TIOCPTSNAME ,
which is used by
.Xr ptsname 3 .
.Pp
The
.Nm
device is included with the pseudo-device
.Xr pty 4 .
It can be disabled by adding
.Dq Cd options NO_DEV_PTM
to the kernel configuration.
.Sh FILES
.Bl -tag
.It Pa /dev/ptm
.Nm
access device
.It Pa /dev/ptmx
.Nm
cloning device, used to implement Unix98 ptys
.El
.Sh SEE ALSO
.Xr grantpt 3 ,
.Xr openpty 3 ,
.Xr posix_openpt 3 ,
.Xr ptsname 3 ,
.Xr unlockpt 3 ,
.Xr pty 4
.Sh HISTORY
The
.Pa /dev/ptm
device appeared in
.Ox 3.5
and was ported to
.Nx 3.0 .