Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mblktail(9f) [sunos man page]

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

NAME
MBLKHEAD, MBLKIN, MBLKL, MBLKSIZE, MBLKTAIL - Message block utility macros SYNOPSIS
#include <sys/stream.h> #include <sys/strsun.h> int MBLKHEAD(mblk_t *mp); int MBLKTAIL(mblk_t *mp); int MBLKSIZE(mblk_t *mp); int MBLKL(mblk_t *mp); int MBLKIN(mblk_t *mp, int offset, int len); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
mp Message to be examined. offset Offset from mp->b_rptr from which to start examining. len Number of bytes to examine. DESCRIPTION
The MBLKHEAD() macro calculates the number of bytes between the first byte and the first unread byte of the message block, that is: mp->b_rptr - mp->b_datap->db_base. The MBLKTAIL() macro calculates the number of bytes between the first unwritten byte and the last byte of the message block, that is: mp->b_datap->db_lim - mp->b_wptr. The MBLKSIZE() macros calculates the total size of the message block, that is: mp->b_datap->db_lim - mp->b_datap->db_base. The MBLKL() macro calculates the length of the message block, that is: mp->b_wptr - mp->b_rptr. The MBLKIN() macro checks whether the byte range specified by offset and len resides entirely within the message block. RETURN VALUES
The MBLKHEAD(), MBLKTAIL(), MBLKL() and MBLKSIZE() functions all return the appropriate byte count, as specified above. MBLKIN() returns non-zero if the check succeeds, or zero if it fails. CONTEXT
These functions can be called from user, kernel or interrupt context. NOTES
These macros may evaluate any of their arguments more than once. This precludes passing arguments with side effects. These macros assume the message itself is well formed, that is: mp->b_datap->db_base <= mp->b_rptr <= mp->b_wptr <= mp->b_datap->db_lim. SEE ALSO
msgb(9S) STREAMS Programming Guide SunOS 5.10 9 June 2004 MBLKHEAD(9F)

Check Out this Related Man Page

msgb(4) 						     Kernel Interfaces Manual							   msgb(4)

NAME
msgb - Defines a STREAMS message block SYNOPSIS
#include <sys/stream.h> struct msgb { struct msgb *b_next; struct msgb *b_prev; struct msgb *b_cont; unsigned char *b_rptr; unsigned char *b_wptr; struct datab *b_datap; MSG_KERNEL_FIELDS }; PARAMETERS
b_next A pointer to the next message on the queue. b_prev A pointer to the previous message on the queue. b_cont A pointer to the next message block in the message. b_rptr A pointer to the first unread data byte in the buffer. b_wptr A pointer to the first unwritten data byte in the buffer. b_datap A pointer to the datab structure (data block) that contains the data for the message. MSG_KERNEL_FIELDS Additional fields that are visible within the kernel. The fields included and their contents depend on the kernel configuration. DESCRIPTION
The msgb structure defines a message block. A message block carries data or information in a stream. A STREAMS message consists of mes- sage blocks linked through b_cont. Each message block points to a data block descriptor, which in turn points to a data buffer. The msgb structure is typedefed as mblk_t. The associated data block is stored in a datab structure, which is typedefed as dblk_t. The datab structure is defined (in sys/stream.h) as: struct datab { struct datab * db_freep; unsigned char * db_base; unsigned char * db_lim; unsigned char db_ref; unsigned char db_type; unsigned char db_class; unsigned char db_pad[1]; }; The datab fields are defined as follows: db_freep Used internally by the STREAMS memory allocator. db_base The first byte of the buffer. db_lim The last byte of the buffer, plus one. db_ref The number of message blocks ( struct msgb) that reference this data block. db_type The message type. db_class Used internally. db_pade Padding. Messages are typed according to the value in the db_type field in the associated datab structure. Some possible type values are: M_DATA The message contains ordinary data. M_PROTO The message contains internal control information and data. As part of its support for STREAMS, Tru64 UNIX provides the following interfaces for exchanging messages betweens STREAMS modules on the one hand and sockets and network protocols on the other: mbuf_to_mblk() - Converts an mbuf chain to an mblk chain mblk_to_mbuf() - Converts an mblk chain to an mbuf chain delim off msgb(4)
Man Page