From: Mark W. Eichin (eichin@athena.mit.edu)
Date: 10/21/92


From: eichin@athena.mit.edu (Mark W. Eichin)
Subject: Re: sigmask bug in /usr/include/signal.h (SLS 0.98, wherever it got it from)
Date: Thu, 22 Oct 1992 00:08:45 GMT


>> How about
>> #define __sigmask(sig) (((sig) > 32 || (sig) < 1) ? 0 : (1 << ((sig) - 1)))

Oh, right, sig can go from 1..32 not 0..31. Sure, that's fine. (Does
Linus release /usr/include with the kernel, or is that someone else's
"project"?)

>>I would call it a bug in CVS. How do you handle __sigmask(0) or __sigmask(-2)?
        The actual code in CVS is (lib/sighandle.c, in SIG_init()):
        int i;
#ifdef POSIX
        sigset_t sigset_test;
#endif
...
#ifdef POSIX
        (void) sigfillset(&sigset_test);
        for (i = 1; sigismember(&sigset_test, i) == 1; i++)
                ;
        if (i < SIGMAX)
                i = SIGMAX;
        i++;
so cases below 1 don't matter. (The code is trying to figure out how
much space it needs to store an array of all signal handlers. I don't
think it is incorrect... it just breaks because sigismember(&xx, i)
for i > 32 is returning meaningless results.) According to Lewine's
POSIX book, sigismember returns 1 for yes, 0 for no, and -1 for error
(EINVAL); it is supposed to be "a portable way to support more than 32
signals".
>> You can change it to look for /usr/bin/diff.
        I could, if I were to recompile it (I haven't downloaded
sources yet...) If I make a package out of this, I probably should
include a new diff3 in the package. However, since diff3 is included
as part of SLS, I'd rather just see it fixed in SLS...

                                _Mark_ <eichin@athena.mit.edu>
                                MIT Student Information Processing Board
                                Cygnus Support <eichin@cygnus.com>