*BSD News Article 89740


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.mel.aone.net.au!grumpy.fl.net.au!news.webspan.net!newsfeeds.sol.net!newspump.sol.net!howland.erols.net!news.sprintlink.net!news-peer.sprintlink.net!news.sprintlink.net!news-hub.sprintlink.net!news.sprintlink.net!news-stk-3.sprintlink.net!news.rain.net!pacifier!deraadt
From: deraadt@theos.com (Theo de Raadt)
Newsgroups: comp.unix.bsd.netbsd.misc,comp.unix.bsd.freebsd.misc
Subject: Re: Object Oriented Databases for NetBSD/FreeBSD?
Date: 19 Feb 1997 20:14:10 GMT
Organization: Theo Ports Kernels For Fun And Profit
Lines: 49
Message-ID: <DERAADT.97Feb19131410@zeus.pacifier.com>
References: <5b58kv$2e1@gummo.bbb.sub.org> <5brbcr$724@trumpet.uni-mannheim.de>
	<5e9vkr$f84@fu-berlin.de> <5ee982$f4v@gummo.bbb.sub.org>
NNTP-Posting-Host: zeus.theos.com
In-reply-to: bertram@gummo.bbb.sub.org's message of 19 Feb 1997 08:14:10 +0100
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.netbsd.misc:5508 comp.unix.bsd.freebsd.misc:35827

In article <5ee982$f4v@gummo.bbb.sub.org> bertram@gummo.bbb.sub.org (Bertram Barth) writes:

   With some minor modifications I could compile it on Netbsd/i386 + gcc-2.7.2
   and on FreeBSD-2.1.6 + gcc-2.6.3, on FreeBSD it runs solid and works great!
   On NetBSD there are some problems since the signal-handler for SIGSEGV
   doesn't get access to the faulting address (yooda's support for smart 
   pointers to persistent object relies on this feature).
   With a patched kernel I was able to run it on NetBSD also, but not as
   stable as on FreeBSD (I didn't go deeper in that, since on FreeBSD it works).

Yeah, I know the hack you used. Heh.

What you really want is the POSIX 1003.1b (realtime) feature called
SA_SIGINFO.  If you have access to an SGI, Solaris, or OSF box, you
can check <sys/siginfo.h>.  If the SA_SIGINFO option is requested, a
signal handler will be passed a bunch more information about the
signal in question.

In the case of SIGSEGV, one added piece of info is the fault address..

Basically setup by..

        struct sigaction act;

        memset(&act, 0, sizeof act);
        act.sa_handler = sigsegv;
        sigemptyset(&act.sa_mask);
        act.sa_flags = SA_SIGINFO;
        return sigaction(SIGSEGV, &act, NULL);


Then later....
	
void
sigsegv(sig, sip, scp)
        int sig;
        siginfo_t *sip;
        struct sigcontext *scp;
{
	printf("Faulting at %p\n", sip->si_addr);

	....


We just recently added this feature to OpenBSD.  Getting it right on
all the processor families took quite a bit of work..
--
This space not left unintentionally unblank.		deraadt@theos.com
www.OpenBSD.org -- We're fixing security problems so you can sleep at night.