kernels/linux-2.4.0/arch/s390/kernel/signal.c
/*
 * Note that 'init' is a special process: it doesn't get signals it doesn't
 * want to handle. Thus you cannot kill init even with a SIGKILL even by
 * mistake.
 *
 * Note that we go through the signals twice: once to check the signals that
 * the kernel can handle, and then we build all the user-level signal handling
 * stack-frames in one go after that.
 */
Note that 'init' is a special process: it doesn't get signals it doesn't
want to handle. Thus you cannot kill init even with a SIGKILL even by
mistake.

Note that we go through the signals twice: once to check the signals that
the kernel can handle, and then we build all the user-level signal handling
stack-frames in one go after that.
Note that ' init ' is a special process : it doesn ' t get signals it doesn ' t want to handle . Thus you cannot kill init even with a SIGKILL even by mistake . Note that we go through the signals twice : once to check the signals that the kernel can handle and then we build all the user - level signal handling stack - frames in one go after that .
int do_signal(struct pt_regs *regs, sigset_t *oldset)
{
	siginfo_t info;
	struct k_sigaction *ka;
	if (!user_mode(regs))
		return 1;
	if (!oldset)
		oldset = &current->blocked;
	for (;;) {
		unsigned long signr;
		spin_lock_irq(&current->sigmask_lock);
		signr = dequeue_signal(&current->blocked, &info);
		spin_unlock_irq(&current->sigmask_lock);
		if (!signr)
			break;
		if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
			current->exit_code = signr;
			current->state = TASK_STOPPED;
			notify_parent(current, SIGCHLD);
			schedule();
			if (!(signr = current->exit_code))
				continue;
			current->exit_code = 0;
			if (signr == SIGSTOP)
				continue;
			if (signr != info.si_signo) {
				info.si_signo = signr;
				info.si_errno = 0;
				info.si_code = SI_USER;
				info.si_pid = current->p_pptr->pid;
				info.si_uid = current->p_pptr->uid;
			}
			if (sigismember(&current->blocked, signr)) {
				send_sig_info(signr, &info, current);
				continue;
			}
		}
		ka = &current->sig->action[signr-1];
		if (ka->sa.sa_handler == SIG_IGN) {
			if (signr != SIGCHLD)
				continue;
			while (sys_wait4(-1, NULL, WNOHANG, NULL) > 0)
				;
			continue;
		}
		if (ka->sa.sa_handler == SIG_DFL) {
			int exit_code = signr;
			if (current->pid == 1)
				continue;
			switch (signr) {
			case SIGCONT: case SIGCHLD: case SIGWINCH:
				continue;
			case SIGTSTP: case SIGTTIN: case SIGTTOU:
				if (is_orphaned_pgrp(current->pgrp))
					continue;
			case SIGSTOP:
				current->state = TASK_STOPPED;
				current->exit_code = signr;
				if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
					notify_parent(current, SIGCHLD);
				schedule();
				continue;
			case SIGQUIT: case SIGILL: case SIGTRAP:
			case SIGABRT: case SIGFPE: case SIGSEGV:
                                if (do_coredump(signr, regs))
                                        exit_code |= 0x80;
			default:
				lock_kernel();
				sigaddset(&current->pending.signal, signr);
				recalc_sigpending(current);
				current->flags |= PF_SIGNALED;
				do_exit(exit_code);
			}
		}
		handle_signal(signr, ka, &info, oldset, regs);
		return 1;
	}
	if ( regs->trap == 0x20  ) {
		if (regs->gprs[2] == -ERESTARTNOHAND ||
		    regs->gprs[2] == -ERESTARTSYS ||
		    regs->gprs[2] == -ERESTARTNOINTR) {
			regs->gprs[2] = regs->orig_gpr2;
			regs->psw.addr -= 2;
		}
	}
	return 0;
}
int do_signal ( struct pt_regs * regs , sigset_t * oldset ) { siginfo_t info ; struct k_sigaction * ka ; if ( ! user_mode ( regs ) ) return 1 ; if ( ! oldset ) oldset = & current -> blocked ; for ( ; ; ) { unsigned long signr ; spin_lock_irq ( & current -> sigmask_lock ) ; signr = dequeue_signal ( & current -> blocked , & info ) ; spin_unlock_irq ( & current -> sigmask_lock ) ; if ( ! signr ) break ; if ( ( current -> flags & PF_PTRACED ) && signr != SIGKILL ) { current -> exit_code = signr ; current -> state = TASK_STOPPED ; notify_parent ( current , SIGCHLD ) ; schedule ( ) ; if ( ! ( signr = current -> exit_code ) ) continue ; current -> exit_code = 0 ; if ( signr == SIGSTOP ) continue ; if ( signr != info . si_signo ) { info . si_signo = signr ; info . si_errno = 0 ; info . si_code = SI_USER ; info . si_pid = current -> p_pptr -> pid ; info . si_uid = current -> p_pptr -> uid ; } if ( sigismember ( & current -> blocked , signr ) ) { send_sig_info ( signr , & info , current ) ; continue ; } } ka = & current -> sig -> action [ signr - 1 ] ; if ( ka -> sa . sa_handler == SIG_IGN ) { if ( signr != SIGCHLD ) continue ; while ( sys_wait4 ( -1 , NULL , WNOHANG , NULL ) > 0 ) ; continue ; } if ( ka -> sa . sa_handler == SIG_DFL ) { int exit_code = signr ; if ( current -> pid == 1 ) continue ; switch ( signr ) { case SIGCONT : case SIGCHLD : case SIGWINCH : continue ; case SIGTSTP : case SIGTTIN : case SIGTTOU : if ( is_orphaned_pgrp ( current -> pgrp ) ) continue ; case SIGSTOP : current -> state = TASK_STOPPED ; current -> exit_code = signr ; if ( ! ( current -> p_pptr -> sig -> action [ SIGCHLD - 1 ] . sa . sa_flags & SA_NOCLDSTOP ) ) notify_parent ( current , SIGCHLD ) ; schedule ( ) ; continue ; case SIGQUIT : case SIGILL : case SIGTRAP : case SIGABRT : case SIGFPE : case SIGSEGV : if ( do_coredump ( signr , regs ) ) exit_code |= 0x80 ; default : lock_kernel ( ) ; sigaddset ( & current -> pending . signal , signr ) ; recalc_sigpending ( current ) ; current -> flags |= PF_SIGNALED ; do_exit ( exit_code ) ; } } handle_signal ( signr , ka , & info , oldset , regs ) ; return 1 ; } if ( regs -> trap == 0x20 ) { if ( regs -> gprs [ 2 ] == - ERESTARTNOHAND || regs -> gprs [ 2 ] == - ERESTARTSYS || regs -> gprs [ 2 ] == - ERESTARTNOINTR ) { regs -> gprs [ 2 ] = regs -> orig_gpr2 ; regs -> psw . addr -= 2 ; } } return 0 ; }
Note that 'init' is a special process: it doesn't get signals it doesn't
 want to handle.
Note that ' init ' is a special process : it doesn ' t get signals it doesn ' t want to handle .
/*
	 * We want the common case to go fast, which
	 * is why we may in certain cases get here from
	 * kernel mode. Just return without doing anything
	 * if so.
	 */ /* Let the debugger run.  */ /* We're back.  Did the debugger cancel the sig?  */ /* The debugger continued.  Ignore SIGSTOP.  */ /* Update the siginfo structure.  Is this good?  */ /* If the (new) signal is now blocked, requeue it.  */ /* Check for SIGCHLD: it's special.  */ /* nothing */ /* Init gets no signals it doesn't want.  */ /* FALLTHRU */ /* FALLTHRU */ /* NOTREACHED */ /* Whee!  Actually deliver the signal.  */ /* Did we come from a system call? */ /* System Call! */ /* Restart the system call - no handlers present */