0025-Handle-__cpu_mask-usage.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 8871f78c559f37169c0cfaf20b0af1dbec0399af Mon Sep 17 00:00:00 2001
  2. From: Scott Murray <scott.murray@konsulko.com>
  3. Date: Fri, 13 Sep 2019 19:26:27 -0400
  4. Subject: [PATCH] Handle __cpu_mask usage
  5. Fixes errors:
  6. src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function)
  7. src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function)
  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. Upstream-Status: Inappropriate [musl specific]
  15. Signed-off-by: Scott Murray <scott.murray@konsulko.com>
  16. ---
  17. src/shared/cpu-set-util.h | 2 ++
  18. src/test/test-sizeof.c | 2 +-
  19. 2 files changed, 3 insertions(+), 1 deletion(-)
  20. diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
  21. index 3c63a58826..4c2d4347fc 100644
  22. --- a/src/shared/cpu-set-util.h
  23. +++ b/src/shared/cpu-set-util.h
  24. @@ -6,6 +6,8 @@
  25. #include "macro.h"
  26. #include "missing_syscall.h"
  27. +typedef unsigned long __cpu_mask;
  28. +
  29. /* This wraps the libc interface with a variable to keep the allocated size. */
  30. typedef struct CPUSet {
  31. cpu_set_t *set;
  32. diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
  33. index 602772227e..7f1ed19d77 100644
  34. --- a/src/test/test-sizeof.c
  35. +++ b/src/test/test-sizeof.c
  36. @@ -1,6 +1,5 @@
  37. /* SPDX-License-Identifier: LGPL-2.1-or-later */
  38. -#include <sched.h>
  39. #include <stdio.h>
  40. #include <string.h>
  41. #include <sys/types.h>
  42. @@ -10,6 +9,7 @@
  43. #include <float.h>
  44. #include "time-util.h"
  45. +#include "cpu-set-util.h"
  46. /* Print information about various types. Useful when diagnosing
  47. * gcc diagnostics on an unfamiliar architecture. */