mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
virprocess: fix MinGW build and RHEL-5 build
Commit b6a2828e
introduced new functions to set process scheduler. There
is a small typo in ELSE path for systems where scheduler is not
available.
Also some of the definitions were introduced later in kernel. For
example RHEL-5 is running on kernel 2.6.18, but SCHED_IDLE was introduces
in 2.6.23 [1] and SCHED_BATCH in 2.6.16 [1]. We should not count only on
existence of function sched_setscheduler(), we must also check for
existence of used macros as they might not be defined.
[1] see 'man 7 sched'
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d618cdc965
commit
94cc577807
@ -1062,7 +1062,7 @@ virProcessExitWithStatus(int status)
|
||||
exit(value);
|
||||
}
|
||||
|
||||
#if HAVE_SCHED_SETSCHEDULER
|
||||
#if HAVE_SCHED_SETSCHEDULER && defined(SCHED_BATCH) && defined(SCHED_IDLE)
|
||||
|
||||
static int
|
||||
virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
|
||||
@ -1092,7 +1092,9 @@ virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
|
||||
}
|
||||
|
||||
int
|
||||
virProcessSetScheduler(pid_t pid, virProcessSchedPolicy policy, int priority)
|
||||
virProcessSetScheduler(pid_t pid,
|
||||
virProcessSchedPolicy policy,
|
||||
int priority)
|
||||
{
|
||||
struct sched_param param = {0};
|
||||
int pol = virProcessSchedTranslatePolicy(policy);
|
||||
@ -1144,7 +1146,7 @@ virProcessSetScheduler(pid_t pid, virProcessSchedPolicy policy, int priority)
|
||||
|
||||
int
|
||||
virProcessSetScheduler(pid_t pid ATTRIBUTE_UNUSED,
|
||||
int policy,
|
||||
virProcessSchedPolicy policy,
|
||||
int priority ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (!policy)
|
||||
|
Loading…
Reference in New Issue
Block a user