Technical data

SunOS 5.5 STREAMS Modules bufmod(7M)
value reflects any padding necessary to insure correct data alignment for the host
machine and includes the length of the header itself. sbh_drops reports the cumulative
number of input messages that this instance of bufmod has dropped due to flow control
or resource exhaustion. In the current implementation message dropping due to flow
control can occur only if the SB_NO_DROPS flag is not set. (Note: this accounts only for
events occurring within bufmod, and does not count messages dropped by downstream
or by upstream modules.) The sbh_timestamp field contains the message arrival time
expressed as a struct timeval.
After preparing a message, bufmod attempts to add it to the end of the current chunk,
using the chunk size and timeout values to govern the addition. The chunk size and
timeout values are set and inspected using the ioctl() calls described below. If adding the
new message would make the current chunk grow larger than the chunk size, bufmod
closes off the current chunk, passing it up to the next module in line, and starts a new
chunk. If adding the message would still make the new chunk overflow, the module
passes it upward in an over-size chunk of its own. Otherwise, the module concatenates
the message to the end of the current chunk.
To ensure that messages do not languishforever in an accumulating chunk,bufmod
maintains a read timeout. Whenever this timeout expires, the module closes off the
current chunk and passes it upward. The module restarts the timeout period when it
receives a read side data message and a timeout is not currently active. These two rules
insure that bufmod minimizes the number of chunks it produces during periods of
intense message activity and that it periodically disposes of all messages during slack
intervals, but avoids any timeout overhead when there is no activity.
bufmod handles other message types as follows. Upon receiving an M_FLUSH message
specifying that the read queue be flushed, the module clears the currently accumulating
chunk and passes the message on to the module or driver above. (Note: bufmod uses
zero lengthM_CTL messages for internal synchronization and does not pass them
through.) bufmod passes all other messages through unaltered to its upper neighbor,
maintaining message order for non high priority messages by passing up any accumu-
lated chunk first.
If the SB_DEFER_CHUNK flag is set, buffering does not begin until the second message is
received within the timeout window.
If the SB_SEND_ON_WRITE flag is set, bufmod passes up the read side any buffered data
when a message is received on the write side. SB_SEND_ON_WRITE and
SB_DEFER_CHUNK are often used together.
Write-side Behavior bufmod interceptsM_IOCTL messages for the ioctls described below. The module
passes all other messages through unaltered to its lower neighbor. If
SB_SEND_ON_WRITE is set, message arrival on the writer side suffices to close and
transmit the current read side chunk.
IOCTLS bufmod responds to the following ioctls.
SBIOCSTIME Set the read timeout value to the value referred to by the struct
timeval pointer given as argument. Setting the timeout value to zero
modified 27 Jul 1992 7M-49