1 /* Compiler options: 2 #notarget: cris*-*-elf 3 #cc: additional_flags=-pthread 4 #xerror: 5 #output: Unimplemented rt_sigprocmask syscall (0x3, 0x0, 0x3dff*\n 6 #output: program stopped with signal 4 (*).\n 7 8 Testing a signal handler corner case. */ 9 10 #include <stddef.h> 11 #include <stdlib.h> 12 #include <stdio.h> 13 #include <unistd.h> 14 #include <signal.h> 15 #include <pthread.h> 16 #include <errno.h> 17 18 static void * process(void * arg)19process (void *arg) 20 { 21 while (1) 22 sched_yield (); 23 return NULL; 24 } 25 26 int main(void)27main (void) 28 { 29 int retcode; 30 pthread_t th_a; 31 void *retval; 32 sigset_t sigs; 33 34 if (sigemptyset (&sigs) != 0) 35 abort (); 36 37 retcode = pthread_create (&th_a, NULL, process, NULL); 38 if (retcode != 0) 39 abort (); 40 41 /* An invalid parameter 1 should cause this to halt the simulator. */ 42 retcode 43 = pthread_sigmask (SIG_BLOCK + SIG_UNBLOCK + SIG_SETMASK, NULL, &sigs); 44 /* Direct return of the error number; i.e. not using -1 and errno, 45 is the actual documented behavior. */ 46 if (retcode == ENOSYS) 47 printf ("ENOSYS\n"); 48 49 printf ("xyzzy\n"); 50 return 0; 51 } 52