m_getclustm Kernel Service

Purpose

Allocates an mbuf structure and attaches a cluster of the specified size, both from the mbuf buffer pool.

Syntax

#include <sys/mbuf.h>
#include <net/net_globals.h>

struct mbuf *
m_getclustm( wait,  type,  size)
int wait;
int type;
int size;

Parameters

Item Description
wait Specifies either the M_DONTWAIT or M_WAIT value.
type Specifies a valid mbuf type from the /usr/include/sys/mbuf.h file.
size Specifies the size of the external cluster to attach. Any value less than MAXALLOCSAVE is valid. For larger values, M_WAIT must be specified.

Description

The m_getclustm service allocates an mbuf structure of the specified type. If successful, the m_getclustm service then attempts to attach a cluster of the indicated size (specified by the size parameter) to the mbuf structure. If the buffer pool is empty and the wait parameter is set to M_WAIT, the m_get service does not return until an mbuf structure is available. Interrupt handlers should call this service only with the wait parameter set to M_DONTWAIT.

Execution Environment

The m_getclustm kernel service can be called from either the process or interrupt environment.

An interrupt handler can specify the wait parameter as M_DONTWAIT only.

Return Values

The m_getclustm kernel service returns the address of an allocated mbuf structure on success. If the wait parameter is set to M_DONTWAIT and there are no free mbuf structures, the m_getclustm kernel service returns null.