1# zx_vmo_write 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7vmo_write - write bytes to the VMO 8 9## SYNOPSIS 10 11<!-- Updated by update-docs-from-abigen, do not edit. --> 12 13``` 14#include <zircon/syscalls.h> 15 16zx_status_t zx_vmo_write(zx_handle_t handle, 17 const void* buffer, 18 uint64_t offset, 19 size_t buffer_size); 20``` 21 22## DESCRIPTION 23 24`zx_vmo_write()` attempts to write exactly *buffer_size* bytes to a VMO at *offset*. 25 26*buffer* pointer to a user buffer to write bytes from. 27 28*buffer_size* number of bytes to attempt to write. 29 30## RIGHTS 31 32<!-- Updated by update-docs-from-abigen, do not edit. --> 33 34*handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_WRITE**. 35 36## RETURN VALUE 37 38`zx_vmo_write()` returns **ZX_OK** on success, and exactly *buffer_size* bytes will 39have been written from *buffer*. 40In the event of failure, a negative error value is returned, and the number of 41bytes written from *buffer* is undefined. 42 43## ERRORS 44 45**ZX_ERR_BAD_HANDLE** *handle* is not a valid handle. 46 47**ZX_ERR_WRONG_TYPE** *handle* is not a VMO handle. 48 49**ZX_ERR_ACCESS_DENIED** *handle* does not have the **ZX_RIGHT_WRITE** right. 50 51**ZX_ERR_INVALID_ARGS** *buffer* is an invalid pointer or NULL. 52 53**ZX_ERR_NO_MEMORY** Failure to allocate system memory to complete write. 54 55**ZX_ERR_OUT_OF_RANGE** *offset* starts at or beyond the end of the VMO, 56 or VMO is shorter than *buffer_size*. 57 58**ZX_ERR_BAD_STATE** VMO has been marked uncached and is not directly writable. 59 60## SEE ALSO 61 62 - [`zx_vmo_clone()`] 63 - [`zx_vmo_create()`] 64 - [`zx_vmo_get_size()`] 65 - [`zx_vmo_op_range()`] 66 - [`zx_vmo_read()`] 67 - [`zx_vmo_set_cache_policy()`] 68 - [`zx_vmo_set_size()`] 69 70<!-- References updated by update-docs-from-abigen, do not edit. --> 71 72[`zx_vmo_clone()`]: vmo_clone.md 73[`zx_vmo_create()`]: vmo_create.md 74[`zx_vmo_get_size()`]: vmo_get_size.md 75[`zx_vmo_op_range()`]: vmo_op_range.md 76[`zx_vmo_read()`]: vmo_read.md 77[`zx_vmo_set_cache_policy()`]: vmo_set_cache_policy.md 78[`zx_vmo_set_size()`]: vmo_set_size.md 79