STREAMS-UX Programmer's Guide (February 2007)

Message Types
High Priority Messages
Appendix C
249
M_IOCNAK
This message is generated by a module and sent back to the stream as a negative acknowledgment of an
M_IOCTL message. The M_IOCNAK message format is one M_IOCNAK block (containing iocblk structure, see
M_IOCTL). The ioc_error field in iocblk structure can be used to communicate any processing errors, back
to the user in errno. Unlike the M_IOCACK message, no user data or return values can be sent with the
M_IOCNAK message. If any user data is linked as M_DATA blocks to the M_IOCNAK message, the stream head
will ignore and free them. When the stream head receives an M_IOCNAK message, any outstanding IOCTL
request will fail.
M_IOCDATA
This message is generated and sent downstream by the stream head in response to an M_COPYIN or
M_COPYOUT message. The M_IOCDATA message is one message block of type M_IOCDATA, linked to zero or more
M_DATA blocks. The data buffer of M_IOCDATA contains a copyresp structure defined as follows:
int cp_cmd; /* command type == ioc_cmd */
cred_t * cp_cr; /* pointer to full credentials */
uint cp_id; /* ioctl id == ioc_id */
uint cp_flag; /* flag values */
mblk_t * cp_private; /* module’s private state info */
ioc_pad cp_rv; /* 0 = success */
The first three fields of the copyresp structure correspond to those of the iocblk structure in the M_IOCTL
message. This allows the same message block to be reused for all related transparent messages. The cp_rv
field contains the result of the request at the stream head. Zero indicates success and non-zero indicates
failure. If failure is indicated, the module must not generate an M_IOCNAK message. It must abort all IOCTL
processing, clean up its data structures, and return. The cp_private field is copied from the cq_private field
in the associated M_COPYIN/M_COPYOUT message. It is included in the M_IOCDATA message so the can be
self-describing.
If the message is in response to an M_COPYIN message and success is indicated, the M_IOCDATA block will be
followed by M_DATA blocks containing the copied data.
If an M_IOCDATA block is reused, any unused fields defined for the resultant message block should be cleared,
especially for M_IOCACK and M_IOCNAK messages.
NOTE This message must not be queued by a module or driver unless it intends to process the data for
the IOCTL in some way.
M_PCPROTO
This message type is similar to its non-priority counterpart M_PROTO and the following additional attributes:
When an M_PCPROTO message is placed on a queue, its service procedure is always enabled.
The stream head will allow only one M_PCPROTO message to be placed in its read queue at a time.
•If an M_PCPROTO message is already present on the stream head read queue, subsequent M_PCPROTO
messages will be discarded and freed.
With M_PCPROTO, data and control information can be sent without any flow-control constraints. The
getmsg() and putmsg() system calls refer to M_PCPROTO messages as high priority messages.