Reliable Singal question - Unix

This is a discussion on Reliable Singal question - Unix ; The following question stems from page 329 in book "Advanced Programming in the Unix Environment" by Stevens and Rago. Near the top, they say "Note that we must use sigemptyset to initialize the sa_mask member of the structure. We're not ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Reliable Singal question

  1. Reliable Singal question

    The following question stems from page 329 in book "Advanced
    Programming in the Unix Environment" by Stevens and Rago.

    Near the top, they say

    "Note that we must use sigemptyset to initialize the sa_mask member of
    the structure. We're not guaranteed that
    act.sa_mask = 0;
    does the same thing"

    The question is why wouldn't act.sa_mask =0 do the same thing as
    sigemptyset(&act.sa.mask) ?

  2. Re: Reliable Singal question

    K-mart Cashier wrote:
    > The following question stems from page 329 in book "Advanced
    > Programming in the Unix Environment" by Stevens and Rago.
    >
    > Near the top, they say
    >
    > "Note that we must use sigemptyset to initialize the sa_mask member of
    > the structure. We're not guaranteed that
    > act.sa_mask = 0;
    > does the same thing"
    >
    > The question is why wouldn't act.sa_mask =0 do the same thing as
    > sigemptyset(&act.sa.mask) ?


    In POSIX, the type of sa_mask is specified as sigset_t, and the primitive
    type could be an integer or a complex type, like a structure containing an
    array. If its an integer, then setting it w/ an integral constant will work.
    On the other hand, such an assignment is not portable, at least not to any
    interesting implementations which might support more than 32 or 64 signals.

    SUSv3 defines ~28 standard, mandatory signals, and the minimum number of
    real-time signals which must be available (if supporting that extension) is
    8 (_POSIX_RTSIG_MAX). As a practical matter, that means conforming
    implementions on a standard 32-bit architecture must define sigset_t as an
    array.

    I believe that, generally speaking, BSD derived systems commonly use an
    integer, while SysV oriented implementations (including Linux) will use an
    array.


+ Reply to Thread