FLOW_READ

Section: Ouroboros Programmer's Manual (3)
Updated: 2017-04-10
Index Return to wiki

 

NAME

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

 

SYNOPSIS

#include <ouroboros/dev.h>

ssize_t flow_read(int fd, void * buf, size_t count);

ssize_t 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. Partial reads are enabled by default. 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 the number of bytes written. On failure, a negative value indicating the error will be returned. Partial writes needs to be explicitly enabled. 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.

-EFLOWPEER The flow's peer is unresponsive (flow timed out).

-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.rocks

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/


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
ATTRIBUTES
TERMINOLOGY
SEE ALSO
COLOPHON

This document was created by man2html, using the manual pages.
Time: 11:27:07 GMT, April 23, 2024