kumquat-buildroot/package/lxc/0003-build-detect-sys-pidfd.h-availability.patch
Fabrice Fontaine 74b1d385b6 package/lxc: fix build with sys/pidfd.h
Fix the following build failure with sys/pidfd.h raised since bump to
version 5.0.1 in commit db19998035:

In file included from ../src/lxc/utils.h:23,
                 from ../src/lxc/cgroups/cgfsng.c:51:
../src/lxc/process_utils.h:140:17: error: expected identifier before numeric constant
  140 | #define P_PIDFD 3
      |                 ^

Fixes:
 - http://autobuild.buildroot.org/results/c9ff42a921ca47f634f908bab80c80164c227a02

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2022-12-05 08:14:32 +01:00

56 lines
1.4 KiB
Diff

From ef1e0607b82e27350c2d677d649c6a0a9693fd40 Mon Sep 17 00:00:00 2001
From: Christian Brauner <brauner@kernel.org>
Date: Tue, 9 Aug 2022 16:27:40 +0200
Subject: [PATCH] build: detect sys/pidfd.h availability
Fixes: #4176
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
[Retrieved from:
https://github.com/lxc/lxc/commit/ef1e0607b82e27350c2d677d649c6a0a9693fd40]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
meson.build | 1 +
src/lxc/process_utils.h | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/meson.build b/meson.build
index f679aabbc8..e999542336 100644
--- a/meson.build
+++ b/meson.build
@@ -735,6 +735,7 @@ foreach tuple: [
['sys/resource.h'],
['sys/memfd.h'],
['sys/personality.h'],
+ ['sys/pidfd.h'],
['sys/signalfd.h'],
['sys/timerfd.h'],
['pty.h'],
diff --git a/src/lxc/process_utils.h b/src/lxc/process_utils.h
index 9c15b15741..ed84741d0e 100644
--- a/src/lxc/process_utils.h
+++ b/src/lxc/process_utils.h
@@ -15,6 +15,10 @@
#include <sys/syscall.h>
#include <unistd.h>
+#if HAVE_SYS_PIDFD_H
+#include <sys/pidfd.h>
+#endif
+
#include "compiler.h"
#include "syscall_numbers.h"
@@ -136,9 +140,11 @@
#endif
/* waitid */
+#if !HAVE_SYS_PIDFD_H
#ifndef P_PIDFD
#define P_PIDFD 3
#endif
+#endif
#ifndef CLONE_ARGS_SIZE_VER0
#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */