[Patch] Signal mask handling

Pierre A. Humblet pierre@phumblet.no-ip.org
Fri Mar 12 03:12:00 GMT 2004


At 09:37 PM 3/11/2004 -0500, you wrote:
>On Thu, Mar 11, 2004 at 09:04:05PM -0500, Pierre A. Humblet wrote:

>>>>BTW I noticed that Posix and Cygwin diverge on sigpause.
>>>>
>>>>Posix:
>>>>int sigpause(int sig);
>>>>The sigpause() function removes sig from the calling process' signal
>>>>mask and suspends the calling process until a signal is received.  The
>>>>sigpause() function restores the process' signal mask to its original
>>>>state before returning.
>>>>
>>>>Cygwin
>>>>sigpause (int signal_mask)
>>>>{
>>>>  return handle_sigsuspend ((sigset_t) signal_mask);
>>>>}
>>>
>>>Sorry, but I don't see any divergence.  A reading of the above might
>>>seem to indicate that sigpause should return on the receipt of any
>>>signal but I notice that on linux (and one other UNIX that I tested this
>>>on) sigpause only returns on the receipt of a signal that has a handler
>>>associated with it.  This makes sigpause equivalent to sigsuspend,
>>>AFAICT.
>>
>>What I find strange is that usually sig is an integer (1-32), not a mask.
>>Compare the two following lines are from the same Posix page
>>void (*sigset(int sig, void (*disp)(int)))(int);   <= clearly an integer
>>int sigpause(int sig);  <= a mask???
>
>It's a mask, yes.  I guess the only difference is that sigset_t is an
>unsigned long on cygwin rather than an int.

After some googling, it looks like BSD and System V differ
http://world.std.com/~jimf/papers/signals/signals.html
"Note that sigpause() conflicts with the BSD function of the same name"

Posix knows the difference between an "int" and a "sigset_t". For some
reason it's not following BSD.
I point to this as a curiosity, I don't care about the outcome.

Pierre



More information about the Cygwin-patches mailing list