Subject: CVS commit: src/sys
To: None <source-changes@NetBSD.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: source-changes
Date: 12/24/2003 22:53:59
Module Name:	src
Committed By:	manu
Date:		Wed Dec 24 22:53:59 UTC 2003

Modified Files:
	src/sys/compat/darwin: darwin_exec.c darwin_signal.c darwin_signal.h
	src/sys/kern: kern_sig.c
	src/sys/sys: proc.h

Log Message:
Move the sigfilter hook to a more adequate location, and rename it to better
fit what it does.

The softsignal feature is used in Darwin to trace processes. When the
traced process gets a signal, this raises an exception. The debugger will
receive the exception message, use ptrace with PT_THUPDATE to pass the
signal to the child or discard it, and then it will send a reply to the
exception message, to resume the child.

With the hook at the beginnng of kpsignal2, we are in the context of the
signal sender, which can be the kill(1) command, for instance. We cannot
afford to sleep until the debugger tells us if the signal should be
delivered or not.

Therefore, the hook to generate the Mach exception must be in the traced
process context. That was we can sleep awaiting for the debugger opinion
about the signal, this is not a problem. The hook is hence located into
issignal, at the place where normally SIGCHILD is sent to the debugger,
whereas the traced process is stopped. If the hook returns 0, we bypass
thoses operations, the Mach exception mecanism will take care of notifying
the debugger (through a Mach exception), and stop the faulting thread.


To generate a diff of this commit:
cvs rdiff -r1.32 -r1.33 src/sys/compat/darwin/darwin_exec.c
cvs rdiff -r1.14 -r1.15 src/sys/compat/darwin/darwin_signal.c
cvs rdiff -r1.11 -r1.12 src/sys/compat/darwin/darwin_signal.h
cvs rdiff -r1.183 -r1.184 src/sys/kern/kern_sig.c
cvs rdiff -r1.184 -r1.185 src/sys/sys/proc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.