|
|
Packetizing is performed by prefixing a message with an M_PROTO(D7str) message. The original message type is stored in the 4 byte data portion of the M_PROTO message.
On the read-side, only the M_PROTO, M_PCPROTO(D7str), M_STOP(D7str), M_STOPI(D7str), M_STARTI(D7str), M_IOCTL(D7str), M_DATA(D7str), M_FLUSH(D7str), and M_READ(D7str) messages are packetized. All other message types are passed upstream unmodified.
Since all unread state information is held in the master's stream head read queue, flushing of this queue is disabled.
On the write-side, all messages are sent down unmodified.
With this module in place, all reads from the master side of the pseudo terminal should be performed with the getmsg(2) or getpmsg system call. The control part of the message contains the message type. The data part contains the actual data associated with that message type. The onus is on the application to separate the data into its component parts.