[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

m_get Kernel Service

Purpose

Allocates a memory buffer (mbuf) from the mbuf pool.

Syntax

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


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

Parameters

wait 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.
type Specifies a valid mbuf type, as listed in the /usr/include/sys/mbuf.h file.

Description

The m_get 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_get kernel service does not return until an mbuf structure is available.

Execution Environment

The m_get 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

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

Related Information

The m_free kernel service, m_freem kernel service.

I/O Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]