DF-5368 / holdopen.c
/* holder: open a device node and hold it open forever (pause loop). * Used to keep an evdev client (and thus ums_ev_open / the intr xfer) * active across a device unplug. Usage: holdopen <path> */ #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <signal.h> int main(int argc, char **argv) { int fd; if (argc != 2) return (2); fd = open(argv[1], O_RDONLY); if (fd < 0) { perror("open"); return (1); } fprintf(stderr, "holding %s fd=%d pid=%d\n", argv[1], fd, getpid()); fflush(stderr); for (;;) pause(); return (0); } |