VMEM_XALLOC(9)

NAME
vmem_xalloc - Allocate resource from arena

SYNOPSIS
#include <sys/vmem.h>
vmem_addr_t
vmem_xalloc(vmem_t *vm, vmem_size_t size, vmem_size_t align, vmem_size_t phase, vmem_size_t nocross, vmem_addr_t minaddr, vmem_addr_t maxaddr, vm_flag_t flags);

DESCRIPTION
vmem_xalloc() allocates a resource from the arena.

vm  The arena which we allocate from.

size
    Specify the size of the allocation.

align
    If zero, don't care about the alignment of the allocation. Otherwise, request a resource segment starting at offset phase from an align aligned boundary.

phase
    See the above description of align. If align is zero, phase should be zero. Otherwise, phase should be smaller than align.

nocross
    Request a resource which doesn't cross nocross aligned boundary.

minaddr
    If non-zero, specify the minimum address which can be allocated.

maxaddr
    If non-zero, specify the maximum address + 1 which can be allocated.

flags
    A bitwise OR of an allocation strategy and a sleep flag.

    The allocation strategy is one of:

    VM_BESTFIT
        Prefer space efficiency.

    VM_INSTANTFIT
        Prefer performance.

    The sleep flag should be one of:

    VM_SLEEP
        Can sleep until enough resources are available.

    VM_NOSLEEP
        Don't sleep. Immediately return VMEM_ADDR_NULL if there are not enough resources available.

RETURN VALUES
On success, vmem_xalloc() returns an allocated vmem_addr_t. Otherwise, it returns VMEM_ADDR_NULL.

SEE ALSO
intro(9), vmem(9)