Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/usr/utils/kill.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (hide annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 478 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 niro 532 #include <stdio.h>
2     #include <stdlib.h>
3     #include <signal.h>
4     #include <string.h>
5    
6     char *progname;
7    
8     static __noreturn usage(void)
9     {
10     fprintf(stderr, "Usage: %s pid\n", progname);
11     exit(1);
12     }
13     int main(int argc, char *argv[], char *envp[])
14     {
15     long pid;
16     char *endp;
17    
18     progname = argv[0];
19     if (argc != 2)
20     usage();
21    
22     pid = strtol(argv[1], &endp, 10);
23     if (*endp != '\0') {
24     perror("pid");
25     usage();
26     }
27    
28     if (kill(pid, SIGTERM) == -1) {
29     perror("kill");
30     exit(-1);
31     }
32     exit(0);
33     }