zx_iob_allocate_id

Summary

Allocates an ID out of an IOBuffer region of discipline ZX_IOB_DISCIPLINE_TYPE_ID_ALLOCATOR.

Declaration

#include <zircon/syscalls-next.h>

zx_status_t zx_iob_allocate_id(zx_handle_t handle,
                               zx_iob_allocate_id_options_t options,
                               uint32_t region_index,
                               const void* blob,
                               uint64_t blob_size,
                               uint32_t* id);

Description

A new ID is allocated for the provided blob from the associated container backing an IOBuffer region of discipline ZX_IOB_DISCIPLINE_TYPE_ID_ALLOCATOR,

The IOBuffer handle used to interact with the region must admit mediated write access.

Return value

On success, zx_iob_allocate_id() returns ZX_OK and populates id with the allocated ID.

Errors

ZX_ERR_OUT_OF_RANGE region_index exceeded the maximum region index.

ZX_ERR_WRONG_TYPE The corresponding region is not of the ZX_IOB_DISCIPLINE_TYPE_ID_ALLOCATOR discipline.

ZX_ERR_INVALID_ARGS options was nonzero (there are no non-default options supported at this time).

ZX_ERR_ACCESS_DENIED The IOB handle does not have write permissions, or the corresponding region does not have mediated write permissions.

ZX_ERR_NO_MEMORY The ID allocator region has run out of memory from which to allocate new IDs. Note that this unrelated to the state of system memory.

ZX_ERR_IO_DATA_INTEGRITY The ID allocator region has been corrupted.