1PTY(4)                     Kernel Interfaces Manual                     PTY(4)
2
3
4

NAME

6       pty - pseudo terminal driver
7

SYNOPSIS

9       /sys/conf/SYSTEM:
10            NPTY ptys # pseudo-terminals, in groups of 8
11

DESCRIPTION

13       The  pty driver provides support for a device-pair termed a pseudo ter‐
14       minal.  A pseudo terminal is a pair  of  character  devices,  a  master
15       device  and  a  slave  device.   The slave device provides processes an
16       interface identical to that described in tty(4).  However, whereas  all
17       other  devices  which  provide the interface described in tty(4) have a
18       hardware device of  some  sort  behind  them,  the  slave  device  has,
19       instead, another process manipulating it through the master half of the
20       pseudo terminal.  That is, anything written on  the  master  device  is
21       given  to  the  slave device as input and anything written on the slave
22       device is presented as input on the master device.
23
24       In configuring, ptys specifies the number of pseudo terminal pairs  are
25       configured.
26
27       The following ioctl calls apply only to pseudo terminals:
28
29       TIOCSTOP
30              Stops  output  to  a  terminal  (e.g. like typing ^S).  Takes no
31              parameter.
32
33       TIOCSTART
34              Restarts output (stopped by TIOCSTOP or by typing ^S).  Takes no
35              parameter.
36
37       TIOCPKT
38              Enable/disable  packet mode.  Packet mode is enabled by specify‐
39              ing (by reference) a nonzero parameter and disabled by  specify‐
40              ing (by reference) a zero parameter.  When applied to the master
41              side of a pseudo terminal, each subsequent read from the  termi‐
42              nal  will  return  data  written on the slave part of the pseudo
43              terminal preceded  by  a  zero  byte  (symbolically  defined  as
44              TIOCPKT_DATA), or a single byte reflecting control status infor‐
45              mation.  In the latter case, the byte is an inclusive-or of zero
46              or more of the bits:
47
48              TIOCPKT_FLUSHREAD
49                     whenever the read queue for the terminal is flushed.
50
51              TIOCPKT_FLUSHWRITE
52                     whenever the write queue for the terminal is flushed.
53
54              TIOCPKT_STOP
55                     whenever output to the terminal is stopped a la ^S.
56
57              TIOCPKT_START
58                     whenever output to the terminal is restarted.
59
60              TIOCPKT_DOSTOP
61                     whenever t_stopc is ^S and t_startc is ^Q.
62
63              TIOCPKT_NOSTOP
64                     whenever the start and stop characters are not ^S/^Q.
65
66              While this mode is in use, the presence of control status infor‐
67              mation to be read from the master side  may  be  detected  by  a
68              select for exceptional conditions.
69
70              This  mode  is used by rlogin(1C) and rlogind(8C) to implement a
71              remote-echoed, locally ^S/^Q flow-controlled remote  login  with
72              proper  back-flushing of output; it can be used by other similar
73              programs.
74
75       TIOCUCNTL
76              Enable/disable a mode that allows a small number of simple  user
77              ioctl commands to be passed through the pseudo-terminal, using a
78              protocol similar to that of TIOCPKT.  The TIOCUCNTL and  TIOCPKT
79              modes  are  mutually  exclusive.   This mode is enabled from the
80              master side of a pseudo terminal by specifying (by reference)  a
81              nonzero  parameter  and  disabled by specifying (by reference) a
82              zero parameter.  Each subsequent read from the master side  will
83              return  data  written  on  the slave part of the pseudo terminal
84              preceded by a zero byte, or a single byte reflecting a user con‐
85              trol  operation  on the slave side.  A user control command con‐
86              sists of a special ioctl operation with no data; the command  is
87              given  as  UIOCCMD(n),  where  n is a number in the range 1-255.
88              The operation value n will be received as a single byte  on  the
89              next read from the master side.  The ioctl UIOCCMD(0) is a no-op
90              that may be used to probe for the existence  of  this  facility.
91              As  with TIOCPKT mode, command operations may be detected with a
92              select for exceptional conditions.
93
94       TIOCREMOTE
95              A mode for the master half of a pseudo terminal, independent  of
96              TIOCPKT.   This  mode  causes input to the pseudo terminal to be
97              flow controlled and not input edited (regardless of the terminal
98              mode).   Each  write  to  the control terminal produces a record
99              boundary for the process reading the terminal.  In normal usage,
100              a  write  of data is like the data typed as a line on the termi‐
101              nal; a write of 0 bytes is like typing an end-of-file character.
102              TIOCREMOTE  can be used when doing remote line editing in a win‐
103              dow manager, or whenever flow controlled input is required.
104

FILES

106       /dev/pty[p-r][0-9a-f]    master pseudo terminals
107       /dev/tty[p-r][0-9a-f]    slave pseudo terminals
108

DIAGNOSTICS

110       None.
111
112
113
1144.2 Berkeley Distribution        May 19, 1986                           PTY(4)
Impressum