FQUEUE(3)

NAME
fqueue_create, fqueue_destroy, fqueue_next, fevent - I/O multiplexing on flows

SYNOPSIS
#include <ouroboros/fqueue.h> fqueue_t * fqueue_create(void); void fqueue_destroy(fqueue_t * fq); int fqueue_next(fqueue_t * fq); int fqueue_type(fqueue_t * fq); int fevent(fset_t * set, fqueue_t * fq, const struct timespec * timeo); Compile and link with -louroboros-dev.

DESCRIPTION
The fqueue_create() function creates an fqueue_t structure which is an event queue that stores events that occured within a certain fset_t. The fqueue_destroy() function frees any resources associated with an fqueue_t fq. The fqueue_next() function retrieves the next event (a flow descriptor) that is ready within the event queue fq. The fqueue_type() function retrieves the type for the current event on the fd that was returned by fqueue_next(). Event types are:
    FLOW_PKT: A new packet arrived on this flow and is ready for reading. FLOW_UP: The flow is now marked UP and ready for read/write. FLOW_DOWN: The flow is now marked DOWN and cannot be written to. FLOW_ALLOC: A pending flow is now allocated. FLOW_DEALLOC: The flow is deallocated by the other (N+1 or N-1) process.
The fevent() function retrieves all events that occured on any flow descriptor within set and returns them in the event queue fq. If a struct timespec * timeo can be provided, it will return either with new events or when timeo has expired. If timeo is NULL, the call will block indefinitely until an event occurs.

RETURN VALUE
On success, fqueue_create() returns a pointer to an fqueue_t. fqueue_destroy() has no return value. On success, fevent() returns the number of events that occured in set. On success, fqueue_next() returns the next file descriptor for which an event occurred. On success, fqueue_type() returns the event type for the last event returned by fqueue_next().

ERRORS
fqueue_create() returns NULL when insufficient resources were available to create the fqueue_t. fqueue_next() and fevent() can return -EINVAL An invalid argument was passed (fq or set was NULL). In addition, fqueue_next() or queue_type() can return -EPERM No more fds available or no current event in fq. and fevent() can return -ETIMEDOUT the interval set int timeo R expired before any event in set occured.

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

TERMINOLOGY
Please see ouroboros-glossary(7).

SEE ALSO
fccntl(3), flow_alloc(3), flow_read(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/