Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mcopyout(9f) [opensolaris man page]

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

mcopyout - Convert an M_IOCTL or M_IOCDATA message to an M_COPYOUT SYNOPSIS
#include <sys/stream.h> #include <sys/strsun.h> void mcopyout(mblk_t *mp, void *private, size_t size, void *useraddr, mblk_t *dp); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
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. DESCRIPTION
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. RETURN VALUES
This function can be called from user, kernel or interrupt context. SEE ALSO
mcopyin(9F), copyreq(9S), iocblk(9S) STREAMS Programming Guide SunOS 5.11 9 June 2004 mcopyout(9F)

Check Out this Related Man Page

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

rmvb - remove a message block from a message SYNOPSIS
#include <sys/stream.h> mblk_t *rmvb(mblk_t *mp, mblk_t *bp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
mp Message from which a block is to be removed. mblk_t is an instance of the msgb(9S) structure. bp Message block to be removed. DESCRIPTION
The rmvb() function removes a message block (bp) from a message (mp), and returns a pointer to the altered message. The message block is not freed, merely removed from the message. It is the module or driver's responsibility to free the message block. RETURN VALUES
If successful, a pointer to the message (minus the removed block) is returned. The pointer is NULL if bp was the only block of the message before rmvb() was called. If the designated message block (bp) does not exist, -1 is returned. CONTEXT
The rmvb() function can be called from user, interrupt, or kernel context. EXAMPLES
This routine removes all zero-length M_DATA message blocks from the given message. For each message block in the message, save the next message block (line 10). If the current message block is of type M_DATA and has no data in its buffer (line 11), then remove it from the message (line 12) and free it (line 13). In either case, continue with the next message block in the message (line 16). 1 void 2 xxclean(mp) 3 mblk_t *mp; 4 { 5 mblk_t *tmp; 6 mblk_t *nmp; 7 8 tmp = mp; 9 while (tmp) { 10 nmp = tmp->b_cont; 11 if ((tmp->b_datap->db_type == M_DATA) && (tmp->b_rptr == tmp->b_wptr)) { 12 (void) rmvb(mp, tmp); 13 freeb(tmp); 14 } 15 tmp = nmp; 16 } 17 } SEE ALSO
freeb(9F), msgb(9S) Writing Device Drivers STREAMS Programming Guide SunOS 5.11 16 Jan 2006 rmvb(9F)
Man Page

Featured Tech Videos