Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mexchange(9f) [sunos 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.10 9 June 2004 mexchange(9F)

Check Out this Related Man Page

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

NAME
merror - Send an M_ERROR message upstream SYNOPSIS
#include <sys/stream.h> #include <sys/strsun.h> void merror(queue_t *wq, mblk_t *mp, int error); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
wq Write queue associated with the read queue to send the M_ERROR on. mp Optionally, a STREAMS message to convert to an M_ERROR. error Error code to include in the M_ERROR message. DESCRIPTION
The merror() function constructs an M_ERROR message, and sends the resulting message upstream. If mp is NULL, merror() allocates a one-byte M_ERROR message. If mp is non-NULL, merror() attempts to convert the passed-in message to an M_ERROR. However, if the passed-in message has more than one reference (see dupmsg(9F)), or if it is of zero length, it is freed and a new message is allocated. If the allocation or conversion fails, merror() silently fails. Otherwise, the resulting one-byte data block is assigned the specified error code and sent upstream. RETURN VALUES
None. CONTEXT
This function can be called from user, kernel or interrupt context. NOTES
Callers must not hold any locks across an merror() that can be acquired as part of put(9E) processing. SEE ALSO
put(9E), dupmsg(9F) STREAMS Programming Guide SunOS 5.11 9 June 2004 merror(9F)
Man Page