DF-2680 / victim2.c
/* DF-2680 control: enable FIOASYNC, catch SIGIO, STAY ALIVE. */ #include <fcntl.h> #include <sys/ioctl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> static void handler(int sig) { printf("victim2: GOT_SIGIO (live path works) pid=%d\n", getpid()); fflush(stdout); exit(0); } int main(void) { struct sigaction sa; int fd, one = 1; sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGIO, &sa, NULL); fd = open("/dev/devctl", O_RDWR); if (fd < 0) { perror("open"); return (1); } if (ioctl(fd, FIOASYNC, &one) != 0) { perror("FIOASYNC"); return (1); } printf("victim2: pid=%d armed, sleeping 20\n", getpid()); fflush(stdout); sleep(20); printf("victim2: NO SIGIO within 20s\n"); return (0); } |