Subject: Re: psignal() and COMPAT_MACH exceptions
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 11/30/2003 19:56:39
On Nov 29,  3:42pm, manu@netbsd.org (Emmanuel Dreyfus) wrote:
-- Subject: psignal() and COMPAT_MACH exceptions

Yes, I agree with you. I think it is far too complicated. I think that
the question about other cases of signals that need to be delivered as
exceptions while they are masked still remains.

christos

| 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
-- End of excerpt from Emmanuel Dreyfus