Reputation:
I want to complement signal set in my program. there are only few bit operations API provided such as sigorset() sigandset()
Is there any API to find one's complement of signal set?
Upvotes: 0
Views: 200
Reputation: 54583
You likely are referring to sigsetops, which provides a few set-manipulation operations for signals. Only a few operations are provided, since each is intended to be used as a building block for more complicated operations.
POSIX specifies extensions for initializing signal sets to "filled" or "empty", i.e.,
Additionally, glibc adds its own extensions for logically ANDing and ORing sets. (As usual, there is a caveat about portability).
But perhaps overlooked are these POSIX extensions:
To get a one's complement of a given source operand, with these functions you would have to do something like this:
sigfillset
. Think of that as setting the value to all 1s.sigismember
to test if a given signal is present in that signal set.sigdelset
to remove it from the destination. Think of it as setting that bit to zero.In short, there is no predefined operation for one's complement, but you can make what you need from the existing POSIX extension functions.
Upvotes: 1