]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
build: Check if P_PIDFD is defined 4614/head
authorJaeyoon Jung <jaeyoon.jung@lge.com>
Sun, 30 Nov 2025 02:51:13 +0000 (11:51 +0900)
committerJaeyoon Jung <jaeyoon.jung@lge.com>
Sun, 30 Nov 2025 03:10:05 +0000 (12:10 +0900)
It is defined in enum 'idtype_t' in some environment in which causes an
error like:
../git/src/lxc/process_utils.h:144:17: error: expected identifier before numeric constant
  144 | #define P_PIDFD 3
      |                 ^

Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
meson.build
src/lxc/process_utils.h

index ec7524c24e5eaf7f9418f92c96adf1360202619b..4b3a8f07f14bb71f5119a59bfed785441629bdb1 100644 (file)
@@ -521,6 +521,17 @@ foreach ccattr: [
     srcconf.set10('HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr))
 endforeach
 
+## P_PIDFD
+test_code = '''
+#include <sys/wait.h>
+void func() { siginfo_t s; int r = waitid(P_PIDFD, 0, &s, 0); }
+'''
+if cc.compiles(test_code, name: 'waitid(P_PIDFD, ...)')
+    srcconf.set('HAVE_P_PIDFD', 1)
+  else
+    srcconf.set('HAVE_P_PIDFD', 0)
+endif
+
 ## Headers.
 foreach ident: [
     ['bpf',               '''#include <sys/syscall.h>
index effff9bd30a6ce36290c68a342def6d11c615f1f..f4f53a23173ced9ce1c6481a517ca5c2a062837c 100644 (file)
 #endif
 
 /* waitid */
-#if !HAVE_SYS_PIDFD_H
+#if !HAVE_P_PIDFD
 #ifndef P_PIDFD
 #define P_PIDFD 3
 #endif