1PTY(4) 386BSD Programmer's Manual PTY(4) 2 3NNAAMMEE 4 ppttyy - pseudo terminal driver 5 6SSYYNNOOPPSSIISS 7 ppttyy ssllaavvee__cchhrr__mmaajjoorr ccoonnttrrooll__cchhrr__mmaajjoorr [_p_t_y_c_o_u_n_t]. 8 9DDEESSCCRRIIPPTTIIOONN 10 The pty driver provides support for a device-pair termed a _p_s_e_u_d_o 11 _t_e_r_m_i_n_a_l. A pseudo terminal is a pair of character devices, a _m_a_s_t_e_r 12 device and a _s_l_a_v_e device. The slave device provides processes an 13 interface identical to that described in tty(4). However, whereas all 14 other devices which provide the interface described in tty(4) have a 15 hardware device of some sort behind them, the slave device has, instead, 16 another process manipulating it through the master half of the pseudo 17 terminal. That is, anything written on the master device is given to the 18 slave device as input and anything written on the slave device is 19 presented as input on the master device. 20 21 If an optional _c_o_u_n_t is given in the device configuration specification, 22 that number of pseudo terminal pairs are configured; the default count is 23 8. 24 25 The following ioctl(2) calls apply only to pseudo terminals: 26 27 TIOCSTOP Stops output to a terminal (e.g. like typing `^S'). Takes no 28 parameter. 29 30 TIOCSTART Restarts output (stopped by TIOCSTOP or by typing `^S'). 31 Takes no parameter. 32 33 TIOCPKT Enable/disable _p_a_c_k_e_t mode. Packet mode is enabled by 34 specifying (by reference) a nonzero parameter and disabled by 35 specifying (by reference) a zero parameter. When applied to 36 the master side of a pseudo terminal, each subsequent read 37 from the terminal will return data written on the slave part 38 of the pseudo terminal preceded by a zero byte (symbolically 39 defined as TIOCPKT_DATA), or a single byte reflecting control 40 status information. In the latter case, the byte is an 41 inclusive-or of zero or more of the bits: 42 43 TIOCPKT_FLUSHREAD whenever the read queue for the terminal 44 is flushed. 45 46 TIOCPKT_FLUSHWRITE whenever the write queue for the terminal 47 is flushed. 48 49 TIOCPKT_STOP whenever output to the terminal is 50 stopped a la `^S'. 51 52 TIOCPKT_START whenever output to the terminal is 53 restarted. 54 55 TIOCPKT_DOSTOP whenever _t__s_t_o_p_c is `^S' and _t__s_t_a_r_t_c is 56 `^Q'. 57 58 TIOCPKT_NOSTOP whenever the start and stop characters 59 are not `^S/^Q'. 60 61 While this mode is in use, the presence 62 of control status information to be read 63 from the master side may be detected by a 64 select(2) for exceptional conditions. 65 66 67 This mode is used by rlogin(1) and 68 rlogind(8) to implement a remote-echoed, 69 locally `^S/^Q' flow-controlled remote 70 login with proper back-flushing of 71 output; it can be used by other similar 72 programs. 73 74 TIOCUCNTL Enable/disable a mode that allows a small number of simple 75 user ioctl commands to be passed through the pseudo-terminal, 76 using a protocol similar to that of TIOCPKT. The TIOCUCNTL 77 and TIOCPKT modes are mutually exclusive. This mode is 78 enabled from the master side of a pseudo terminal by 79 specifying (by reference) a nonzero parameter and disabled by 80 specifying (by reference) a zero parameter. Each subsequent 81 read from the master side will return data written on the 82 slave part of the pseudo terminal preceded by a zero byte, or 83 a single byte reflecting a user control operation on the 84 slave side. A user control command consists of a special 85 ioctl operation with no data; the command is given as 86 UIOCCMD(n), where _n is a number in the range 1-255. The 87 operation value _n will be received as a single byte on the 88 next read from the master side. The ioctl UIOCCMD(0) is a 89 no-op that may be used to probe for the existence of this 90 facility. As with TIOCPKT mode, command operations may be 91 detected with a select for exceptional conditions. 92 93 TIOCREMOTE A mode for the master half of a pseudo terminal, independent 94 of TIOCPKT. This mode causes input to the pseudo terminal to 95 be flow controlled and not input edited (regardless of the 96 terminal mode). Each write to the control terminal produces 97 a record boundary for the process reading the terminal. In 98 normal usage, a write of data is like the data typed as a 99 line on the terminal; a write of 0 bytes is like typing an 100 end-of-file character. TIOCREMOTE can be used when doing 101 remote line editing in a window manager, or whenever flow 102 controlled input is required. 103 104FFIILLEESS 105 /dev/pty[p-r][0-9a-f] master pseudo terminals 106 /dev/tty[p-r][0-9a-f] slave pseudo terminals 107 108DDIIAAGGNNOOSSTTIICCSS 109 None. 110 111HHIISSTTOORRYY 112 The ppttyy driver appeared in 4.2BSD. 113 1144.2 Berkeley Distribution March 28, 1991 2 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133