int ui_loop(void) { int child; int fds[2]; int r; Char buf[16]; Char *args[7] = { (Char *)"ppres/driver/UI", "+RTS", "-p", "-xc", "-RTS", buf, NULL }; r = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); if (r < 0) VG_(tool_panic)((Char *)"Error creating socket pair"); child = my_fork(); if (child == 0) { struct vki_sigaction_base sa; VG_(close)(fds[1]); /* We're going to be doing a lot more forking, and don't want lots of zombies hanging around. Child crash is detected when a control socket closes unexpectedly. */ VG_(memset)(&sa, 0, sizeof(sa)); sa.ksa_handler = VKI_SIG_IGN; sa.sa_flags = 3; /* SA_NOCLDSTOP|SA_NOCLDWAIT */ my_sigaction(VKI_SIGCHLD, &sa, NULL); return fds[0]; } VG_(close)(fds[0]); VG_(sprintf)(buf, "%d", fds[1]); VG_(execv)(args[0], args); VG_(tool_panic)((Char *)"Cannot exec driver!"); }
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) { return my_sigaction(signum, act, oldact); }
int LIBC_SIGACTION(int signum, const struct sigaction *act, struct sigaction *oldact) { return my_sigaction(signum, act, oldact); }