Il 17/02/2014 17:49, Markus Armbruster ha scritto:
Assumes zero-initialization has the same effect as
sigemptyset(&sigact.sa_mask). Quoting POSIX:
The implementation of the sigemptyset() (or sigfillset()) function
could quite trivially clear (or set) all the bits in the signal set.
Alternatively, it would be reasonable to initialize part of the
structure, such as a version field, to permit binary-compatibility
between releases where the size of the set varies. For such
reasons, either sigemptyset() or sigfillset() must be called prior
to any other use of the signal set, even if such use is read-only
(for example, as an argument to sigpending()).
Looks like you better sigemptyset() here, for maximum portability.
Certainly memset of struct sigaction or sigset_t * is common enough that
no one in their right minds would do this. Is there really an OS that
does it? Also, the above justification is quite feeble; it would work
for binary compatibility of sigset_t* arguments, but not for embedded
sigset_t structs. I'm CCing our resident POSIX experts in hope that
this paragraph can be eliminated from the standard. :)
Related to this, there are a bunch of Coverity reports where we use
uninitialized fields of a struct sigaction.
Paolo