esballoc(D3) esballoc(D3)
NAME
esballoc - 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.
DESCRIPTION
esballoc 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
Copyright 1994 Novell, Inc. Page 1
esballoc(D3) esballoc(D3)
dynamically allocated data structures that might no longer
exist when it runs.
The pri argument is a hint to the allocator indicating how
badly the message block is needed. BPRI_LO should be used for
normal data allocations. BPRI_MED should be used for other
non-critical allocations. BPRI_HI should be used for
allocations that absolutely must succeed, although success is
not guaranteed. Some implementations may choose to ignore
this argument.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
REFERENCES
allocb(D3), esbbcall(D3), freeb(D3), free_rtn(D4)
NOTICES
Portability
All processors
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2