From 1ee291139fcb05335961562cf1baa1aa632c2abf Mon Sep 17 00:00:00 2001 From: Reepca Russelstein Date: Thu, 26 Jun 2025 01:28:02 -0500 Subject: daemon: Fix build of spawn.cc for non-Linux and newer GCC. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nix/libutil/spawn.cc: Include and . (cloneChild): Wrap body in #if CLONE_ENABLED. Change-Id: I0be7e6dbe80ac2f7022793149472270a4e49d23c Signed-off-by: Ludovic Courtès --- nix/libutil/spawn.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'nix') diff --git a/nix/libutil/spawn.cc b/nix/libutil/spawn.cc index 414849b6f04..2e3e1ac1a79 100644 --- a/nix/libutil/spawn.cc +++ b/nix/libutil/spawn.cc @@ -26,8 +26,10 @@ #include #include #include +#include #include #include +#include #if HAVE_SYS_MOUNT_H #include @@ -852,6 +854,7 @@ int runChildSetupEntry(void *data) int cloneChild(CloneSpawnContext & ctx) { +#if CLONE_ENABLED char stack[32 * 1024]; /* Ensure proper alignment on the stack. On aarch64, it has to be 16 bytes. */ @@ -860,6 +863,10 @@ int cloneChild(CloneSpawnContext & ctx) if(ret == -1) throw SysError("clone"); return ret; +#else + throw Error("clone not supported on this platform"); +#endif } + } -- cgit v1.2.3