X-Git-Url: http://nsz.repo.hu/git/?p=libc-test;a=blobdiff_plain;f=src%2Fregression%2Fsigaltstack.c;h=bfdc44ac92650f956e5ee6d6df3c334fae91857c;hp=f4ed470ca4d43a20d3ace91e48bdf5326f7cf759;hb=4b38634cfb3439b1f9c586286f9e92ea913adff1;hpb=3b23f5217267dcac2351d11a9d866dff8716d7e6 diff --git a/src/regression/sigaltstack.c b/src/regression/sigaltstack.c index f4ed470..bfdc44a 100644 --- a/src/regression/sigaltstack.c +++ b/src/regression/sigaltstack.c @@ -4,7 +4,7 @@ // mips stack_t is inconsistent with other archs #define _XOPEN_SOURCE 700 #include -#include +#include #include #include #include @@ -13,19 +13,12 @@ #define T(f) ((f)==0 || (t_error(#f " failed: %s\n", strerror(errno)),0)) static char stack[SIGSTKSZ]; -static sigjmp_buf sbuf; -static volatile sig_atomic_t state; static void handler(int sig) { uintptr_t i; stack_t ss; - if (state!=1) - t_error("handler is not invoked in fillstack (after sigsetjmp returned 0), " - "state is %d, want 1\n", state); - state++; - i = (uintptr_t)&i; if (i < (uintptr_t)stack || i >= (uintptr_t)stack+SIGSTKSZ) t_error("signal handler was not invoked on the altstack\n"); @@ -33,18 +26,6 @@ static void handler(int sig) T(sigaltstack(0, &ss)); if (ss.ss_flags != SS_ONSTACK) t_error("ss_flags is not SS_ONSTACK in the signal handler\n"); - - siglongjmp(sbuf, 1); -} - -static unsigned fillstack(unsigned x) -{ - x++; - if (x==0) { - t_error("wrap around\n"); - return x; - } - return fillstack(fillstack(x)) + 1; } int main(void) @@ -60,15 +41,8 @@ int main(void) T(sigaltstack(&ss, 0)); T(sigfillset(&sa.sa_mask)); - T(sigaction(SIGSEGV, &sa, 0)); - if (sigsetjmp(sbuf,0) == 0) { - state++; - fillstack(0); - t_error("infinite recursion finished\n"); - } - if (state != 2) - t_error("sigsetjmp returned non-zero before running handler, " - "state is %d, want 2\n", state); + T(sigaction(SIGUSR1, &sa, 0)); + T(raise(SIGUSR1)); errno = 0; ss.ss_size = MINSIGSTKSZ-1;