blob: e1f4359bc1a4bc5cc70a394bedd2670c71c9a1d9 [file] [log] [blame]
nethercote7fbe08a2004-11-15 19:03:27 +00001
2#include <signal.h>
3#include <stdio.h>
4#include <sys/syscall.h>
5#include <unistd.h>
6
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().
9
10int main(void)
11{
tom42d63672005-11-02 15:46:07 +000012 int x[6], *s, *os, i;
sewardj1c398002005-03-23 13:09:55 +000013
sewardj1c398002005-03-23 13:09:55 +000014#ifdef __NR_sigprocmask
nethercote7fbe08a2004-11-15 19:03:27 +000015
16 x[0] = 0x11111111;
17 x[1] = 0x89abcdef;
18 x[2] = 0x22222222;
19 x[3] = 0x33333333;
20 x[4] = 0x0;
21 x[5] = 0x44444444;
22
23 s = &x[1];
24 os = &x[4];
25
thughes89c33d22004-11-16 12:09:43 +000026 // Make sure the system is in a known state with no signals
27 // blocked as perl has been known to leave some signals blocked
28 // when starting child processes which can cause failures in
29 // this test unless we reset things here.
tom42d63672005-11-02 15:46:07 +000030 syscall(__NR_sigprocmask, SIG_SETMASK, os, NULL);
thughes89c33d22004-11-16 12:09:43 +000031
nethercote7fbe08a2004-11-15 19:03:27 +000032 fprintf(stderr, "before\n");
33 for (i = 0; i < 6; i++) {
34 fprintf(stderr, "%x ", x[i]);
35 }
36 fprintf(stderr, "\n");
37
tom42d63672005-11-02 15:46:07 +000038 syscall(__NR_sigprocmask, SIG_BLOCK, s, os);
nethercote7fbe08a2004-11-15 19:03:27 +000039
40 fprintf(stderr, "after1\n");
41 for (i = 0; i < 6; i++) {
42 fprintf(stderr, "%x ", x[i]);
43 }
44 fprintf(stderr, "\n");
45
tom42d63672005-11-02 15:46:07 +000046 syscall(__NR_sigprocmask, SIG_BLOCK, s, os);
nethercote7fbe08a2004-11-15 19:03:27 +000047
48 fprintf(stderr, "after2\n");
49 for (i = 0; i < 6; i++) {
50 fprintf(stderr, "%x ", x[i]);
51 }
52 fprintf(stderr, "\n");
tom42d63672005-11-02 15:46:07 +000053
54#else
55
56 fprintf(stderr, "__NR_sigprocmask not supported on this platform\n");
57
58#endif
59
nethercote7fbe08a2004-11-15 19:03:27 +000060 return(0);
61}