Where is poll.h




















Note that the timeout interval will be rounded up to the system clock granularity, and kernel scheduling delays mean that the blocking interval may overrun by a small amount. Specifying a negative value in timeout means an infinite timeout. Specifying a timeout of zero causes poll to return immediately, even if no file descriptors are ready. Other than the difference in the precision of the timeout argument, the following ppoll call:.

See the description of pselect 2 for an explanation of why ppoll is necessary. If the sigmask argument is specified as NULL, then no signal mask manipulation is performed and thus ppoll differs from poll only in the precision of the timeout argument.

This argument is a pointer to a structure of the following form:. The ppoll system call was added to Linux in kernel 2. The ppoll library call was added in glibc 2. Unlike select 2 , however, it is possible to only pass in data corresponding to the file descriptors for which events are wanted. This makes poll more efficient than select 2 in most cases. The fd member is an open file descriptor. If fd is -1, the pollfd structure is considered unused, and revents will be cleared.

The events and revents members are bitmasks of conditions to monitor and conditions found, respectively. The calling process sets the events bitmask and poll sets the revents bitmask.

Each call to poll resets the revents bitmask for accuracy. If no event happen on any of the socket descriptors by the timeout, poll will return. Each element in the array of struct pollfd s represents one socket descriptor, and contains the following fields:. Before calling poll , load fd with the socket descriptor if you set fd to a negative number, this struct pollfd is ignored and its revents field is set to zero and then construct the events field by bitwise-ORing the following macros:.

Once the poll call returns, the revents field will be constructed as a bitwise-OR of the above fields, telling you which descriptors actually have had that event occur. Additionally, these other fields might be present:.



0コメント

  • 1000 / 1000