#include #include #include #include #include #include #include #include int main(int argc, char **argv) { fd_set infd; struct timeval tv; int ret; int fd; fd = open("/dev/urandom",O_NONBLOCK|O_NOCTTY,00); FD_ZERO(&infd); FD_SET(fd, &infd); tv.tv_sec = 10; tv.tv_usec = 10000; ret = select(fd + 1, &infd, NULL, NULL, &tv); if (ret == -1) { perror("select"); exit(EXIT_FAILURE); } printf("select returned %d\r\n", ret); exit(EXIT_SUCCESS); }