sigprocmask.c revision 7fbe08a08ea369c3c805280a3260edf5c68dc3ae
1 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{ 12 int x[6], *s, *os, i; 13 14 x[0] = 0x11111111; 15 x[1] = 0x89abcdef; 16 x[2] = 0x22222222; 17 x[3] = 0x33333333; 18 x[4] = 0x0; 19 x[5] = 0x44444444; 20 21 s = &x[1]; 22 os = &x[4]; 23 24 fprintf(stderr, "before\n"); 25 for (i = 0; i < 6; i++) { 26 fprintf(stderr, "%x ", x[i]); 27 } 28 fprintf(stderr, "\n"); 29 30 syscall(__NR_sigprocmask, SIG_BLOCK, s, os); 31 32 fprintf(stderr, "after1\n"); 33 for (i = 0; i < 6; i++) { 34 fprintf(stderr, "%x ", x[i]); 35 } 36 fprintf(stderr, "\n"); 37 38 syscall(__NR_sigprocmask, SIG_BLOCK, s, os); 39 40 fprintf(stderr, "after2\n"); 41 for (i = 0; i < 6; i++) { 42 fprintf(stderr, "%x ", x[i]); 43 } 44 fprintf(stderr, "\n"); 45 46 return(0); 47} 48