equal
deleted
inserted
replaced
1 /** |
1 /** |
2 * $Id: signals.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $ |
2 * test/demos/signals.c |
3 * $Source: /development/c/demos/signals.c,v $ |
3 * Copyright (C) 2008 Markus Broeker |
4 * |
|
5 */ |
4 */ |
6 |
5 |
7 #ifndef _XOPEN_SOURCE |
6 #ifndef _XOPEN_SOURCE |
8 #define _XOPEN_SOURCE 500 |
7 #define _XOPEN_SOURCE 500 |
9 #endif |
8 #endif |
20 |
19 |
21 void sigquit () |
20 void sigquit () |
22 { |
21 { |
23 printf ("I received the SIGQUIT Signal\n"); |
22 printf ("I received the SIGQUIT Signal\n"); |
24 /* |
23 /* |
25 * This kills the process and subprocesses |
24 * 0 kills every process in the current process group |
|
25 * -1 kills all reachable user processes (dangerous, logout) |
26 */ |
26 */ |
27 kill (-1, SIGKILL); |
27 kill (0, SIGKILL); |
28 /* |
|
29 * ^^ can not be reached |
|
30 */ |
|
31 exit (0); |
|
32 } |
28 } |
33 |
29 |
34 int main (int argc, char **argv) |
30 int main (int argc, char **argv) |
35 { |
31 { |
36 signal (SIGINT, sigproc); |
32 signal (SIGINT, sigproc); |