#include #include #include #include #include #include #include int main() { int fd; struct pollfd ev; int ret; ssize_t bytes; char buf[4096]; long unsigned int cnt = 0; fd = open("/proc/mounts", O_RDONLY); do { ev.events = POLLIN; ev.fd = fd; ev.revents = 0; ret = poll(&ev, 1, -1); lseek(fd, 0, SEEK_SET); if (ret == 1 && ev.revents == POLLIN) { printf("#### %lu ########################################\n", cnt); while ((bytes = read(fd, buf, sizeof(buf))) > 0) write(1, buf, bytes); cnt++; } } while (ret >= 0); return 0; }