HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
p
poll(2) poll(2)
fds[2].events = POLLOUT;
count = poll(fds, 3, 10000);
if (count == -1) {
perror("poll failed");
exit(1);
}
if (count==0)
printf("No data for reading or writing\n");
if (fds[0].revents & POLLNORM)
printf("There is data for reading fd %d\n", fds[0].fd);
if (fds[1].revents & POLLNORM)
printf("There is data for reading fd %d\n", fds[1].fd);
if (fds[2].revents & POLLOUT)
printf("There is room to write on fd %d\n", fds[2].fd);
Check for input or output on file descriptor 5 without waiting:
#include <poll.h>
struct pollfd fds;
fds.fd = 5;
fds.events = POLLNORM|POLLOUT;
poll(&fds, 1, 0);
if (fds.revents & POLLNORM)
printf("There is data available on fd %d\n", fds.fd);
if (fds.revents & POLLOUT)
printf("There is room to write on fd %d\n", fds.fd);
Wait 3.5 seconds:
#include <stdio.h>
#include <poll.h>
poll((struct pollfd *) NULL, 0, 3500);
Wait for a high priority, priority, or normal message on streams file descriptor 0:
#include <poll.h>
struct pollfd fds;
fds.fd = 0;
fds.events = POLLIN|POLLPRI;
poll(&fds, 1, -1);
SEE ALSO
read(2), write(2), select(2), getmsg(2), putmsg(2), streamio(7).
STANDARDS CONFORMANCE
poll(): AES, SVID2, SVID3
HP-UX Release 11i: December 2000 3 Section 2215
___
___