[PATCH 3/5] pi_stress: Improve error message for permission failures
John Kacur <[email protected]> Tue, 30 Jun 2026 12:45:00 -0400
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
When pi_stress fails to set real-time scheduling priority, it printed
a cryptic hex error code (0x1) that didn't explain what went wrong or
how to fix it.
Replace the error message with a clear explanation that indicates the
failure reason and suggests running with root privileges.
Before:
main: boosting to max priority: 0x1
After:
Failed to set real-time priority: Operation not permitted
Please run with root privileges to set real-time priorities.
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <[email protected]>
---
src/pi_tests/pi_stress.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index c8c895a71e44..675953923c3a 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -134,8 +134,8 @@ int main(int argc, char **argv)
status = pthread_setschedparam(pthread_self(), admin_sa.sched_policy,
&thread_param);
if (status) {
- pi_error("%s: boosting to max priority: 0x%x\n", __func__,
- status);
+ pi_error("Failed to set real-time priority: %s\n", strerror(status));
+ pi_error("Please run with root privileges to set real-time priorities.\n");
return FAILURE;
}
/* block unwanted signals */
--
2.54.0