zx_vmo_set_stream_size

SUMMARY

Resize a the stream of a VMO object.

Declaration

#include <zircon/syscalls.h>

zx_status_t zx_vmo_set_stream_size(zx_handle_t handle, uint64_t size);

Description

zx_vmo_set_stream_size() changes the stream size of a virtual memory object (VMO).

Unlike the VMO size, stream size will not be rounded up to the next page size boundary, so the stream size will not necessarily be page-aligned. It is possible to change the stream size on a non-resizable VMO. The VMO size can not be changed using this function, zx_vmo_set_size() can be used to change the size of the VMO.

When the stream size is increased, the range from the original (smaller) stream size and the end of the VMO is zeroed.

When the stream size is reduced, the range between the new (smaller) stream size and the end of the VMO is zeroed.

If there is any existing data in the VMO within these ranges, it will be overwritten by this operation.

Rights

handle must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_WRITE

Return value

zx_vmo_set_stream_size() returns ZX_OK on success. In the event of failure, a negative error value is returned.

Errors

ZX_ERR_BAD_HANDLE handle is not a valid handle.

ZX_ERR_WRONG_TYPE handle is not a VMO handle.

ZX_ERR_ACCESS_DENIED handle does not have the ZX_RIGHT_WRITE right.

ZX_ERR_OUT_OF_RANGE Requested size is too large, or stream size is greater than VMO size.

ZX_ERR_NO_MEMORY Failure due to lack of system memory.

See also