static void qt_sa_sigchld_sigaction(int signum, siginfo_t *info, void *context) { // *Never* use the info or contect variables in this function // (except for passing them to the next signal in the chain). // We cannot be sure if another library or if the application // installed a signal handler for SIGCHLD without SA_SIGINFO // and fails to pass the arguments to us. If they do that, // these arguments contain garbage and we'd most likely crash. qt_safe_write(qt_qprocess_deadChild_pipe[1], "", 1); #if defined (QPROCESS_DEBUG) fprintf(stderr, "*** SIGCHLD\n"); #endif // load as volatile volatile struct sigaction *vsa = &qt_sa_old_sigchld_handler; if (qt_sa_old_sigchld_handler.sa_flags & SA_SIGINFO) { void (*oldAction)(int, siginfo_t *, void *) = vsa->sa_sigaction; if (oldAction) oldAction(signum, info, context); } else { void (*oldAction)(int) = vsa->sa_handler; if (oldAction && oldAction != SIG_IGN) oldAction(signum); } }
static void sig_child_handler(int sig) { ::write(sig_child_pipe[1], "@", 1); // Complicated way of calling the old child handler void (*oldAction)(int) = ((volatile struct sigaction *)&old_sig_child_handler)->sa_handler; if (oldAction && oldAction != SIG_IGN) oldAction(sig); }
static void qt_sa_sigchld_handler(int signum) { qt_safe_write(qt_qprocess_deadChild_pipe[1], "", 1); #if defined (QPROCESS_DEBUG) fprintf(stderr, "*** SIGCHLD\n"); #endif // load it as volatile void (*oldAction)(int) = ((volatile struct sigaction *)&qt_sa_old_sigchld_handler)->sa_handler; if (oldAction && oldAction != SIG_IGN) oldAction(signum); }