blob: d394444c1c6e99903df1eb271b0298661c128278 [file] [log] [blame]
Andrew Geissler706d5aa2021-02-12 15:55:30 -06001From dbe8b3ee45580defeefcac929b897c5437ffc50b Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Scott Murray <scott.murray@konsulko.com>
3Date: Fri, 13 Sep 2019 19:26:27 -0400
Andrew Geissler706d5aa2021-02-12 15:55:30 -06004Subject: [PATCH] Handle __cpu_mask usage
Brad Bishopa34c0302019-09-23 22:34:48 -04005
6Fixes errors:
7
8src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function)
9src/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
12part of the POSIX definition, which is problematic when building with
13musl, which does not define a matching type. From inspection of musl's
14sched.h, however, it is clear that the corresponding type would be
15unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So,
16add a typedef to cpu-set-util.h defining __cpu_mask appropriately.
17
18Upstream-Status: Inappropriate [musl specific]
19
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Andrew Geissler706d5aa2021-02-12 15:55:30 -060021
Brad Bishopa34c0302019-09-23 22:34:48 -040022---
23 src/shared/cpu-set-util.h | 2 ++
24 src/test/test-sizeof.c | 2 +-
25 2 files changed, 3 insertions(+), 1 deletion(-)
26
27diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
Andrew Geissler706d5aa2021-02-12 15:55:30 -060028index 27812dfd5923..0ab40731ea93 100644
Brad Bishopa34c0302019-09-23 22:34:48 -040029--- 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;
40diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
Andrew Geissler706d5aa2021-02-12 15:55:30 -060041index c65062d2562c..8b6eefa9cdae 100644
Brad Bishopa34c0302019-09-23 22:34:48 -040042--- a/src/test/test-sizeof.c
43+++ b/src/test/test-sizeof.c
44@@ -1,6 +1,5 @@
Andrew Geissler706d5aa2021-02-12 15:55:30 -060045 /* SPDX-License-Identifier: LGPL-2.1+ */
Brad Bishopa34c0302019-09-23 22:34:48 -040046
47-#include <sched.h>
48 #include <stdio.h>
49 #include <string.h>
Andrew Geissler82c905d2020-04-13 13:39:40 -050050 #include <sys/types.h>
51@@ -10,6 +9,7 @@
Brad Bishopa34c0302019-09-23 22:34:48 -040052 #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. */