Skip to content

Commit 4d00d4f

Browse files
committed
build: Check if P_PIDFD is defined
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>
1 parent 2663d5d commit 4d00d4f

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,17 @@ foreach ccattr: [
521521
srcconf.set10('HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr))
522522
endforeach
523523

524+
## P_PIDFD
525+
test_code = '''
526+
#include <sys/wait.h>
527+
void func() { siginfo_t s; int r = waitid(P_PIDFD, 0, &s, 0); }
528+
'''
529+
if cc.compiles(test_code, name: 'waitid(P_PIDFD, ...)')
530+
srcconf.set('HAVE_P_PIDFD', 1)
531+
else
532+
srcconf.set('HAVE_P_PIDFD', 0)
533+
endif
534+
524535
## Headers.
525536
foreach ident: [
526537
['bpf', '''#include <sys/syscall.h>

src/lxc/process_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
#endif
140140

141141
/* waitid */
142-
#if !HAVE_SYS_PIDFD_H
142+
#if !HAVE_P_PIDFD
143143
#ifndef P_PIDFD
144144
#define P_PIDFD 3
145145
#endif

0 commit comments

Comments
 (0)