Ejemplo n.º 1
0
/*
 * Signal handler.
 */
void
onsig(int signo)
{

	if (signo == SIGINT && trap[SIGINT] == NULL) {
		/*
		 * The !in_dotrap here is safe.  The only way we can arrive
		 * here with in_dotrap set is that a trap handler set SIGINT to
		 * SIG_DFL and killed itself.
		 */
		if (suppressint && !in_dotrap)
			SET_PENDING_INT;
		else
			onint();
		return;
	}

	/* If we are currently in a wait builtin, prepare to break it */
	if (signo == SIGINT || signo == SIGQUIT)
		pendingsig_waitcmd = signo;

	if (trap[signo] != NULL && trap[signo][0] != '\0' &&
	    (signo != SIGCHLD || !ignore_sigchld)) {
		gotsig[signo] = 1;
		pendingsig = signo;
		pendingsig_waitcmd = signo;
	}
}
Ejemplo n.º 2
0
/*
 * Signal handler.
 */
void
onsig(int signo)
{

	if (signo == SIGINT && trap[SIGINT] == NULL) {
		onint();
		return;
	}

	/* If we are currently in a wait builtin, prepare to break it */
	if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) {
		breakwaitcmd = 1;
		pendingsig = signo;
	}

	if (trap[signo] != NULL && trap[signo][0] != '\0' &&
	    (signo != SIGCHLD || !ignore_sigchld)) {
		gotsig[signo] = 1;
		pendingsig = signo;

		/*
		 * If a trap is set, not ignored and not the null command, we
		 * need to make sure traps are executed even when a child
		 * blocks signals.
		 */
		if (Tflag && !(trap[signo][0] == ':' && trap[signo][1] == '\0'))
			breakwaitcmd = 1;
	}

#ifndef NO_HISTORY
	if (signo == SIGWINCH)
		gotwinch = 1;
#endif
}
Ejemplo n.º 3
0
void
onsig(int signo)
{
	bsd_signal(signo, onsig);
	if (signo == SIGINT && trap[SIGINT] == NULL) {
		onint();
		return;
	}
	gotsig[signo - 1] = 1;
	pendingsigs++;
}
Ejemplo n.º 4
0
void
onsig(shinstance *psh, int signo)
{
	sh_signal(psh, signo, onsig);
	if (signo == SIGINT && psh->trap[SIGINT] == NULL) {
		onint(psh);
		return;
	}
	psh->gotsig[signo - 1] = 1;
	psh->pendingsigs++;
}
Ejemplo n.º 5
0
void
onsig(int signo)
{
	CTRACE(DBG_SIG, ("Signal %d, had: pending %d, gotsig[%d]=%d\n",
	    signo, pendingsigs, signo, gotsig[signo]));

	signal(signo, onsig);
	if (signo == SIGINT && trap[SIGINT] == NULL) {
		onint();
		return;
	}
	gotsig[signo] = 1;
	pendingsigs++;
}
Ejemplo n.º 6
0
Archivo: trap.c Proyecto: alimon/dash
void
onsig(int signo)
{
    if (signo == SIGCHLD) {
        gotsigchld = 1;
        if (!trap[SIGCHLD])
            return;
    }

    gotsig[signo - 1] = 1;
    pendingsigs = signo;

    if (signo == SIGINT && !trap[SIGINT]) {
        if (!suppressint)
            onint();
        intpending = 1;
    }
}
Ejemplo n.º 7
0
/*
 * Signal handler.
 */
void
onsig(int signo)
{

	if (signo == SIGINT && trap[SIGINT] == NULL) {
		onint();
		return;
	}

	/* If we are currently in a wait builtin, prepare to break it */
	if (signo == SIGINT || signo == SIGQUIT)
		pendingsig_waitcmd = signo;

	if (trap[signo] != NULL && trap[signo][0] != '\0' &&
	    (signo != SIGCHLD || !ignore_sigchld)) {
		gotsig[signo] = 1;
		pendingsig = signo;
	}
}
Ejemplo n.º 8
0
void
onsig(int signo)
{
	CTRACE(DBG_SIG, ("Signal %d, had: pending %d, gotsig[%d]=%d\n",
	    signo, pendingsigs, signo, gotsig[signo]));

	/*			This should not be needed.
	signal(signo, onsig);
	*/

	if (signo == SIGINT && trap[SIGINT] == NULL) {
		onint();
		return;
	}

	/*
	 * if the signal will do nothing, no point reporting it
	 */
	if (trap[signo] != NULL && trap[signo][0] != '\0' &&
	    signo != SIGCHLD) {
		gotsig[signo] = 1;
		pendingsigs++;
	}
}
Ejemplo n.º 9
0
void
__inton() {
	if (--suppressint == 0 && intpending) {
		onint();
	}
}