1 /* Check that TRT happens for a signal sent to a non-existent process/thread, more than one thread.
2 #cc: additional_flags=-pthread
3 #notarget: cris*-*-elf
4 */
5 
6 #include <stdlib.h>
7 #include <stddef.h>
8 #include <stdio.h>
9 #include <unistd.h>
10 #include <pthread.h>
11 #include <sys/types.h>
12 #include <signal.h>
13 #include <errno.h>
14 
15 static void *
process(void * arg)16 process (void *arg)
17 {
18   int i;
19   for (i = 0; i < 100; i++)
20     sched_yield ();
21   return NULL;
22 }
23 
main(void)24 int main (void)
25 {
26   pthread_t th_a;
27   int retcode;
28   void *retval;
29 
30   if (pthread_create (&th_a, NULL, process, (void *) "a") != 0)
31     abort ();
32   if (kill (getpid () - 1, SIGBUS) != -1
33       || errno != ESRCH
34       || pthread_join (th_a, &retval) != 0)
35     abort ();
36   printf ("pass\n");
37   exit (0);
38 }
39