Poll – Comtrol eCos User Manual

Page 567

Advertising
background image

Chapter 38. TCP/IP Library Reference

An ioctl() function call appeared in Version 7 AT&T UNIX.

BSD

December 11, 1993

BSD

poll

POLL(2)

System Calls Manual

POLL(2)

NAME

poll - synchronous I/O multiplexing

SYNOPSIS

#include

<

poll.h>

int

poll(struct pollfd *fds, int nfds, int timeout);

DESCRIPTION

poll() provides a mechanism for reporting I/O conditions across a set of

file descriptors.

The arguments are as follows:

fds

Points to an array of pollfd structures, which are defined as:

struct pollfd {

int fd;

short events;

short revents;

};

The fd member is an open file descriptor.

The events and

revents members are bitmasks of conditions to monitor and condi-

tions found, respectively.

nfds

The number of pollfd structures in the array.

timeout

Maximum interval to wait for the poll to complete, in millisec-

onds.

If this value is 0, then poll() will return immediately.

If this value is INFTIM (-1), poll() will block indefinitely

until a condition is found.

The calling process sets the events bitmask and poll() sets the revents

bitmask.

Each call to poll() resets the revents bitmask for accuracy.

The condition flags in the bitmasks are defined as:

POLLIN

Data is available on the file descriptor for reading.

POLLNORM

Same as POLLIN.

POLLPRI

Same as POLLIN.

463

Advertising