rem: struct thread *thread; cpu_status state;  if (signal < 1 || signal > MAX_SIGNO || signal == SIGKILL || signal == SIGKILLTHR || signal == SIGSTOP) return EINVAL;  state = disable_interrupts(); GRAB_THREAD_LOCK();  thread = thread_get_current_thread();  if (oact) memcpy(oact, &thread->sig_action[signal - 1], sizeof(struct sigaction)); if (act) memcpy(&thread->sig_action[signal - 1], act, sizeof(struct sigaction));  if (act && act->sa_handler == SIG_IGN) thread->sig_pending &= ~SIGNAL_TO_MASK(signal); else if (act && act->sa_handler == SIG_DFL) { if (signal == SIGCONT || signal == SIGCHLD || signal == SIGWINCH) thread->sig_pending &= ~SIGNAL_TO_MASK(signal); }   RELEASE_THREAD_LOCK(); restore_interrupts(state);  return 0;
add: return sigaction_etc(-1, signal, act, oact);
context: sigaction(int signal, const struct sigaction *act, struct sigaction *oact){	struct thread *thread;	cpu_status state;	if (signal < 1 || signal > MAX_SIGNO		|| signal == SIGKILL || signal == SIGKILLTHR || signal == SIGSTOP)		return EINVAL;	state = disable_interrupts();	GRAB_THREAD_LOCK();	thread = thread_get_current_thread();	if (oact)		memcpy(oact, &thread->sig_action[signal - 1], sizeof(struct sigaction));	if (act)		memcpy(&thread->sig_action[signal - 1], act, sizeof(struct sigaction));	if (act && act->sa_handler == SIG_IGN)		thread->sig_pending &= ~SIGNAL_TO_MASK(signal);	else if (act && act->sa_handler == SIG_DFL) {		if (signal == SIGCONT || signal == SIGCHLD || signal == SIGWINCH)			thread->sig_pending &= ~SIGNAL_TO_MASK(signal);	} /*else		dprintf("### custom signal handler set\n");*/	RELEASE_THREAD_LOCK();	restore_interrupts(state);	return 0;}