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
This commit is contained in:
Fabien Thomas 2006-03-07 22:48:43 +00:00
parent 0c0cd07156
commit 6fdfd15c17

View File

@ -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