Subject: psignal() and COMPAT_MACH exceptions
To: Jaromir Dolecek <jdolecek@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 11/29/2003 15:42:46
I came the following ideas, but it is not yet complete. Any input is
apreciated.

All Darwin or Mach processes get their signal masks sets so that any
ignorable signal is ignored: everything except SIGKILL and SIGSTOP.

In darwin_emuldata, I maintain another signal mask, which will be
manipulated by the process with sigsetmask.

For each Darwin or Mach processes, I install a kqueue listener that will
be notified if any signal is sent by psignal(). This function will check
for exception ports ready to catch the exception, ane eventually call
mach_exception() do do the job. 

For Darwin processes when no exception may be send, the kqueue listener
will check for the alternate signal mask in darwin_emuldata, and
eventually send a signal. 

Problem: I cannot recall psignal() from the kqueue listener, as the
signal is masked by the real signal mask. I cannot unmask it
temporarily, as other lwp may fall in this hole if the current lwp comes
to sleep. 

Additionnaly, I would have to duplicate all trapsignal and do
mach_trapsignal to suppress the signal mask checks there too.

This is rather complicated!
  
-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@netbsd.org