esballoc(D3)esballoc(D3)NAMEesballoc - allocate a message block using an externally-supplied buffer
SYNOPSIS
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/ddi.h>
mblk_t *esballoc(uchar_t *base, int size, int pri, frtn_t *fr_rtnp);
Arguments
base Address of driver-supplied data buffer.
size Number of bytes in data buffer.
pri Priority of allocation request (used to allocate the message
and data blocks).
fr_rtnp Pointer to the free-routine data structure.
DESCRIPTIONesballoc creates a STREAMS message and attaches a driver-supplied data
buffer in place of a STREAMS data buffer. It allocates a message and
data block header only. The driver-supplied data buffer, pointed to by
base, is used as the data buffer for the message.
When freeb(D3) is called to free the message, on the last reference to
the message, the driver's free-routine, specified by the free_func field
in the free_rtn(D4) structure, is called with one argument, specified by
the free_arg field, to free the data buffer.
Return Values
On success, a pointer to the newly allocated message block is returned.
On failure, NULL is returned.
USAGE
Instead of requiring a specific number of arguments, the free_arg field
is defined of type char *. This way, the driver can pass a pointer to a
structure if more than one argument is needed.
When the free_func function runs, interrupts from all STREAMS devices
will be blocked. It has no user context and may not call any routine
that sleeps. The function may not access any dynamically allocated data
structures that might no longer exist when it runs.
The pri argument is no longer used, but is retained for compatibility.
Some implementations may choose to ignore this argument.
Level
Base or Interrupt.
Page 1
esballoc(D3)esballoc(D3)
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may be held
across calls to this function.
REFERENCESallocb(D3), esbbcall(D3), freeb(D3), free_rtn(D4)
Page 2