xref: /netbsd-src/external/gpl3/gdb/dist/sim/testsuite/cris/c/kill1.c (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
1*4b169a6bSchristos /* Basic kill functionality test; fail killing init.  Don't run as root.  */
2*4b169a6bSchristos #include <stdio.h>
3*4b169a6bSchristos #include <stdlib.h>
4*4b169a6bSchristos #include <errno.h>
5*4b169a6bSchristos #include <sys/types.h>
6*4b169a6bSchristos #include <signal.h>
7*4b169a6bSchristos int
main(void)8*4b169a6bSchristos main (void)
9*4b169a6bSchristos {
10*4b169a6bSchristos   if (kill (1, SIGTERM) != -1
11*4b169a6bSchristos       || errno != EPERM)
12*4b169a6bSchristos     {
13*4b169a6bSchristos       printf ("fail\n");
14*4b169a6bSchristos       exit (1);
15*4b169a6bSchristos     }
16*4b169a6bSchristos 
17*4b169a6bSchristos   errno = 0;
18*4b169a6bSchristos 
19*4b169a6bSchristos   if (kill (1, SIGABRT) != -1
20*4b169a6bSchristos       || errno != EPERM)
21*4b169a6bSchristos     {
22*4b169a6bSchristos       printf ("fail\n");
23*4b169a6bSchristos       exit (1);
24*4b169a6bSchristos     }
25*4b169a6bSchristos 
26*4b169a6bSchristos   errno = 0;
27*4b169a6bSchristos 
28*4b169a6bSchristos   printf ("pass\n");
29*4b169a6bSchristos   exit (0);
30*4b169a6bSchristos }
31