1 /* Public domain. */ 2 3 #include <sys/types.h> 4 #include <fcntl.h> 5 #include <poll.h> 6 main()7int main() 8 { 9 struct pollfd x; 10 11 x.fd = open("trypoll.c",O_RDONLY); 12 if (x.fd == -1) _exit(111); 13 x.events = POLLIN; 14 if (poll(&x,1,10) == -1) _exit(1); 15 if (x.revents != POLLIN) _exit(1); 16 17 /* XXX: try to detect and avoid poll() imitation libraries */ 18 19 _exit(0); 20 } 21