Avoid usage of LONG_BIT in signal headers.
Clang has its own limits.h which is ahead of ours on the inclusion path. This header uses include_next to include our header, but only in hosted mode. This means that in freestanding mode we don't get our limits.h macro definitions, including LONG_BIT. This ends up causing our signal.h to produce errors when included in freestanding mode on 32-bit platforms. Fix the errors by replacing usage of LONG_BIT with (8 * sizeof(long)) in the signal headers. Change-Id: I18ec7b6876d5f862beae09f0c011128eef97c869
This commit is contained in:
parent
acd91c22e9
commit
08b968b282
|
@ -89,7 +89,7 @@ static __inline int sigismember(const sigset_t *set, int signum) {
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return (int)((local_set[bit / LONG_BIT] >> (bit % LONG_BIT)) & 1);
|
||||
return (int)((local_set[bit / (8 * sizeof(long))] >> (bit % (8 * sizeof(long)))) & 1);
|
||||
}
|
||||
|
||||
static __inline int sigaddset(sigset_t *set, int signum) {
|
||||
|
@ -100,7 +100,7 @@ static __inline int sigaddset(sigset_t *set, int signum) {
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
local_set[bit / LONG_BIT] |= 1UL << (bit % LONG_BIT);
|
||||
local_set[bit / (8 * sizeof(long))] |= 1UL << (bit % (8 * sizeof(long)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ static __inline int sigdelset(sigset_t *set, int signum) {
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
local_set[bit / LONG_BIT] &= ~(1UL << (bit % LONG_BIT));
|
||||
local_set[bit / (8 * sizeof(long))] &= ~(1UL << (bit % (8 * sizeof(long))));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef __sighandler_t sighandler_t; /* glibc compatibility. */
|
|||
#if defined(__LP64__)
|
||||
typedef sigset_t sigset64_t;
|
||||
#else
|
||||
typedef struct { unsigned long __bits[_KERNEL__NSIG/LONG_BIT]; } sigset64_t;
|
||||
typedef struct { unsigned long __bits[_KERNEL__NSIG/(8*sizeof(long))]; } sigset64_t;
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__)
|
||||
|
|
Loading…
Reference in New Issue