sigset_t newmask; struct sigaction sa; sa.sa_handler= handler; //handler is name of subroutine sigfillset(&sa.sa_mask); //set up to block all signals sigdelset(&sa.sa_mask, SIGPIPE); // allow SIGPIPE to interrupt handler // normally not done // allowing this is non-typical sa.sa_flags =0; sigaction(SIGUSR1, &sa, NULL);