NAME

xpoll_ctl - control interface for an xpoll instance

SYNOPSIS

#include <xio/poll.h>

#define XPOLL_ADD 1 #define XPOLL_DEL 2 #define XPOLL_MOD 3 int xpoll_ctl(int pollfd, int op, struct xpoll_event *ent);

DESCRIPTION

This call performs control operations on the xpoll instance referred to by the pollfd. It requests that the operation op be performed for the target xsocket file descriptor: fd.

Valid values for the op argument are :

XPOLL_ADD Register the target xsocket file descriptor xd on the xpoll instance referred to by xp and associate the event event with the internal xio socket descriptor linked to xd.

XPOLL_MOD Change the event event associated with the target xio socket.

XPOLL_DEL Remove (deregister) the target xio socket descriptor from the epoll instance referred to by xp.

The event argument describes the xio socket poll events.  The struct
xpoll_event is defined as :
----
struct xpoll_event {
    int xd;
    void *self;
/* What xio socket events i care about ... */
uint32_t care;
    /* What events happened now */
    uint32_t happened;
};
----
The care member is a bit set composed using the following available event types:
XPOLLIN:
    The associated xio socket is available for xrecv[3] operations.
XPOLLOUT:
    The associated xio socket is available for xsend[3] operations.
XPOLLERR:
    Error condition happened on the associated xio socket.  xpoll_wait[3] will
    always wait for this event; it is not necessary to set it in events.

RETURN VALUE

When successful, xpoll_ctl() returns zero. When an error occurs, xpoll_ctl() returns -1 and errno is set appropriately.

ERRORS

EEXIST

op was XPOLL_ADD, and the supplied xio socket is already registered with this xpoll instance.

EINVAL

the requested operation op is not supported by this interface.

ENOENT

op was XPOLL_MOD or XPOLL_DEL, and xio socket is not registered on with this xpoll instance.

ENOMEM

There was insufficient memory to handle the requested op control operation.

SEE ALSO

xpoll_wait(3) xio(7)

AUTHORS

Dong Fang <yp.fangdong@gmail.com>
Martin Sustrik <sustrik@250bpm.com>