[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Kernel and Subsystems Technical Reference, Volume 1

m_gethdr Kernel Service

Purpose

Allocates a header memory buffer from the mbuf pool.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/mbuf.h>
struct mbuf *
m_gethdr (wait, type)
int  wait;
int  type;

Parameters

wait Specifies either the M_DONTWAIT or M_WAIT value.
type Specifies the valid mbuf type from the /usr/include/sys/mbuf.h file.

Description

The m_gethdr 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, the m_gethdr kernel service will not return until an mbuf structure is available. Interrupt handlers should call this kernel service only with the wait parameter set to M_DONTWAIT. The M_PKTHDR flag is set for the returned mbuf structure.

Execution Environment

The m_gethdr 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 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 structure, the m_gethdr kernel service returns null.

Implementation Specifics

The m_gethdr kernel service is part of Base Operating System (BOS) Runtime.

Related Information

The m_free kernel service, m_freem kernel service.

I/O Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]