From 96c3bccf5d05b1b224761f575c1ebce51e9ba1d4 Mon Sep 17 00:00:00 2001 From: Tyonnchie Berry Date: Fri, 27 Jun 2025 14:21:57 -0400 Subject: [PATCH] Added 3 patches and updated spec file Signed-off-by: Tyonnchie Berry --- Fix-rt-tests-build-with-glibc-2.41.patch | 56 +++++++++++++++++++ ...t-Fix-rt-tests-build-with-glibc-2.41.patch | 55 ++++++++++++++++++ realtime-tests.spec | 10 +++- sched_attr-Do-not-define-for-glibc-2.41.patch | 47 ++++++++++++++++ 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 Fix-rt-tests-build-with-glibc-2.41.patch create mode 100644 Revert-Fix-rt-tests-build-with-glibc-2.41.patch create mode 100644 sched_attr-Do-not-define-for-glibc-2.41.patch diff --git a/Fix-rt-tests-build-with-glibc-2.41.patch b/Fix-rt-tests-build-with-glibc-2.41.patch new file mode 100644 index 0000000..3bdb4bb --- /dev/null +++ b/Fix-rt-tests-build-with-glibc-2.41.patch @@ -0,0 +1,56 @@ +From d3a23a0cc76789c3083df3bad78982cd49bc4c5e Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Wed, 29 Jan 2025 16:46:11 -0500 +Subject: [PATCH] Fix rt-tests build with glibc-2.41 + +The sched_*attr APIs were added to glibc +https://sourceware.org/git/?p=glibc.git;a=commit;h=21571ca0d70302909cf72707b2a7736cf12190a0 + +This fixes the build conflict in rt-tests with glibc-2.4 + +Signed-off-by: Yaakov Selkowitz +Signed-off-by: John Kacur +--- + src/include/rt-sched.h | 2 ++ + src/lib/rt-sched.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h +index 80171c7..dfd7f45 100644 +--- a/src/include/rt-sched.h ++++ b/src/include/rt-sched.h +@@ -42,6 +42,7 @@ + #define __NR_sched_getattr 275 + #endif + ++#if ! __GLIBC_PREREQ(2, 41) + struct sched_attr { + uint32_t size; + uint32_t sched_policy; +@@ -67,5 +68,6 @@ int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags); ++#endif + + #endif /* __RT_SCHED_H__ */ +diff --git a/src/lib/rt-sched.c b/src/lib/rt-sched.c +index 8023bc7..2500abd 100644 +--- a/src/lib/rt-sched.c ++++ b/src/lib/rt-sched.c +@@ -14,6 +14,7 @@ + + #include "rt-sched.h" + ++#if ! __GLIBC_PREREQ(2, 41) + int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags) +@@ -28,3 +29,4 @@ int sched_getattr(pid_t pid, + { + return syscall(__NR_sched_getattr, pid, attr, size, flags); + } ++#endif +-- +2.49.0 + diff --git a/Revert-Fix-rt-tests-build-with-glibc-2.41.patch b/Revert-Fix-rt-tests-build-with-glibc-2.41.patch new file mode 100644 index 0000000..ab63602 --- /dev/null +++ b/Revert-Fix-rt-tests-build-with-glibc-2.41.patch @@ -0,0 +1,55 @@ +From 325b10a43bab7d1dfd0b061b40b764de649cbd64 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Thu, 10 Apr 2025 12:59:29 -0400 +Subject: [PATCH] Revert "Fix rt-tests build with glibc-2.41" + +This reverts commit d3a23a0cc76789c3083df3bad78982cd49bc4c5e. + +When people backport the feature into earlier versions of glibc, then +the patches fails. + +Signed-off-by: John Kacur +--- + src/include/rt-sched.h | 2 -- + src/lib/rt-sched.c | 2 -- + 2 files changed, 4 deletions(-) + +diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h +index dfd7f45..80171c7 100644 +--- a/src/include/rt-sched.h ++++ b/src/include/rt-sched.h +@@ -42,7 +42,6 @@ + #define __NR_sched_getattr 275 + #endif + +-#if ! __GLIBC_PREREQ(2, 41) + struct sched_attr { + uint32_t size; + uint32_t sched_policy; +@@ -68,6 +67,5 @@ int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags); +-#endif + + #endif /* __RT_SCHED_H__ */ +diff --git a/src/lib/rt-sched.c b/src/lib/rt-sched.c +index 2500abd..8023bc7 100644 +--- a/src/lib/rt-sched.c ++++ b/src/lib/rt-sched.c +@@ -14,7 +14,6 @@ + + #include "rt-sched.h" + +-#if ! __GLIBC_PREREQ(2, 41) + int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags) +@@ -29,4 +28,3 @@ int sched_getattr(pid_t pid, + { + return syscall(__NR_sched_getattr, pid, attr, size, flags); + } +-#endif +-- +2.49.0 + diff --git a/realtime-tests.spec b/realtime-tests.spec index a86ac7f..202c991 100644 --- a/realtime-tests.spec +++ b/realtime-tests.spec @@ -24,7 +24,9 @@ Patch3: Turn-off-Wunused-parameter.patch Patch4: Enable-Werror.patch Patch5: Remove-unused-parameter-annotations.patch Patch6: pip_stress-Add-option-usleep.patch - +Patch7: Fix-rt-tests-build-with-glibc-2.41.patch +Patch8: Revert-Fix-rt-tests-build-with-glibc-2.41.patch +Patch9: sched_attr-Do-not-define-for-glibc-2.41.patch %description realtime-tests is a set of programs that test and measure various components of real-time kernel behavior. This package measures timer, signal, and hardware @@ -82,6 +84,12 @@ latency. It also tests the functioning of priority-inheritance mutexes. %{_mandir}/man8/determine_maximum_mpps.8.* %changelog +* Fri Jun 27 2025 Tyonnchie Berry - 2.8-5 +- Added patch Fix-rt-tests-build-with-glibc-2.41.patch +- Added patch Revert-Fix-rt-tests-build-with-glibc-2.41.patch +- Added patch sched_attr-Do-not-define-for-glibc-2.41.patch +Resolves: RHEL-88470 + * Thu Jan 30 2025 John Kacur - 2.8-5 - Add a usleep option to pip_stress Resolves: RHEL-77111 diff --git a/sched_attr-Do-not-define-for-glibc-2.41.patch b/sched_attr-Do-not-define-for-glibc-2.41.patch new file mode 100644 index 0000000..9b657b0 --- /dev/null +++ b/sched_attr-Do-not-define-for-glibc-2.41.patch @@ -0,0 +1,47 @@ +From 30644eae4467b5a2de42b760403e2150683aff08 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Jan 2025 15:08:38 -0800 +Subject: [PATCH] sched_attr: Do not define for glibc >= 2.41 + +glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions +and struct sched_attr. Therefore, it needs to be checked for here as well before +defining sched_attr + +Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0 + +Fixes builds with glibc/trunk + +[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8 + +Signed-off-by: Khem Raj +Cc: Clark Williams +Cc: John Kacur +Cc: rt-users +Signed-off-by: John Kacur +--- + src/include/rt-sched.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h +index 80171c7..9cf0e3a 100644 +--- a/src/include/rt-sched.h ++++ b/src/include/rt-sched.h +@@ -42,6 +42,8 @@ + #define __NR_sched_getattr 275 + #endif + ++/* sched_attr is not defined in glibc < 2.41 */ ++#ifndef SCHED_ATTR_SIZE_VER0 + struct sched_attr { + uint32_t size; + uint32_t sched_policy; +@@ -68,4 +70,6 @@ int sched_getattr(pid_t pid, + unsigned int size, + unsigned int flags); + ++#endif /* SCHED_ATTR_SIZE_VER0 */ ++ + #endif /* __RT_SCHED_H__ */ +-- +2.49.0 +