Subject: Re: [Q] How to get faulted-upon address, hacks wanted
To: VaX#n8 <vax@ccwf.cc.utexas.edu>
From: Zdenek Salvet <salvet@muni.cz>
List: tech-kern
Date: 08/25/1995 08:42:51
Status: OR

Note that POSIX 1003.1B specifies what the arguments for a
signal handler should be.  The handler should be called as:

  void handler(int signum, siginfo_t *info, void *)

The third arg is traditionally the sigcontext_t pointer,
but its structure is not defined by the standard.

The second arg points to a siginfo_t which has:  (at least)

	int si_signo;
	int si_code;	/* SI_USER, SI_QUEUE, SI_TIMER, ... */
	union sigval si_value;
	/* may contain other info here. */

Several systems I looked at put the faulting address in si_value
when signaling faults for which that makes sense (i.e. SIGSEGV,
SIGBUS, SIGILL, SIGFPE).  Another trick I like is to set the
si_code member to something "useful" for faults, but normally
it should just contain what NetBSD now passes as the "code".

Let's standardize!
Gordon