rmalloc(D3DK) —
.IX \f4rmalloc\fP(D3DK)
NAME
rmalloc − allocate space from a private space management map
SYNOPSIS
#include <sys/types.h>
#include <sys/map.h>
#include <sys/ddi.h>
ulong_t rmalloc(struct map ∗mp, size_t size);
ARGUMENTS
mpPointer to the map from which space is to be allocated.
sizeNumber of units of space to allocate.
DESCRIPTION
rmalloc allocates space from the private space management map pointed to by mp. The map must have been allocated by a call to rmallocmap(D3DK) and the space managed by the map must have been added using rmfree(D3DK) prior to the first call to rmalloc for the map.
size specifies the amount of space to allocate and is in arbitrary units. The driver using the map places whatever semantics on the units are appropriate for the type of space being managed. For example, units may be byte addresses, pages of memory, or blocks on a device.
The system allocates space from the memory map on a first-fit basis and coalesces adjacent space fragments when space is returned to the map by rmfree.
RETURN VALUE
Upon successful completion, rmalloc returns the base of the allocated space. If size units cannot be allocated, 0 is returned.
LEVEL
Base or Interrupt.
NOTES
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.
SEE ALSO
rmalloc_wait(D3DK), rmallocmap(D3DK), rmfree(D3DK), rmfreemap(D3DK)
DDI/DKI