Subject: Re: SIGTRAP for traced processes and COMPAT_MACH
To: Jaromir Dolecek <>
From: Emmanuel Dreyfus <>
List: tech-kern
Date: 11/26/2003 09:58:18
Jaromir Dolecek <> wrote:

> > If I do this, I will not send Mach exceptions for masked signals, which
> > would not be an accurate emulation. 
> You mean that MacOS sends the trap exception to process even when
> the signal is blocked? Are you sure about that?

I'm not yet a Mach expert, but here is what I understood so far:

Mach exceptions have a different semantics than UNIX signals (Mach has
nothing to do with UNIX, remember). Each process has a vector of
exception ports (*). By defaults, these ports are undefined. If you set
a port in the exception vector, the process on the receive side of the
port will get the exceptions for the process in which you set the
exception port.

That way, exceptions can be enabled or not, but it is not done with the
signal mask.

Now, on Darwin, which is an hybrid system with both BSD and Mach
flavors, when an exception is not caught by the Mach exception system,
then a Unix signal is generated by the BSD part of the kernel. This
signal may be blocked by the signal mask, of course. 
> Another solution would be to hack something using EVFILT_SIGNAL
> kevent - signal kevents are generated even for blocked signals.

How would this work exactly? Would it be a worse hack than invoking
trapsignal() in sys_exec() to send SIGTRAP?

(*) Mach ports: theses are named queues on which Mach messages can be
sent or received. A port always has one receiver process, and it may
have multiple sender processes. They have nothing to do with TCP or UDP

Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.