4.2BSD and Signals
Chris Torek
chris at umcp-cs.UUCP
Tue Jan 28 14:59:28 AEST 1986
> The man page for sig block says:
> Signal i is blocked if the i-th bit in mask is a 1.
> well, what they really want you to do is:
... sigblock(1 << (signun - 1))
There is no contradiction here. The first bit is bit 0; the 32nd
bit is bit 31; and the i'th bit is bit i-1. I agree that the manual
should be much more explicit. In 4.3, <signal.h> defines a macro
called `sigmask' which should be used when creating signal masks:
omask = sigblock(sigmask(SIGINT) | sigmask(SIGHUP));
...
(void) sigsetmask(omask);
Note that there really should be a `signal mask' type, too; `int'
enforces a maximum of 16 signals on some machines. Having a separate
type name would allow more than 32 signals, too. Maybe in 4.4....
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at mimsy.umd.edu
More information about the Comp.unix.wizards
mailing list