unix::poll+x86_64 +linux

unix::poll provides an interface for polling activity on file descriptors, compatible with the behavior defined by POSIX.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html

Index

Types

type event = enum i16 {
	POLLIN = 1,
	POLLPRI = 2,
	POLLOUT = 4,
	POLLERR = 8,
	POLLHUP = 16,
};
type pollfd = struct {
	fd: io::file,
	events: i16,
	revents: i16,
};

Errors

type error = !errors::error;

Constants

def INDEF: time::duration = -1;
def NONBLOCK: time::duration = 0;

Functions

fn poll(fds: []pollfd, timeout: time::duration) (uint | error);
fn strerror(err: error) const str;

Types

type event[link]

type event = enum i16 {
	POLLIN = 1,
	POLLPRI = 2,
	POLLOUT = 4,
	POLLERR = 8,
	POLLHUP = 16,
};

Events bitfield for the events and revents field of pollfd.

type pollfd[link]

type pollfd = struct {
	fd: io::file,
	events: i16,
	revents: i16,
};

A single file descriptor to be polled.

Errors

type error[link]

type error = !errors::error;

All error types that can be returned from poll.

Constants

def INDEF[link]

def INDEF: time::duration = -1;

Pass this time::duration to poll to cause it wait indefinitely for the next event.

def NONBLOCK[link]

def NONBLOCK: time::duration = 0;

Pass this time::duration to poll to cause it to return immediately if no events are available.

Functions

fn poll[link]

fn poll(fds: []pollfd, timeout: time::duration) (uint | error);

Polls for the desired events on a slice of pollfds, blocking until an event is available, or the timeout expires. Set the timeout to INDEF to block forever, or NONBLOCK to return immediately if no events are available. Returns the number of pollfd items which have events, i.e. those which have revents set to a nonzero value.

fn strerror[link]

fn strerror(err: error) const str;

Converts an error into a human-friendly string representation.