tests/vg_regtest: Always evaluate prerequisite expressions with sh
[valgrind.git] / memcheck / tests / sigprocmask.c
blobebb788e109e9eb75ad8f827f1d675291651e84bc
2 #include <signal.h>
3 #include <stdio.h>
4 #include <sys/syscall.h>
5 #include <unistd.h>
7 // Reg test for bug #93328: we were using too-big sigset types, and thus
8 // trashing memory when we wrote out the 'oldset' param from sigprocmask().
10 int main(void)
12 #if defined(__NR_sigprocmask) \
13 && !defined(__powerpc64__) \
14 && !defined(__s390x__) \
15 && !defined(__arm__)
17 // arm-linux uses rt_sigprocmask, so no sigset mangling takes place
19 int x[6], *s, *os, i;
21 x[0] = 0x11111111;
22 x[1] = 0x89abcdef;
23 x[2] = 0x22222222;
24 x[3] = 0x33333333;
25 x[4] = 0x0;
26 x[5] = 0x44444444;
28 s = &x[1];
29 os = &x[4];
31 // Make sure the system is in a known state with no signals
32 // blocked as perl has been known to leave some signals blocked
33 // when starting child processes which can cause failures in
34 // this test unless we reset things here.
35 syscall(__NR_sigprocmask, SIG_SETMASK, os, NULL);
37 fprintf(stderr, "before\n");
38 for (i = 0; i < 6; i++) {
39 fprintf(stderr, "%x ", x[i]);
41 fprintf(stderr, "\n");
43 syscall(__NR_sigprocmask, SIG_BLOCK, s, os);
45 fprintf(stderr, "after1\n");
46 for (i = 0; i < 6; i++) {
47 fprintf(stderr, "%x ", x[i]);
49 fprintf(stderr, "\n");
51 syscall(__NR_sigprocmask, SIG_BLOCK, s, os);
53 fprintf(stderr, "after2\n");
54 for (i = 0; i < 6; i++) {
55 fprintf(stderr, "%x ", x[i]);
57 fprintf(stderr, "\n");
59 #else
61 fprintf(stderr, "__NR_sigprocmask not supported on this platform\n");
63 #endif
65 return(0);