Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pty(7) — Motorola System V 88k Release 4 Version 4.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rlogin(1)

grantpt(3C)

ptsname(3C)

unlockpt(3C)

ldterm(7)

pckt(7)

ptem(7)

termio(7)

ttcompat(7)

pty(7)  —  SPECIAL FILES AND DEVICES

NAME

pty − pseudo-terminal driver

SYNOPSIS

cc [flags] files -lsocket -lnsl
#include <fcntl.h>
#include <sys/stropts.h>
#include <sys/termios.h>
 char ∗slavename;/∗ name of slave pseudo-tty ∗/
 grantpt(master);       /∗ change perms of slave ∗/
unlockpt(master);      /∗ unlock slave ∗/
slavename = ptsname(master);/∗ get name of slave ∗/
if ((slave = open(slavename, O_RDWR)) < 0) {
perror(slavename);
exit(-1);
}
ioctl(slave, I_PUSH, "ptem");/∗ pty hware emul module ∗/
ioctl(slave, I_PUSH, "ldterm");/∗ line discipline module ∗/
ioctl(slave, I_PUSH, "ttcompat");/∗ BSD/XENIX compat module ∗/
 

DESCRIPTION

The pty driver provides support for a pair of devices collectively known as a pseudo-terminal.  The two devices comprising a pseudo-terminal are known as a master and a slave.  The slave device distinguishes between the B0 baud rate and other baud rates specified in the c_flag word of the termios structure, and the CLOCAL flag in that word.  It does not support any of the other termio(7) device control functions specified by flags in the c_flag word of the termios structure and by the IGNBRK, IGNPAR, PARMRK, or INPCK flags in the c_iflag word of the termios structure, as these functions apply only to asynchronous serial ports.  All other termio(7) functions must be performed by STREAMS modules pushed atop the driver; when a slave device is opened, the ldterm(7) and ttcompat(7) STREAMS modules are automatically pushed on top of the stream, providing the standard termio(7) interface. 

Instead of having a hardware interface and associated hardware that supports the terminal functions, the functions are implemented by another process manipulating the master device of the pseudo-terminal. 

The master and slave devices of the pseudo-terminal are tightly connected.  Any data written on the master device is given to the slave device as input, as though it had been received from a hardware interface.  Any data written on the slave terminal can be read from the master device (rather than being transmitted from a UART). 

In configuring, the default count is given in the system(4) file with the lines:

INCLUDE:PTM(256)
INCLUDE:PTS
INCLUDE:PTEM(256)

which means that 256 pseudo-terminal pairs are configured. The maximum allowed during installation of the Networking Support Utilities (nsu) package is 1024 pseudo-terminal pairs.  For the M88000 architecture, the pty driver supports pseudo-terminal access via the 88/Open Binary Compatability Standard (BCS).  BCS pseudo-terminals are configured with INCLUDE:BCSPTS in the system(4) file.  The number of BCS pseudo-terminals configured is the same as the number indicated by the PTM entry.  If more than 256 pairs are given, BCS pseudo-terminal pairs will be limited to 256 pairs. 

ioctls

The standard set of termio ioctl commands are supported by the slave device.  None of the bits in the c_cflag word have any effect on the pseudo-terminal, except that if the baud rate is set to B0, it appears to the process on the master device as if the last process on the slave device had closed the line; thus, setting the baud rate to B0 has the effect of “hanging up” the pseudo-terminal, just as it has the effect of hanging up a real terminal. 

There is no notion of parity on a pseudo-terminal, so none of the flags in the c_iflag word that control the processing of parity errors have any effect.  Similarly, there is no notion of a “break,” so none of the flags that control the processing of breaks and none of the ioctls that generate breaks have any effect. 

Input flow control is automatically performed; a process that attempts to write to the master device is blocked if too much unconsumed data is buffered on the slave device.  The input flow control provided by the IXOFF flag in the c_iflag word is not supported. 

The delays specified in the c_oflag word are not supported. 

Because pseudo-terminals cannot use modems, the ioctls that return or alter the state of modem control lines are silently ignored. 

A few special ioctls are provided on the master devices of pseudo-terminals to provide functionality needed by application programs to emulate real hardware interfaces:

ISPTM
A successful return identifies the device as a pseudo-terminal.

UNLKPT
Changes the internal state of the corresponding slave pseudo-terminal so that it can be opened.

The ioctls TIOCGWINSZ and TIOCSWINSZ can be performed on the master device of a pseudo-terminal; they have the same effect as when performed on the slave device. 

FILES

/dev/ptmx  pseudo-terminal master clone device
/dev/pts[0-1023]  pseudo-terminal slave devices
/dev/pty[p-za-l][0-9a-f]  BCS pseudo-terminal master devices
/dev/tty[p-za-l][0-9a-f]  BCS pseudo-terminal slave devices

SEE ALSO

rlogin(1), grantpt(3C), ptsname(3C), unlockpt(3C), ldterm(7), pckt(7), ptem(7), termio(7), ttcompat(7). 
 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026