We use the presence of sched_setscheduler() and cpu_set_t as
witnesses for whether we can set process affinity and the
like.
This entire class of functionality is missing on Hurd, but
unfortunately it still gets advertised, so the end result is
that a number of warnings are produced during build:
sched_get_priority_max is not implemented and will always fail
sched_get_priority_min is not implemented and will always fail
sched_getaffinity is not implemented and will always fail
sched_setaffinity is not implemented and will always fail
Don't even attempt to detect the known-broken APIs, so that
we don't get compiler warnings and can report the missing
functionality correctly at runtime if attempts to use it are
made.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
meson.build | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index 7845f60ff7..eef00ee32a 100644
--- a/meson.build
+++ b/meson.build
@@ -584,13 +584,19 @@ functions = [
'posix_fallocate',
'posix_memalign',
'prlimit',
- 'sched_setscheduler',
'setgroups',
'setrlimit',
'symlink',
'sysctlbyname',
]
+# sched_* APIs are know to be broken on Hurd
+if host_machine.system() != 'gnu'
+ functions += [
+ 'sched_setscheduler',
+ ]
+endif
+
stat_functions = [
'__lxstat',
'__lxstat64',
@@ -669,8 +675,6 @@ symbols = [
# Check for BSD approach for setting MAC addr
[ 'net/if_dl.h', 'link_addr', '#include
<sys/types.h>\n#include <sys/socket.h>' ],
-
- [ 'sched.h', 'cpu_set_t' ],
]
if host_machine.system() == 'linux'
@@ -680,6 +684,13 @@ if host_machine.system() == 'linux'
]
endif
+# sched_* APIs are know to be broken on Hurd
+if host_machine.system() != 'gnu'
+ symbols += [
+ [ 'sched.h', 'cpu_set_t' ],
+ ]
+endif
+
foreach symbol : symbols
if cc.has_header_symbol(symbol[0], symbol[1], args: '-D_GNU_SOURCE', prefix:
symbol.get(2, ''))
conf.set('WITH_DECL_@0(a)'.format(symbol[1].to_upper()), 1)
--
2.43.2