Created
December 5, 2013 21:24
-
-
Save stumped2/7814178 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void signalHandler(int signum, siginfo_t *info, void *ptr) | |
{ | |
int status, i; | |
for (i = 0; i < processes; i++) { | |
kill(pidfor_signal[i], SIGKILL); | |
wait(&status); | |
} | |
exit(EXIT_FAILURE); | |
} | |
int main(int argc, char *argv[]) { | |
/* Setting up signal handling */ | |
//fprintf(stderr, "setting up signal\n"); | |
memset(&act, 0, sizeof(act)); | |
act.sa_sigaction = signalHandler; | |
act.sa_flags = SA_SIGINFO; | |
sigaction(SIGINT, &act, NULL ); | |
sigaction(SIGQUIT, &act, NULL ); | |
sigaction(SIGHUP, &act, NULL ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment