Index Index for
Section 7
Index Alphabetical
listing for P
Bottom of page Bottom of
page

pty(7)

NAME

pty - Pseudo terminal driver

SYNOPSIS

pseudo-device pty [count] options RPTY

DESCRIPTION

The pty driver provides support for a device-pair termed a pseudo terminal. A pseudo terminal is a pair of character devices, a master device and a slave device. The slave device provides an interface identical to that described in the tty(7) reference page. However, whereas all other devices which provide the interface described in the tty(7) reference page have a hardware device behind them, the slave device has, instead, another process manipulating it through the master half of the pseudo terminal. That is, anything written on the master device is given to the slave device as input and anything written on the slave device is presented as input on the master device. The Tru64 UNIX operating system supports a STREAMS-based and clist-based implementation of the pty subsystem. The default configuration uses STREAMS-based ptys. STREAMS-based ptys use the options RPTY line in the kernel configuration file, while clist-based ptys use the pseudo-device, pty. By default, 32 pseudo-terminal special device files are created. Note that you cannot have both types of ptys configured at the same time. To enhance compatibility, STREAMS-based ptys offers two master pseudo terminal drivers, the BSD compatible master and the System V compatible master. The BSD master is a non-STREAMS device which interfaces to the STREAMS-based slave pty. The System V master is a STREAMS-based device that also interfaces to the STREAMS-based slave pty. The BSD master is opened through the cloning device, /dev/ptmx_bsd, and through the master pty special files, /dev/ptyXX. The System V master is opened only through the cloning device /dev/ptmx. Currently the BSD master cloning device is used by the libc routine openpty(3). You should allocate ptys by using the openpty(3) function, which hides the pty name space that will change in the next major operating system release. Increasing the Number of Pseudo Terminals The operating system can make only 3162 STREAMS-based ptys, but can support up to 8192. To create additional ptys, do the following: 1. Increase the value of the nptys attribute for the pts subsystem by using either the dxkerneltuner application or the sysconfig-r*O command. The value you choose should be the maximum number of ptys that you want active on your system. See sys_attrs_pts(5) for more information. 2. Increase the value of the following attributes for the proc subsystem as follows: · maxusers -- 4096 · max-thread -- 3*maxusers · max-task -- 3*maxusers · max-proc-per-user -- 3*maxusers Use either the dxkerneltuner application or sysconfig -r command to make these changes. 3. Create and run (as root) the following script, make_ptys: #!/bin/sh # # This script creates additional System V slave ptys in /dev/pts. # It assumes that all devices < 3161 have been created # as part of the BSD/tty device creation. # If these devices do NOT exist, modify the # 'start' variable to the first device you want to # create. # start=3162 stop=8191 major=6 cd /dev/pts i=$start while : do mknod $i c $major $i chmod 666 $i [ $i = $stop ] && { echo "done" break } i=`expr $i + 1` done exit 0 To access the additional ptys, you must use the openpty(3) function or open the System V master cloning device, /dev/ptmx. Pseudo Terminal ioctl Calls The following ioctl calls apply only to pseudo terminals: ISPTM Returns the dev_t of the master file descriptor. ISPTM is valid only on the master half of the pseudo terminal, and takes no arguments. TIOCSTOP Stops output to a terminal (for example, like entering [Ctrl-S]). Takes no parameter. TIOCSTART Restarts output (stopped by TIOCSTOP or by typing [Ctrl-S]). Takes no parameter. TIOCPKT Enable or disable packet mode. Packet mode is enabled by specifying (by reference) a nonzero parameter and disabled by specifying (by reference) a zero parameter. When applied to the master side of a pseudo terminal, each subsequent read() from the terminal will return data written on the slave part of the pseudo terminal preceded by a zero byte (symbolically defined as TIOCPKT_DATA), or a single byte reflecting control status information. In the latter case, the byte is an inclusive-OR of zero or more of the bits: TIOCPKT_FLUSHREAD Whenever the read queue for the terminal is flushed. TIOCPKT_FLUSHWRITE Whenever the write queue for the terminal is flushed. TIOCPKT_STOP Whenever output to the terminal is stopped by [Ctrl-S]. TIOCPKT_START Whenever output to the terminal is restarted. TIOCPKT_DOSTOP Whenever t_stopc is [Ctrl-S] and t_startc is [Ctrl-Q]. TIOCPKT_NOSTOP Whenever the start and stop characters are not [Ctrl-S] and [Ctrl- Q]. While this mode is in use, the presence of control status information to be read from the master side may be detected by a select() for exceptional conditions. This mode is used by the rlogin and rlogind commands to implement a remote-echoed, locally [Ctrl-S/Ctrl-Q] flow-controlled remote login with proper back-flushing of output; it can be used by other similar programs. TIOCUCNTL Enable or disable a mode that allows a small number of simple user ioctl commands to be passed through the pseudo-terminal, using a protocol similar to that of TIOCPKT. The TIOCUCNTL and TIOCPKT modes are mutually exclusive. This mode is enabled from the master side of a pseudo terminal by specifying (by reference) a nonzero parameter and disabled by specifying (by reference) a zero parameter. Each subsequent read() from the master side will return data written on the slave part of the pseudo terminal preceded by a zero byte, or a single byte reflecting a user control operation on the slave side. A user control command consists of a special ioctl operation with no data; the command is given as UIOCCMD(n), where n is a number in the range 1-255. The operation value n will be received as a single byte on the next read() from the master side. The ioctl UIOCCMD(0) is a no-op that may be used to probe for the existence of this facility. As with TIOCPKT mode, command operations may be detected with a select() for exceptional conditions. TIOCREMOTE A mode for the master half of a pseudo terminal, independent of TIOCPKT. This mode causes input to the pseudo terminal to be flow controlled and not input edited (regardless of the terminal mode). Each write to the control terminal produces a record boundary for the process reading the terminal. In normal usage, a write of data is like the data typed as a line on the terminal; a write of 0 (zero) bytes is like typing an End-of-File character. The TIOCREMOTE mode can be used when doing remote line editing in a window manager, or whenever flow controlled input is required. UNLKPT Allows the open of the corresponding slave to succeed when using the System V master. If UNLKPT is not used in conjunction with the System V master the open of the corresponding slave will fail with EPERM. This ioctl takes no arguments.

FILES

/dev/pty[a-c, e-z, A-Z][0-9a-zA-Z] Master pseudo terminals /dev/tty[a-c, e-z, A-Z][0-9a-zA-Z] Slave pseudo terminals /dev/ptmx System V master cloning device /dev/ptmx_bsd BSD master cloning device /dev/pts/[0-9999] SVR4 slave pseudo terminal

SEE ALSO

openpty(3) System Administration

Index Index for
Section 7
Index Alphabetical
listing for P
Top of page Top of
page