I_SRDOPT streamio Operation

Purpose

Sets the read mode.

Description

The I_SRDOPT operation sets the read mode using the value of the arg parameter. Legal values for the arg parameter are:

Value Description
RNORM Byte-stream mode. This is the default mode.
RMSGD Message-discard mode.
RMSGN Message-nondiscard mode.
RFILL Read mode. This mode prevents completion of any read request until one of three conditions occurs:
  • The entire user buffer is filled.
  • An end of file occurs.
  • The stream head receives an M_MI_READ_END message.

Several control messages support the RFILL mode. They are used by modules to manipulate data being placed in user buffers at the stream head. These messages are multiplexed under a single M_MI message type. The message subtype, pointed to by the b_rptr parameter, is one of the following:

M_MI_READ_SEEK
Provides random access data retrieval. An application and a cooperating module can gather large data blocks from a slow, high-latency, or unreliable link, while minimizing the number of system calls required, and relieving the protocol modules of large buffering requirements.

The M_MI_READ_SEEK message subtype is followed by two long words, as in a standard seek call. The first word is an origin indicator as follows:

0
Start of buffer
1
Current position
2
End of buffer

The second word is a signed offset from the specified origin.

M_MI_READ_RESET
Discards any data previously delivered to partially satisfy an RFILL mode read request.
M_MI_READ_END
Completes the current RFILL mode read request with whatever data has already been delivered.

In addition, treatment of control messages by the stream head can be changed by setting the following flags in the arg parameter:

Flag Description
RPROTNORM Causes the read routine to be unsuccessful if a control message is at the front of the stream-head read queue.
RPROTDAT Delivers the control portion of a message as data.
RPROTDIS Discards the control portion of a message, delivering any data portion.

This operation is part of STREAMS Kernel Extensions.

Error Codes

If unsuccessful, the errno global variable is set to the following value:

Value Description
EINVAL The value of the arg parameter is not one of the above legal values.