DF-3590 / hold_probe.c
/* root-side probe: try to open /dev/psm0 while an unprivileged user * holds it. expect: EBUSY (device unavailable to moused/X/syscons). */ #include <fcntl.h> #include <stdio.h> #include <string.h> #include <errno.h> int main(void) { int fd = open("/dev/psm0", O_RDONLY | O_NONBLOCK); if (fd < 0) { printf("root open(/dev/psm0): %s <-- moused(8)/X would fail " "to start\n", strerror(errno)); return (0); } printf("root open(/dev/psm0): OK (not held)\n"); close(fd); return (0); } |