svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
pts(4d)
pts(4D) Device Drivers & /dev files pts(4D)
NAME
pts - STREAMS pseudo-tty subsidiary driver
DESCRIPTION
The pseudo-tty subsystem simulates a terminal connection, where the
manager side represents the terminal and the subsidiary represents the
user process's special device end point. The manager device is set up
as a cloned device where its major device number is the major for the
clone device and its minor device number is the major for the ptm dri‐
ver. There are no nodes in the filesystem for manager devices. The man‐
ager pseudo driver is opened using the open system call with /dev/ptmx
as the device parameter. For more information, see the open(2) man
page. The clone open finds the next available minor device for the ptm
major device. A manager device is available only if it and its corre‐
sponding subsidiary device are not already open. When the manager de‐
vice is opened, the corresponding subsidiary device is automatically
locked out. No user may open that subsidiary device until its permis‐
sions are adjusted and the device unlocked by calling the functions
grantpt() and unlockpt(). For more information, see the grantpt(3C) and
unlockpt(3C) man pages. The user can then invoke the open system call
with the name that is returned by the ptsname() function. For more in‐
formation, see the ptsname(3C) man page. See the example below.
Only one open is allowed on a manager device. Multiple opens are al‐
lowed on the subsidiary device. After both the manager and subsidiary
have been opened, the user has two file descriptors which are the end
points of a full duplex connection composed of two streams which are
automatically connected at the manager and subsidiary drivers. The user
may then push modules onto either side of the stream pair. The auto‐
push(8) system will push the required STREAMS modules for terminal se‐
mantics on first open.
The manager and subsidiary drivers pass all messages to their adjacent
queues. Only the M_FLUSH needs some processing. Because the read queue
of one side is connected to the write queue of the other, the FLUSHR
flag is changed to the FLUSHW flag and vice versa. When the manager de‐
vice is closed an M_HANGUP message is sent to the subsidiary device
which will render the device unusable. The process on the subsidiary
side gets the errno EIO when attempting to write on that stream but it
will be able to read any data remaining on the stream head read queue.
When all the data has been read, read returns 0 indicating that the
stream can no longer be used. On the last close of the subsidiary de‐
vice, a 0-length message is sent to the manager device. When the appli‐
cation on the manager side issues a read() or getmsg() and 0 is re‐
turned, the user of the manager device decides whether to issue a
close() that dismantles the pseudo-terminal subsystem. If the manager
device is not closed, the pseudo-tty subsystem will be available to an‐
other user to open the subsidiary device. Since 0-length messages are
used to indicate that the process on the subsidiary side has closed and
should be interpreted that way by the process on the manager side, ap‐
plications on the subsidiary side should not write 0-length messages.
If that occurs, the write returns 0, and the 0-length message is dis‐
carded by the ptem module.
The standard STREAMS system calls can access the pseudo-tty devices.
The subsidiary devices support the O_NDELAY and O_NONBLOCK flags.
EXAMPLES
int fdm fds;
char *subsidiaryname;
extern char *ptsname();
fdm = open("/dev/ptmx", O_RDWR); /* open manager */
grantpt(fdm); /* change permission of subsidiary */
unlockpt(fdm); /* unlock subsidiary */
subsidiaryname = ptsname(fdm); /* get name of subsidiary */
fds = open(subsidiaryname, O_RDWR); /* open subsidiary */
FILES
/dev/ptmx manager clone device
/dev/pts/N subsidiary devices (N = 1 -> number of ptys available)
SEE ALSO
ptsname(3C), unlockpt(3C), grantpt(3C), openpty(3C), posix_openpt(3C),
ptm(4D), ldterm(4M), ptem(4M), ttcompat(4M), autopush(8)
STREAMS Programming Guide
Oracle Solaris 11.4 Tunable Parameters Reference Manual
NOTES
In previous releases and earlier standards, subsidiary devices were re‐
ferred to as "slave" devices. This release has adopted the "subsidiary"
terminology used in the POSIX.1-2024 and The Open Group Standard Base
Specifications, Issue 8 standards.
HISTORY
Prior to Oracle Solaris 11.4, the user needed to push the ptem and
ldterm modules onto the subsidiary side of the pseudo-terminal subsys‐
tem to get terminal semantics, and the ttcompat module on the sub‐
sidiary side for BSD compatibility ioctl calls, but only if open() was
called from a program not linked for XPG4 or later standards. If called
from a program linked with values-xpg4.o or values-xpg6.o, then open()
would automatically push ptem, ldterm, and ttcompat modules onto the
subsidiary side, and callers pushing them as well would encounter unex‐
pected behavior.
Oracle Solaris 11.4 added these modules to /etc/iu.system.ap so that
they are automatically pushed by autopush(8) regardless of how the pro‐
gram is linked, and ensured that only one copy of each is pushed onto
each stream.
Oracle Solaris 11.4 also added the openpty(3C) to encapsulate most of
this detail behind a portable interface.
Oracle Solaris 11.4 19 Jun 2024 pts(4D)