|
|
The STREAMS-based pseudo-terminal subsystem also supports a feature called packet mode. This is used to inform the process on the master-side when ``state'' changes have occurred in the pseudo-tty. Packet mode is enabled by pushing the pckt module on the master-side. Data written on the master-side is processed normally. When data is written on the slave-side or when other messages are encountered by the pckt module, a header is added to the message so it can be retrieved later by the master-side with a getmsg operation.
The pckt module does the following:
M_DATA, M_IOCTL, M_PROTO/M_PCPROTO, M_FLUSH, M_START/M_STOP, M_STARTI/M_STOPI, and M_READ.
All other messages are passed through. The M_PROTO message is passed upstream and retrieved when the user issues getmsg(S).
If the flag is FLUSHW, it is changed to FLUSHR (because FLUSHR was the original flag before the pts driver changed it), packetized into an M_PROTO message, and passed upstream. To prevent the Stream head's read queue from being flushed, the original M_FLUSH message must not be passed upstream.
If the flag is FLUSHR, it is changed to FLUSHW, packetized into an M_PROTO message, and passed upstream. To flush the write queues properly, an M_FLUSH message with the FLUSHW flag set is also sent upstream.
If the flag is FLUSHRW, the message with both flags set is packetized and passed upstream. An M_FLUSH message with the FLUSHW flag set is also sent upstream.