VMEM_ALLOC(9)

NAME
vmem_alloc - Allocate resource from arena

SYNOPSIS
#include <sys/vmem.h>
vmem_addr_t
vmem_alloc(vmem_t *vm, vmem_size_t size, vm_flag_t flags);

DESCRIPTION
vmem_alloc() allocates a resource from the arena.

vm  The arena which we allocate from.

size
    Specify the size of the allocation.

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_alloc() returns an allocated vmem_addr_t. Otherwise, it returns VMEM_ADDR_NULL.

SEE ALSO
intro(9), vmem(9)