DF-2743 / p2743b.c
/* root-side sequence demonstrating the ungated register/clear path */ #include <sys/types.h> #include <sys/ioctl.h> #include <sys/diskslice.h> #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> int main(int argc, char **argv){ int fd = open(argv[1], O_RDONLY); u_int u = 0; int r; r = ioctl(fd, DIOCGKERNELDUMP, &u); printf("disable -> %d errno=%d (%s)\n", r, errno, r?strerror(errno):"OK"); u = 1; r = ioctl(fd, DIOCGKERNELDUMP, &u); printf("enable -> %d errno=%d (%s)\n", r, errno, r?strerror(errno):"OK"); r = ioctl(fd, DIOCGKERNELDUMP, &u); printf("enable2 -> %d errno=%d (%s) (EBUSY==dumper registered)\n", r, errno, r?strerror(errno):"OK"); return 0; } |