#include #include #include #include #include #include #include int main(int argc, char **argv) { fd_set rfds; struct timeval tv; char buf[2048]; int fd = open("/proc/timer_list", O_RDONLY, O_NONBLOCK); if (fd < 0) { perror("Failed to open"); abort(); } FD_ZERO(&rfds); FD_SET(fd, &rfds); while (1) { tv.tv_sec = 2; tv.tv_usec = 0; int retval = select(fd + 1, &rfds, NULL, NULL, &tv); if (retval == -1) perror("select()"); else if (retval) { int ret = read(fd, buf, sizeof(buf)); if (ret == 0) return EXIT_SUCCESS; } else { printf("TIMEOUT...\n"); } } }