libuev
Functions
io.c File Reference

Descriptor backend, capable of watching files, sockets, pipes, etc. More...

#include <errno.h>
#include "uev.h"
Include dependency graph for io.c:

Functions

int uev_io_init (uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int fd, int events)
 Create an I/O watcher. More...
 
int uev_io_set (uev_t *w, int fd, int events)
 Reset an I/O watcher. More...
 
int uev_io_start (uev_t *w)
 Start an I/O watcher. More...
 
int uev_io_stop (uev_t *w)
 Stop an I/O watcher. More...
 

Detailed Description

Descriptor backend, capable of watching files, sockets, pipes, etc.

Function Documentation

◆ uev_io_init()

int uev_io_init ( uev_ctx_t ctx,
uev_t w,
uev_cb_t cb,
void *  arg,
int  fd,
int  events 
)

Create an I/O watcher.

Parameters
ctxA valid libuEv context
wPointer to an uev_t watcher
cbI/O callback
argOptional callback argument
fdFile descriptor to watch, or -1 to register an empty watcher
eventsEvents to watch for: UEV_READ, UEV_WRITE, UEV_EDGE, UEV_ONESHOT
Returns
POSIX OK(0) or non-zero with errno set on error.

◆ uev_io_set()

int uev_io_set ( uev_t w,
int  fd,
int  events 
)

Reset an I/O watcher.

Parameters
wPointer to an uev_t watcher
fdNew file descriptor to monitor
eventsRequested events to watch for, a mask of UEV_READ and UEV_WRITE
Returns
POSIX OK(0) or non-zero with errno set on error.

◆ uev_io_start()

int uev_io_start ( uev_t w)

Start an I/O watcher.

Parameters
wWatcher to start (again)
Returns
POSIX OK(0) or non-zero with errno set on error.

◆ uev_io_stop()

int uev_io_stop ( uev_t w)

Stop an I/O watcher.

Parameters
wWatcher to stop
Returns
POSIX OK(0) or non-zero with errno set on error.