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