0003-sched_attr-Do-not-define-for-glibc-2.41.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 66b1926d72ef51d4d59d0f97061f26a75651e265 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Fri, 11 Oct 2024 12:31:40 -0700
  4. Subject: [PATCH] sched_attr: Do not define for glibc >= 2.41
  5. glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions
  6. and struct sched_attr. Therefore, it needs to be checked for here as well before
  7. defining sched_attr
  8. Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0
  9. Fixes builds with glibc/trunk
  10. [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. Cc: Laurent Vivier <laurent@vivier.eu>
  13. Cc: Paolo Bonzini <pbonzini@redhat.com>
  14. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  15. Upstream: https://patchwork.kernel.org/project/qemu-devel/patch/20241011193140.1047648-1-raj.khem@gmail.com/
  16. ---
  17. linux-user/syscall.c | 4 +++-
  18. 1 file changed, 3 insertions(+), 1 deletion(-)
  19. diff --git a/linux-user/syscall.c b/linux-user/syscall.c
  20. index 1ce4c79784..a407d4a023 100644
  21. --- a/linux-user/syscall.c
  22. +++ b/linux-user/syscall.c
  23. @@ -358,7 +358,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len,
  24. #define __NR_sys_sched_setaffinity __NR_sched_setaffinity
  25. _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len,
  26. unsigned long *, user_mask_ptr);
  27. -/* sched_attr is not defined in glibc */
  28. +/* sched_attr is not defined in glibc < 2.41 */
  29. +#ifndef SCHED_ATTR_SIZE_VER0
  30. struct sched_attr {
  31. uint32_t size;
  32. uint32_t sched_policy;
  33. @@ -371,6 +372,7 @@ struct sched_attr {
  34. uint32_t sched_util_min;
  35. uint32_t sched_util_max;
  36. };
  37. +#endif
  38. #define __NR_sys_sched_getattr __NR_sched_getattr
  39. _syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr,
  40. unsigned int, size, unsigned int, flags);
  41. --
  42. 2.34.1