STREAMS Programming Guide

M_COPYIN

Generated by a module or driver and sent upstream to request that the Stream head perform a copyin(9F) on behalf of the module or driver. It is valid only after receiving an M_IOCTL message and before an M_IOCACK or M_IOCNAK.

The message format is one M_COPYIN message block containing a copyreq(9S) structure, defined in <sys/stream.h>.

struct copyreq {
 	int			cq_cmd;					/* ioctl cmd (fr ioc_cmd) */
 	cred_t			*cq_cr;					/* full credentials */
 	uint			cq_id;					/* ioctl id (from ioc_id) */
 	caddr_t cq_addr;								/* addr to copy data */
 	uint			cq_size;					/* # bytes to copy */
 	int			cq_flag;					/* reserved */
 	mblk_t			*cq_private;					/* private state info */
};

The first four members of the structure correspond to those of the iocblk(9S) structure in the M_IOCTL message that allows the same message block to be reused for both structures. The Stream head will guarantee that the message block allocated for the M_IOCTL message is large enough to contain a copyreq(9S). The cq_addr field contains the user space address from which the data is to be copied. The cq_size field is the number of bytes to copy from user space. The cq_flag field is reserved for future use and should be set to zero.

The cq_private field can be used by a module to point to a message block containing the module's state information relating to this ioctl(2). The Stream head copies (without processing) the contents of this field to the M_IOCDATA response message so that the module can resume the associated state. If an M_COPYIN or M_COPYOUT message is freed, STREAMS does not free any message block pointed to by cq_private. This is the module's responsibility.

This message should not be queued by a module or driver unless it intends to process the data for the ioctl(2).