meson: Check for sched_get_priority_min()

virProcessSetScheduler() uses not just sched_setscheduler() but
also sched_get_priority_{min,max}(). Currently we assume that
the former being available implies that the latter are as well,
but that's not the case for at least GNU/Hurd.

Make sure all functions are actually available before
attempting to use them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2024-02-27 15:58:27 +01:00
parent 526e7ee15a
commit 6b7c8fce5a
2 changed files with 4 additions and 3 deletions

View File

@ -584,6 +584,7 @@ functions = [
'posix_fallocate', 'posix_fallocate',
'posix_memalign', 'posix_memalign',
'prlimit', 'prlimit',
'sched_get_priority_min',
'sched_getaffinity', 'sched_getaffinity',
'sched_setscheduler', 'sched_setscheduler',
'setgroups', 'setgroups',

View File

@ -1573,7 +1573,7 @@ virProcessExitWithStatus(int status)
exit(value); exit(value);
} }
#if WITH_SCHED_SETSCHEDULER #if defined(WITH_SCHED_SETSCHEDULER) && defined(WITH_SCHED_GET_PRIORITY_MIN)
static int static int
virProcessSchedTranslatePolicy(virProcessSchedPolicy policy) virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
@ -1667,7 +1667,7 @@ virProcessSetScheduler(pid_t pid,
return 0; return 0;
} }
#else /* ! WITH_SCHED_SETSCHEDULER */ #else /* ! (defined(WITH_SCHED_SETSCHEDULER) && defined(WITH_SCHED_GET_PRIORITY_MIN)) */
int int
virProcessSetScheduler(pid_t pid G_GNUC_UNUSED, virProcessSetScheduler(pid_t pid G_GNUC_UNUSED,
@ -1682,7 +1682,7 @@ virProcessSetScheduler(pid_t pid G_GNUC_UNUSED,
return -1; return -1;
} }
#endif /* !WITH_SCHED_SETSCHEDULER */ #endif /* ! (defined(WITH_SCHED_SETSCHEDULER) && defined(WITH_SCHED_GET_PRIORITY_MIN)) */
/* /*
* Get all stat fields for a process based on pid and tid: * Get all stat fields for a process based on pid and tid: