x86-64: Don't use SSE resolvers for ISA level 3 or above
[glibc.git] / sysdeps / pthread / tst-signal5.c
blob3ad3eff9a081b56d6e182671e64c15eb0fe736ec
1 /* Copyright (C) 2003-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
18 #include <errno.h>
19 #include <pthread.h>
20 #include <signal.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <unistd.h>
25 #include <sys/mman.h>
26 #include <sys/wait.h>
29 static sigset_t ss;
32 static void *
33 tf (void *arg)
35 sigset_t ss2;
36 if (pthread_sigmask (SIG_SETMASK, NULL, &ss2) != 0)
38 puts ("child: sigmask failed");
39 exit (1);
42 int i;
43 for (i = 1; i < 32; ++i)
44 if (sigismember (&ss, i) && ! sigismember (&ss2, i))
46 printf ("signal %d set in parent mask, but not in child\n", i);
47 exit (1);
49 else if (! sigismember (&ss, i) && sigismember (&ss2, i))
51 printf ("signal %d set in child mask, but not in parent\n", i);
52 exit (1);
55 return NULL;
59 static int
60 do_test (void)
62 sigemptyset (&ss);
63 sigaddset (&ss, SIGUSR1);
64 if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
66 puts ("1st sigmask failed");
67 exit (1);
70 pthread_t th;
71 if (pthread_create (&th, NULL, tf, NULL) != 0)
73 puts ("1st create failed");
74 exit (1);
77 void *r;
78 if (pthread_join (th, &r) != 0)
80 puts ("1st join failed");
81 exit (1);
84 sigemptyset (&ss);
85 sigaddset (&ss, SIGUSR2);
86 sigaddset (&ss, SIGFPE);
87 if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
89 puts ("2nd sigmask failed");
90 exit (1);
93 if (pthread_create (&th, NULL, tf, NULL) != 0)
95 puts ("2nd create failed");
96 exit (1);
99 if (pthread_join (th, &r) != 0)
101 puts ("2nd join failed");
102 exit (1);
105 return 0;
108 #define TEST_FUNCTION do_test ()
109 #include "../test-skeleton.c"