It appears the return values for set_scheduler and set_nice are not correctly checked in the case where the initial request failed. This caused pa_make_realtime to incorrectly log that real time status was achieved (albeit one level lower than requested) when it actually was not. Painful as it covered up an incorrectly configured rtkit setup on a system.
The attached patch fixes the problem.
>From 7475a180ff99f08db8e79be8841ef2ef322806eb Mon Sep 17 00:00:00 2001 From: Scott Reeves <sree...@novell.com> Date: Thu, 20 Jan 2011 16:41:21 -0700 Subject: [PATCH] fix incorrect check of return value --- src/pulsecore/core-util.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index a642553..b662a7e 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -680,7 +680,7 @@ int pa_make_realtime(int rtprio) { } for (p = rtprio-1; p >= 1; p--) - if (set_scheduler(p)) { + if (set_scheduler(p) >= 0) { pa_log_info("Successfully enabled SCHED_RR scheduling for thread, with priority %i, which is lower than the requested %i.", p, rtprio); return 0; } @@ -750,7 +750,7 @@ int pa_raise_priority(int nice_level) { } for (n = nice_level+1; n < 0; n++) - if (set_nice(n) > 0) { + if (set_nice(n) >= 0) { pa_log_info("Successfully acquired nice level %i, which is lower than the requested %i.", n, nice_level); return 0; } -- 1.6.0.2
_______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss