MCOPYOUT(9F) Kernel Functions for Drivers MCOPYOUT(9F)

mcopyout - Convert an M_IOCTL or M_IOCDATA message to an M_COPYOUT

#include <sys/stream.h>
#include <sys/strsun.h>
void mcopyout(mblk_t *mp, void *private, size_t size, void *useraddr,

mblk_t *dp);

illumos DDI specific (illumos DDI).

mp

M_IOCTL or M_IOCDATA message.

private

Value to set the cq_private field of the copyreq(9S) to.

size

Value to set the cq_size field of the copyreq(9S) to.

useraddr

Optionally, the value to set the cq_addr field of the copyreq(9S) to.

dp

Optionally, the payload to copy out.

The mcopyout() function converts an M_IOCTL or M_IOCDATA message into an M_COPYOUT message using the supplied arguments.

To convert the message, mcopyout() changes the message type to M_COPYOUT, and its payload from a iocblk(9S) to a copyreq(9S). Since the iocblk(9S) and copyreq(9S) are designed to overlay one another, the only fields which must be updated are cq_private, cq_size, and cq_addr, which are set to the supplied values. If useraddr is passed as NULL, the M_IOCTL must be transparent and cq_addr is assigned the pointer-sized quantity found at mp->b_cont->b_rptr.

If dp is not NULL, any trailing message blocks associated with mp are freed, mp->b_cont is reset to dp and dp->b_wptr is set to dp->b_rptr + size. Otherwise, any trailing message blocks are unaffected.

None.

This function can be called from user, kernel or interrupt context.

mcopyin(9F), copyreq(9S), iocblk(9S)

STREAMS Programming Guide

June 9, 2004 OmniOS