1# zx_vmo_read
2
3## NAME
4
5vmo_read - read bytes from the VMO
6
7## SYNOPSIS
8
9```
10#include <zircon/syscalls.h>
11
12zx_status_t zx_vmo_read(zx_handle_t handle, void* buffer, uint64_t offset, size_t buffer_size);
13
14```
15
16## DESCRIPTION
17
18**vmo_read**() attempts to read exactly *buffer_size* bytes from a VMO at *offset*.
19
20*buffer* pointer to a user buffer to read bytes into.
21
22*buffer_size* number of bytes to attempt to read. *buffer* buffer should be large
23enough for at least this many bytes.
24
25## RIGHTS
26
27TODO(ZX-2399)
28
29## RETURN VALUE
30
31**zx_vmo_read**() returns **ZX_OK** on success, and exactly *buffer_size* bytes will
32have been written to *buffer*.
33In the event of failure, a negative error value is returned, and the number of
34bytes written to *buffer* is undefined.
35
36## ERRORS
37
38**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
39
40**ZX_ERR_WRONG_TYPE**  *handle* is not a VMO handle.
41
42**ZX_ERR_ACCESS_DENIED**  *handle* does not have the **ZX_RIGHT_READ** right.
43
44**ZX_ERR_INVALID_ARGS**  *buffer* is an invalid pointer or NULL.
45
46**ZX_ERR_OUT_OF_RANGE**  *offset* starts at or beyond the end of the VMO,
47                         or VMO is shorter than *buffer_size*.
48
49**ZX_ERR_BAD_STATE**  VMO has been marked uncached and is not directly readable.
50
51## SEE ALSO
52
53[vmo_create](vmo_create.md),
54[vmo_clone](vmo_clone.md),
55[vmo_write](vmo_write.md),
56[vmo_get_size](vmo_get_size.md),
57[vmo_set_size](vmo_set_size.md),
58[vmo_op_range](vmo_op_range.md).
59[vmo_set_cache_policy](vmo_set_cache_policy.md)
60