Ticket #13139: killer.c
| File killer.c, 465 bytes (added by , 5 years ago) | 
|---|
| Line | |
|---|---|
| 1 | // gcc killer.c -o killer | 
| 2 | #include <sys/resource.h> | 
| 3 | #include <sys/time.h> | 
| 4 | #include <sys/types.h> | 
| 5 | #include <signal.h> | 
| 6 | #include <stdlib.h> | 
| 7 | #include <unistd.h> | 
| 8 | |
| 9 | int main(int argc, char **argv) { | 
| 10 | // avoid coredumping. | 
| 11 | struct rlimit core_limit; | 
| 12 | int res = getrlimit(RLIMIT_CORE, &core_limit); | 
| 13 | if ( 0 == res ) { | 
| 14 | core_limit.rlim_cur = 0; | 
| 15 | setrlimit(RLIMIT_CORE, &core_limit); | 
| 16 | } | 
| 17 | |
| 18 | for ( int i = 1; i < argc; ++i ) { | 
| 19 | kill(getpid(), atoi(argv[i])); | 
| 20 | } | 
| 21 | return 0; | 
| 22 | } | 
| 23 | 

