FLOW_READ(3)

NAME
flow_read, flow_write - read and write from/to a flow

SYNOPSIS
#include <ouroboros/dev.h> int flow_read(int fd, void * buf, size_t count); int flow_write(int fd, const void * buf, size_t count); Compile and link with -louroboros-dev.

DESCRIPTION
The flow_read() function attempts to read at most count bytes from the flow associated with the allocated flow descriptor fd into the buffer pointed to by buf. The flow_write() function attempts to write count bytes from the supplied buffer buf to the flow specified by fd.

RETURN VALUE
On success, flow_read() returns the number of bytes read. On failure, a negative value indicating the error will be returned. If the number of bytes read equals count, a subsequent call to flow_read() should be performed to check if there were more bytes to read. This call to flow_read will return 0 if there was no more data and mark the end of the datagram. On success, flow_write() returns 0. On failure, a negative value indicating the error will be returned. Passing a NULL pointer for buf returns 0 with no other effects.

ERRORS
-EINVAL An invalid argument was passed. -EIRMD Failed to contact an IRMd instance. -EBADF Invalid flow descriptor passed. -ENOTALLOC The flow was not allocated. -EFLOWDOWN The flow has been reported down. -EMSGSIZE The buffer was too large to be written.

ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
Interface | Attribute | Value
flow_read() | Thread safety | MT-Safe
flow_write() | Thread safety | MT-Safe

TERMINOLOGY
Please see ouroboros-glossary(7).

SEE ALSO
fccntl(3), flow_alloc(3), fqueue(3), fset(3), ouroboros(8)

COLOPHON
This page is part of the Ouroboros project, found at http://ouroboros.ilabt.imec.be These man pages are licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/