mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
Fix scheduler support check
Commit 94cc577807
tried fixing build on systems that did not have
SCHED_BATCH or SCHED_IDLE defined. But instead of changing it to
conditional support, it rather completely disabled the support for
setting any scheduler. Since then, such old systems are not
supported, but rather than reverting that commit, let's change that to
the conditional support. That way any addition to the list of
schedulers can follow the same style so that we're consistent in the
future.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
135e77d32f
commit
f2bf5fbb04
@ -1183,7 +1183,7 @@ virProcessExitWithStatus(int status)
|
||||
exit(value);
|
||||
}
|
||||
|
||||
#if HAVE_SCHED_SETSCHEDULER && defined(SCHED_BATCH) && defined(SCHED_IDLE)
|
||||
#if HAVE_SCHED_SETSCHEDULER
|
||||
|
||||
static int
|
||||
virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
|
||||
@ -1193,10 +1193,18 @@ virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
|
||||
return SCHED_OTHER;
|
||||
|
||||
case VIR_PROC_POLICY_BATCH:
|
||||
# ifdef SCHED_BATCH
|
||||
return SCHED_BATCH;
|
||||
# else
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
case VIR_PROC_POLICY_IDLE:
|
||||
# ifdef SCHED_IDLE
|
||||
return SCHED_IDLE;
|
||||
# else
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
case VIR_PROC_POLICY_FIFO:
|
||||
return SCHED_FIFO;
|
||||
@ -1225,6 +1233,13 @@ virProcessSetScheduler(pid_t pid,
|
||||
if (!policy)
|
||||
return 0;
|
||||
|
||||
if (pol < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Scheduler '%s' is not supported on this platform"),
|
||||
virProcessSchedPolicyTypeToString(policy));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pol == SCHED_FIFO || pol == SCHED_RR) {
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user