ast_comparator/test/student_data/handout/shlab-handout/cases/reference_22_tsh.c
/*
 * Requires:
 *   "signum" is a valid signal number, and "handler" is a valid signal
 *   handler.
 *
 * Effects:
 *   Registers a new handler for the specified signal, returning the old
 *   handler.  Behaves similarly to "sigset" but restarts system calls
 *   when possible.
 */
"signum" is a valid signal number, and "handler" is a valid signal
handler.

Registers a new handler for the specified signal, returning the old
handler.  Behaves similarly to "sigset" but restarts system calls
when possible.
" signum " is a valid signal number and " handler " is a valid signal handler . Registers a new handler for the specified signal returning the old handler . Behaves similarly to " sigset " but restarts system calls when possible .
static handler_t *
Signal(int signum, handler_t *handler) 
{
	struct sigaction action, old_action;
	action.sa_handler = handler;  
	sigemptyset(&action.sa_mask); 
	action.sa_flags = SA_RESTART; 
	if (sigaction(signum, &action, &old_action) < 0)
		unix_error("Signal error");
	return (old_action.sa_handler);
}
static handler_t * Signal ( int signum , handler_t * handler ) { struct sigaction action , old_action ; action . sa_handler = handler ; sigemptyset ( & action . sa_mask ) ; action . sa_flags = SA_RESTART ; if ( sigaction ( signum , & action , & old_action ) < 0 ) unix_error ( " " ) ; return ( old_action . sa_handler ) ; }
Requires:
   "signum" is a valid signal number, and "handler" is a valid signal
   handler.
Requires : " signum " is a valid signal number and " handler " is a valid signal handler .
// Block sigs of type being handled. // Restart syscalls if possible.