From 32a96e84e1a7fca856965da70da36e454d623bb8 Mon Sep 17 00:00:00 2001 From: Marco S Hyman Date: Mon, 21 Oct 2002 18:50:18 +0000 Subject: Clean up the siginfo test. pthreads siginfo delivery code still being tested. --- regress/lib/libc_r/siginfo/siginfo.c | 19 ++++++++++++++----- regress/lib/libpthread/siginfo/siginfo.c | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'regress/lib') diff --git a/regress/lib/libc_r/siginfo/siginfo.c b/regress/lib/libc_r/siginfo/siginfo.c index ab817a49d3b..f12a666d5c3 100644 --- a/regress/lib/libc_r/siginfo/siginfo.c +++ b/regress/lib/libc_r/siginfo/siginfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo.c,v 1.5 2002/10/12 03:37:45 marc Exp $ */ +/* $OpenBSD: siginfo.c,v 1.6 2002/10/21 18:50:17 marc Exp $ */ /* PUBLIC DOMAIN Oct 2002 */ /* @@ -8,19 +8,28 @@ #include #include +#include #include "test.h" +#define BOGUS (char *)0x987230 + void act_handler(int signal, siginfo_t *siginfo, void *context) { struct sigaction sa; + char * str; CHECKe(sigaction(SIGSEGV, NULL, &sa)); ASSERT(sa.sa_handler == SIG_DFL); ASSERT(siginfo != NULL); - ASSERT(siginfo->si_addr == (char *) 0x987234 && + asprintf(&str, "act_handler: signal %d, siginfo 0x%p, context 0x%p\n" + "addr 0x%p, code %d, trap %d\n", signal, siginfo, context, + siginfo->si_addr, siginfo->si_code, siginfo->si_trapno); + write(STDOUT_FILENO, str, strlen(str)); + ASSERT(siginfo->si_addr == BOGUS && siginfo->si_code == 1 && siginfo->si_trapno == 2); + SUCCEED; } int @@ -30,8 +39,8 @@ main(int argc, char **argv) act.sa_sigaction = act_handler; sigemptyset(&act.sa_mask); - act.sa_flags = SA_SIGINFO | SA_RESETHAND; + act.sa_flags = SA_SIGINFO | SA_RESETHAND | SA_NODEFER; CHECKe(sigaction(SIGSEGV, &act, NULL)); - *(char *) 0x987234 = 1; - SUCCEED; + *BOGUS = 1; + PANIC("How did we get here?"); } diff --git a/regress/lib/libpthread/siginfo/siginfo.c b/regress/lib/libpthread/siginfo/siginfo.c index ab817a49d3b..f12a666d5c3 100644 --- a/regress/lib/libpthread/siginfo/siginfo.c +++ b/regress/lib/libpthread/siginfo/siginfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo.c,v 1.5 2002/10/12 03:37:45 marc Exp $ */ +/* $OpenBSD: siginfo.c,v 1.6 2002/10/21 18:50:17 marc Exp $ */ /* PUBLIC DOMAIN Oct 2002 */ /* @@ -8,19 +8,28 @@ #include #include +#include #include "test.h" +#define BOGUS (char *)0x987230 + void act_handler(int signal, siginfo_t *siginfo, void *context) { struct sigaction sa; + char * str; CHECKe(sigaction(SIGSEGV, NULL, &sa)); ASSERT(sa.sa_handler == SIG_DFL); ASSERT(siginfo != NULL); - ASSERT(siginfo->si_addr == (char *) 0x987234 && + asprintf(&str, "act_handler: signal %d, siginfo 0x%p, context 0x%p\n" + "addr 0x%p, code %d, trap %d\n", signal, siginfo, context, + siginfo->si_addr, siginfo->si_code, siginfo->si_trapno); + write(STDOUT_FILENO, str, strlen(str)); + ASSERT(siginfo->si_addr == BOGUS && siginfo->si_code == 1 && siginfo->si_trapno == 2); + SUCCEED; } int @@ -30,8 +39,8 @@ main(int argc, char **argv) act.sa_sigaction = act_handler; sigemptyset(&act.sa_mask); - act.sa_flags = SA_SIGINFO | SA_RESETHAND; + act.sa_flags = SA_SIGINFO | SA_RESETHAND | SA_NODEFER; CHECKe(sigaction(SIGSEGV, &act, NULL)); - *(char *) 0x987234 = 1; - SUCCEED; + *BOGUS = 1; + PANIC("How did we get here?"); } -- cgit v1.2.3