blob: 6981d70af0818679f15a281f96a52a9e5a2ec693 [file] [log] [blame]
Andrew Geisslerd5838332022-05-27 11:33:10 -05001From 8871f78c559f37169c0cfaf20b0af1dbec0399af 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
William A. Kennington IIIac69b482021-06-02 12:28:27 -07004Subject: [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>
William A. Kennington IIIac69b482021-06-02 12:28:27 -070021
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 Geisslerd1e89492021-02-12 15:35:20 -060028index 3c63a58826..4c2d4347fc 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 Geisslerd5838332022-05-27 11:33:10 -050041index 602772227e..7f1ed19d77 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 Geisslerd1e89492021-02-12 15:35:20 -060045 /* SPDX-License-Identifier: LGPL-2.1-or-later */
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. */