1# zx_fifo_write 2 3## NAME 4 5<!-- Updated by update-docs-from-abigen, do not edit. --> 6 7fifo_write - write data to a fifo 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_fifo_write(zx_handle_t handle, 17 size_t elem_size, 18 const void* data, 19 size_t count, 20 size_t* actual_count); 21``` 22 23## DESCRIPTION 24 25`zx_fifo_write()` attempts to write up to *count* elements 26(`count * elem_size` bytes) from *data* to the fifo specified by *handle*. 27 28Fewer elements may be written than requested if there is insufficient 29room in the fifo to contain all of them. The number of 30elements actually written is returned via *actual_count*. 31 32The element size specified by *elem_size* must match the element size 33that was passed into [`zx_fifo_create()`]. 34 35*actual_count* is allowed to be NULL. This is useful when writing 36a single element: if *count* is 1 and `zx_fifo_write()` returns **ZX_OK**, 37*actual_count* is guaranteed to be 1 and thus can be safely ignored. 38 39It is not legal to write zero elements. 40 41## RIGHTS 42 43<!-- Updated by update-docs-from-abigen, do not edit. --> 44 45*handle* must be of type **ZX_OBJ_TYPE_FIFO** and have **ZX_RIGHT_WRITE**. 46 47## RETURN VALUE 48 49`zx_fifo_write()` returns **ZX_OK** on success, and returns 50the number of elements written (at least one) via *actual_count*. 51 52## ERRORS 53 54**ZX_ERR_BAD_HANDLE** *handle* is not a valid handle. 55 56**ZX_ERR_WRONG_TYPE** *handle* is not a fifo handle. 57 58**ZX_ERR_INVALID_ARGS** *data* is an invalid pointer or *actual_count* 59is an invalid pointer. 60 61**ZX_ERR_OUT_OF_RANGE** *count* is zero or *elem_size* is not equal 62to the element size of the fifo. 63 64**ZX_ERR_ACCESS_DENIED** *handle* does not have **ZX_RIGHT_WRITE**. 65 66**ZX_ERR_PEER_CLOSED** The other side of the fifo is closed. 67 68**ZX_ERR_SHOULD_WAIT** The fifo is full. 69 70 71## SEE ALSO 72 73 - [`zx_fifo_create()`] 74 - [`zx_fifo_read()`] 75 76<!-- References updated by update-docs-from-abigen, do not edit. --> 77 78[`zx_fifo_create()`]: fifo_create.md 79[`zx_fifo_read()`]: fifo_read.md 80