From 6fdfd15c1766ac96df69310bc4aa7e1269bf43a3 Mon Sep 17 00:00:00 2001 From: Fabien Thomas Date: Tue, 7 Mar 2006 22:48:43 +0000 Subject: [PATCH] use sched_get_priority_max to set the maximum priority git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@943 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/exec/main.c b/exec/main.c index fc4af4f5..ef713463 100644 --- a/exec/main.c +++ b/exec/main.c @@ -1113,15 +1113,19 @@ static void aisexec_libais_bind (int *server_fd) static void aisexec_setscheduler (void) { #if defined(OPENAIS_BSD) || defined(OPENAIS_LINUX) - static struct sched_param sched_param = { - sched_priority: 99 - }; + struct sched_param sched_param; int res; - res = sched_setscheduler (0, SCHED_RR, &sched_param); - if (res == -1) { - log_printf (LOG_LEVEL_WARNING, "Could not set SCHED_RR at priority 99: %s\n", strerror (errno)); - } + res = sched_get_priority_max (SCHED_RR); + if (res != -1) { + sched_param.sched_priority = res; + res = sched_setscheduler (0, SCHED_RR, &sched_param); + if (res == -1) { + log_printf (LOG_LEVEL_WARNING, "Could not set SCHED_RR at priority %d: %s\n", + sched_param.sched_priority, strerror (errno)); + } + } else + log_printf (LOG_LEVEL_WARNING, "Could not get maximum scheduler priority: %s\n", strerror (errno)); #else log_printf(LOG_LEVEL_WARNING, "Scheduler priority left to default value (no OS support)\n"); #endif