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

Technical Reference: Kernel and Subsystems, Volume 1

m_clattach Kernel Service

Purpose

Allocates an mbuf structure and attaches an external cluster.

Syntax

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


struct mbuf *
m_clattach( ext_buf, ext_free, ext_size, ext_arg, wait)
caddr_t ext_buf;
int (*ext_free)();
int ext_size;
int ext_arg;
int wait;

Parameters

ext_buf Specifies the address of the external data area.
ext_free Specifies the address of a function to be called when this mbuf structure is freed.
ext_size Specifies the length of the external data area.
ext_arg Specifies an argument to pass to the above function.
wait Specifies either the M_WAIT or M_DONTWAIT value.

Description

The m_clattach kernel service allocates an mbuf structure and attaches the cluster specified by the ext_buf parameter. This data is owned by the caller. The m_data field of the returned mbuf structure points to the caller's data. Interrupt handlers can call this service only with the wait parameter set to M_DONTWAIT.

Note
The m_clattach kernel service replaces the m_clgetx kernel service, which is no longer supported.

The calling function is required to fill out the mbuf structure sufficiently to support normal usage. This includes support for the DMA functions during network transmission. To support DMA functions, the ext_hasxm flag field needs to be set to true and the ext_xmemd structure needs to be filled out. For buffers allocated from the kernel pinned heap, the ext_xmemd.aspace_id field should be set to XMEM_GLOBAL.

Execution Environment

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

Return Values

The m_clattach kernel 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_clattach service returns null.

Related Information

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 ]