summaryrefslogtreecommitdiff
path: root/regress/lib/libc_r/siginfo/siginfo.c
blob: ab1fb62aac04b2c20970c259b7bd854b617f484d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* $OpenBSD: siginfo.c,v 1.1 2002/10/07 21:27:16 marc Exp $ */
/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */

/* test SA_SIGINFO support */

#include <assert.h>
#include <signal.h>
#include <stdio.h>

#include "test.h"

void
act_handler(int signal, siginfo_t *siginfo, void *context)
{
 	ASSERT(siginfo && siginfo->si_addr == (char *) 0x987234 &&
	       siginfo->si_code == 1 && siginfo->si_trapno == 2);
}
 
int
main(int argc, char **argv)
{
	struct sigaction act;

	act.sa_sigaction = act_handler;
	sigemptyset(&act.sa_mask);
	act.sa_flags = SA_SIGINFO;
	CHECKe(sigaction(SIGSEGV, &act, NULL));
	*(char *) 0x987234 = 1;
	SUCCEED;
}