Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mexchange(9f) [opensolaris man page]

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

NAME
mexchange - Exchange one message for another SYNOPSIS
#include <sys/stream.h> #include <sys/strsun.h> mblk_t *mexchange(queue_t *wq, mblk_t *mp, size_t size, uchar_t type, int32_t primtype); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
wq Optionally, write queue associated with the read queue to be used on failure (see below). mp Optionally, the message to exchange. size Size of the returned message. type Type of the returned message. primtype Optionally, a 4 byte value to store at the beginning of the returned message. DESCRIPTION
The mexchange() function exchanges the passed in message for another message of the specified size and type. If mp is not NULL, is of at least size bytes, and has only one reference (see dupmsg(9F)), mp is converted to be of the specified size and type. Otherwise, a new message of the specified size and type is allocated. If allocation fails, and wq is not NULL, merror(9F) attempts to send an error to the stream head. Finally, if primtype is not -1 and size is at least 4 bytes, the first 4 bytes are assigned to be primtype. This is chiefly useful for STREAMS-based protocols such as DLPI and TPI which store the protocol message type in the first 4 bytes of each message. RETURN VALUES
A pointer to the requested message is returned on success. NULL is returned on failure. CONTEXT
This function can be called from user, kernel or interrupt context. SEE ALSO
dupmsg(9F), merror(9F) STREAMS Programming Guide SunOS 5.11 9 June 2004 mexchange(9F)

Check Out this Related Man Page

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

NAME
dupmsg - duplicate a message SYNOPSIS
#include <sys/stream.h> mblk_t *dupmsg(mblk_t *mp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
mp Pointer to the message. DESCRIPTION
dupmsg() forms a new message by copying the message block descriptors pointed to by mp and linking them. dupb(9F) is called for each mes- sage block. The data blocks themselves are not duplicated. RETURN VALUES
If successful, dupmsg() returns a pointer to the new message block. Otherwise, it returns a NULL pointer. A return value of NULL indi- cates either memory depletion or the data block reference count, db_ref (see datab(9S)), has reached a limit(255). See dupb(9F). CONTEXT
dupmsg() can be called from user, kernel, or interrupt context. EXAMPLES
Example 1 Using dupmsg() See copyb(9F) for an example using dupmsg(). SEE ALSO
copyb(9F), copymsg(9F), dupb(9F), datab(9S) Writing Device Drivers STREAMS Programming Guide SunOS 5.11 11 Apr 1991 dupmsg(9F)
Man Page