m_getclr Kernel Service

Purpose

Allocates and zeroes a memory buffer from the mbuf pool.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/mbuf.h>

struct mbuf *m_getclr ( wait,  type)
int wait;
int type;

Parameters

Item Description
wait This flag indicates the action to be taken if there are no free mbuf structures. Possible values are:
M_DONTWAIT
Called from either an interrupt or process environment.
M_WAIT
Called from a process environment only.
type Specifies a valid mbuf type, as listed in the /usr/include/sys/mbuf.h file.

Description

The m_getclr kernel service allocates an mbuf structure of the specified type. If the buffer pool is empty and the wait parameter is set to M_WAIT value, the m_getclr service does not return until an mbuf structure is available.

The m_getclr kernel service differs from the m_get kernel service in that the m_getclr service zeroes the data portion of the allocated mbuf structure.

Execution Environment

The m_getclr kernel service can be called from either the process or interrupt environment. Interrupt handlers can call the m_getclr service only with the wait parameter set to the M_DONTWAIT value.

Return Values

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