static void controller()

in src/native/unix/native/jsvc-unix.c [478:510]


static void controller(int sig, siginfo_t * sip, void *ucp)
{
    switch (sig) {
        case SIGTERM:
        case SIGINT:
            if (!stopping) {
                /*
                 * Only forward a signal that requests shutdown once (the
                 * issue being that the child also forwards the signal to
                 * the parent and we need to avoid loops).
                 *
                 * Note that there are * two * instances of the stopping
                 * variable ... one in the parent and the second in the
                 * child.
                 */
                stopping = true;
                if (sip == NULL || !(sip->si_code <= 0 && sip->si_pid == controlled)) {
                    log_debug("Forwarding signal %d to process %d", sig, controlled);
                    kill(controlled, sig);
                }
            }
            break;
        case SIGHUP:
        case SIGUSR1:
        case SIGUSR2:
            log_debug("Forwarding signal %d to process %d", sig, controlled);
            kill(controlled, sig);
            break;
        default:
            log_debug("Caught unknown signal %d", sig);
            break;
    }
}