0001-sched_attr-Do-not-define-for-glibc-2.41.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From e1f5f9379a68471c9f5fb0859e87dd84001b0b6f Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Tue, 28 Jan 2025 15:03:59 -0800
  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. Upstream-Status: Submitted [https://lore.kernel.org/linux-rt-users/20250128230838.2311298-1-raj.khem@gmail.com/T/#u]
  12. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  13. Cc: Clark Williams <williams@redhat.com>
  14. Cc: John Kacur <jkacur@redhat.com>
  15. Cc: rt-users <linux-rt-users@vger.kernel.org>
  16. ---
  17. src/include/rt-sched.h | 4 ++++
  18. 1 file changed, 4 insertions(+)
  19. diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h
  20. index 80171c7..9cf0e3a 100644
  21. --- a/src/include/rt-sched.h
  22. +++ b/src/include/rt-sched.h
  23. @@ -42,6 +42,8 @@
  24. #define __NR_sched_getattr 275
  25. #endif
  26. +/* sched_attr is not defined in glibc < 2.41 */
  27. +#ifndef SCHED_ATTR_SIZE_VER0
  28. struct sched_attr {
  29. uint32_t size;
  30. uint32_t sched_policy;
  31. @@ -68,4 +70,6 @@ int sched_getattr(pid_t pid,
  32. unsigned int size,
  33. unsigned int flags);
  34. +#endif /* SCHED_ATTR_SIZE_VER0 */
  35. +
  36. #endif /* __RT_SCHED_H__ */