m_getclust Macro for mbuf Kernel Services
Purpose
Allocates an mbuf structure from the mbuf buffer pool and attaches a page-sized cluster.
Syntax
Parameters
Item | Description |
---|---|
wait | Indicates the
action to be taken if there are no available mbuf structures.
Possible values are:
|
type | Specifies a valid mbuf type from the /usr/include/sys/mbuf.h file. |
Description
The m_getclust macro allocates an mbuf structure of the specified type. If the allocation succeeds, the m_getclust macro then attempts to attach a page-sized cluster to the structure.
If the buffer pool is empty and the wait parameter is set to M_WAIT, the m_getclust macro does not return until an mbuf structure is available.
Execution Environment
The m_getclust macro can be called from either the process or interrupt environment.
Return Values
The address of an allocated mbuf structure is returned on success. If the wait parameter is set to M_DONTWAIT and there are no free mbuf structures, the m_getclust macro returns a null value.