The value of read options (so_readopt) specifies two sets of three modes that can be set by the I_SRDOPT ioctl(2) (see streamio(7I)).
Byte-stream mode approximately models pipe data transfer. Message nondiscard mode is similar to a TTY in canonical mode.
Table 3-1 Read Option Modes
RMODEMASK |
|
|
RNORM |
RMSGN |
RMSGN |
RPROTMASK |
|
|
RPROTNORM |
RPROTDIS |
RPROTDATA |
The first set of bits, RMODEMASK, deals with data and message boundaries, as shown in Table 3-1.
The read(2) call finishes when the byte count is satisfied, the stream head read queue becomes empty, or a zero length message is encountered. A zero-length message is put back in the queue. A subsequent read returns 0 bytes.
The read(2) call finishes when the byte count is satisfied or a message boundary is found, whichever comes first. Any data remaining in the message is put back on the stream head read queue.
The read(2) call finishes when the byte count is satisfied or a message boundary is found. Any data remaining in the message is discarded up to the message boundary.
The second set of bits, RPROTMASK, specifies the treatment of protocol messages by the read(2) system call:
The read(2) call fails with EBADMSG if an M_PROTO or M_PCPROTO message is at the front of the stream head read queue. This is the default operation protocol.
The read(2) call discards any M_PROTO or M_PCPROTO blocks in a message, delivering the M_DATA blocks to the user.
The read(2) call converts the M_PROTO and M_PCPROTO message blocks to M_DATA blocks, treating the entire message as data.