* commit 'e84cfbefd82f552490c580d35a54db4f53b6e5fb': update signal.h to be C90 compatable
This commit is contained in:
commit
b166e699dc
@ -59,32 +59,32 @@ extern const char* const sys_signame[];
|
|||||||
|
|
||||||
static __inline__ int sigismember(const sigset_t* set, int signum) {
|
static __inline__ int sigismember(const sigset_t* set, int signum) {
|
||||||
int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
|
int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
|
||||||
|
const unsigned long* local_set = (const unsigned long*) set;
|
||||||
if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
|
if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const unsigned long* local_set = (const unsigned long*) set;
|
|
||||||
return (int) ((local_set[bit / LONG_BIT] >> (bit % LONG_BIT)) & 1);
|
return (int) ((local_set[bit / LONG_BIT] >> (bit % LONG_BIT)) & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int sigaddset(sigset_t* set, int signum) {
|
static __inline__ int sigaddset(sigset_t* set, int signum) {
|
||||||
int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
|
int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
|
||||||
|
unsigned long* local_set = (unsigned long*) set;
|
||||||
if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
|
if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unsigned long* local_set = (unsigned long*) set;
|
|
||||||
local_set[bit / LONG_BIT] |= 1UL << (bit % LONG_BIT);
|
local_set[bit / LONG_BIT] |= 1UL << (bit % LONG_BIT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int sigdelset(sigset_t* set, int signum) {
|
static __inline__ int sigdelset(sigset_t* set, int signum) {
|
||||||
int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
|
int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
|
||||||
|
unsigned long* local_set = (unsigned long*) set;
|
||||||
if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
|
if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unsigned long* local_set = (unsigned long*) set;
|
|
||||||
local_set[bit / LONG_BIT] &= ~(1UL << (bit % LONG_BIT));
|
local_set[bit / LONG_BIT] &= ~(1UL << (bit % LONG_BIT));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user