1 #include <signal.h> 2 siginterrupt(int sig,int flag)3 int siginterrupt(int sig, int flag) 4 { 5 struct sigaction sa; 6 7 sigaction(sig, 0, &sa); 8 if (flag) sa.sa_flags &= ~SA_RESTART; 9 else sa.sa_flags |= SA_RESTART; 10 11 return sigaction(sig, &sa, 0); 12 } 13