Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame^] | 1 | Handle __cpu_mask usage |
| 2 | |
| 3 | Fixes errors: |
| 4 | |
| 5 | src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function) |
| 6 | src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function) |
| 7 | |
| 8 | __cpu_mask is an internal type of glibc's cpu_set implementation, not |
| 9 | part of the POSIX definition, which is problematic when building with |
| 10 | musl, which does not define a matching type. From inspection of musl's |
| 11 | sched.h, however, it is clear that the corresponding type would be |
| 12 | unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So, |
| 13 | add a typedef to cpu-set-util.h defining __cpu_mask appropriately. |
| 14 | |
| 15 | Upstream-Status: Inappropriate [musl specific] |
| 16 | |
| 17 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> |
| 18 | --- |
| 19 | src/shared/cpu-set-util.h | 2 ++ |
| 20 | src/test/test-sizeof.c | 2 +- |
| 21 | 2 files changed, 3 insertions(+), 1 deletion(-) |
| 22 | |
| 23 | diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h |
| 24 | index 27812dfd59..f698f9df83 100644 |
| 25 | --- a/src/shared/cpu-set-util.h |
| 26 | +++ b/src/shared/cpu-set-util.h |
| 27 | @@ -6,6 +6,8 @@ |
| 28 | #include "macro.h" |
| 29 | #include "missing_syscall.h" |
| 30 | |
| 31 | +typedef unsigned long __cpu_mask; |
| 32 | + |
| 33 | /* This wraps the libc interface with a variable to keep the allocated size. */ |
| 34 | typedef struct CPUSet { |
| 35 | cpu_set_t *set; |
| 36 | diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c |
| 37 | index a710db5370..d1601ad929 100644 |
| 38 | --- a/src/test/test-sizeof.c |
| 39 | +++ b/src/test/test-sizeof.c |
| 40 | @@ -1,6 +1,5 @@ |
| 41 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
| 42 | |
| 43 | -#include <sched.h> |
| 44 | #include <stdio.h> |
| 45 | #include <string.h> |
| 46 | |
| 47 | @@ -8,6 +7,7 @@ |
| 48 | #include <float.h> |
| 49 | |
| 50 | #include "time-util.h" |
| 51 | +#include "cpu-set-util.h" |
| 52 | |
| 53 | /* Print information about various types. Useful when diagnosing |
| 54 | * gcc diagnostics on an unfamiliar architecture. */ |