1# zx_vmo_write
2
3## NAME
4
5vmo_write - write bytes to the VMO
6
7## SYNOPSIS
8
9```
10#include <zircon/syscalls.h>
11
12zx_status_t zx_vmo_write(zx_handle_t handle, const void* buffer,
13                         uint64_t offset, size_t buffer_size);
14
15```
16
17## DESCRIPTION
18
19**vmo_write**() attempts to write exactly *buffer_size* bytes to a VMO at *offset*.
20
21*buffer* pointer to a user buffer to write bytes from.
22
23*buffer_size* number of bytes to attempt to write.
24
25## RIGHTS
26
27TODO(ZX-2399)
28
29## RETURN VALUE
30
31**zx_vmo_write**() returns **ZX_OK** on success, and exactly *buffer_size* bytes will
32have been written from *buffer*.
33In the event of failure, a negative error value is returned, and the number of
34bytes written from *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_WRITE** right.
43
44**ZX_ERR_INVALID_ARGS**  *buffer* is an invalid pointer or NULL.
45
46**ZX_ERR_NO_MEMORY**  Failure to allocate system memory to complete write.
47
48**ZX_ERR_OUT_OF_RANGE**  *offset* starts at or beyond the end of the VMO,
49                         or VMO is shorter than *buffer_size*.
50
51**ZX_ERR_BAD_STATE**  VMO has been marked uncached and is not directly writable.
52
53## SEE ALSO
54
55[vmo_create](vmo_create.md),
56[vmo_clone](vmo_clone.md),
57[vmo_read](vmo_read.md),
58[vmo_get_size](vmo_get_size.md),
59[vmo_set_size](vmo_set_size.md),
60[vmo_op_range](vmo_op_range.md).
61[vmo_set_cache_policy](vmo_set_cache_policy.md)
62