summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2002-10-21 18:50:18 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2002-10-21 18:50:18 +0000
commit32a96e84e1a7fca856965da70da36e454d623bb8 (patch)
treea2a79c6c42c0f5994b13858479bbdbb789c1995e /regress/lib
parentdc2f6135ea6ba0dcdef23e8ba551f5e962aec667 (diff)
Clean up the siginfo test. pthreads siginfo delivery code still
being tested.
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libc_r/siginfo/siginfo.c19
-rw-r--r--regress/lib/libpthread/siginfo/siginfo.c19
2 files changed, 28 insertions, 10 deletions
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 <marc@snafu.org> */
/*
@@ -8,19 +8,28 @@
#include <signal.h>
#include <stdio.h>
+#include <unistd.h>
#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 <marc@snafu.org> */
/*
@@ -8,19 +8,28 @@
#include <signal.h>
#include <stdio.h>
+#include <unistd.h>
#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?");
}