poll(3)

DESCRIPTION

Waits for native descriptor readiness. Pipe, terminal, and Unix socket readiness is reported by parked AIO operations and device wakeups; timeout_ms is -1 for an unbounded wait and zero for an immediate check.

SYNOPSIS

#include <poll.h>

int poll(struct pollfd *fds, unsigned long count, int timeout_ms);

RETURN VALUE

  • Returns the number of descriptors with nonzero revents, or -1 and sets errno.

ERRORS

  • -EINVAL
    • Count exceeds the native ring capacity or timeout_ms is less than -1.
  • -EFAULT
    • A descriptor array is not accessible to userspace.

NOTES

The wrapper never spins and does not use host descriptors. POLLNVAL is reported for an invalid descriptor.