Skip to content

Latest commit

 

History

History
55 lines (34 loc) · 1.44 KB

vmo_read.md

File metadata and controls

55 lines (34 loc) · 1.44 KB

mx_vmo_read

NAME

vmo_read - read bytes from the VMO

SYNOPSIS

#include <magenta/syscalls.h>

mx_status_t mx_vmo_read(mx_handle_t handle, void* data, uint64_t offset, size_t len,
                        size_t* actual);

DESCRIPTION

vmo_read() attempts to read len bytes from a VMO at offset. The number of actual bytes read is returned in actual.

data pointer to a user buffer to read bytes into.

len number of bytes to attempt to read. data buffer should be large enough for at least this many bytes.

actual returns the actual number of bytes read, which may be anywhere from 0 to len. If a read extends beyond the size of the VMO, the actual bytes read will be trimmed. If the read starts at or beyond the size of the VMO, ERR_OUT_OF_RANGE will be returned.

RETURN VALUE

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

ERRORS

ERR_BAD_HANDLE handle is not a valid handle.

ERR_WRONG_TYPE handle is not a VMO handle.

ERR_ACCESS_DENIED handle does not have the MX_RIGHT_READ right.

ERR_INVALID_ARGS actual or data is an invalid pointer or NULL.

ERR_OUT_OF_RANGE offset starts at or beyond the end of the VMO.

SEE ALSO

vmo_create, vmo_clone, vmo_write, vmo_get_size, vmo_set_size, vmo_op_range.