mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
daemon: Fix build of spawn.cc for non-Linux and newer GCC.
* nix/libutil/spawn.cc: Include <fcntl.h> and <cstdint>. (cloneChild): Wrap body in #if CLONE_ENABLED. Change-Id: I0be7e6dbe80ac2f7022793149472270a4e49d23c Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
53b23512ee
commit
1ee291139f
1 changed files with 7 additions and 0 deletions
|
@ -26,8 +26,10 @@
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#if HAVE_SYS_MOUNT_H
|
#if HAVE_SYS_MOUNT_H
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
@ -852,6 +854,7 @@ int runChildSetupEntry(void *data)
|
||||||
|
|
||||||
int cloneChild(CloneSpawnContext & ctx)
|
int cloneChild(CloneSpawnContext & ctx)
|
||||||
{
|
{
|
||||||
|
#if CLONE_ENABLED
|
||||||
char stack[32 * 1024];
|
char stack[32 * 1024];
|
||||||
/* Ensure proper alignment on the stack. On aarch64, it has to be 16
|
/* Ensure proper alignment on the stack. On aarch64, it has to be 16
|
||||||
bytes. */
|
bytes. */
|
||||||
|
@ -860,6 +863,10 @@ int cloneChild(CloneSpawnContext & ctx)
|
||||||
if(ret == -1)
|
if(ret == -1)
|
||||||
throw SysError("clone");
|
throw SysError("clone");
|
||||||
return ret;
|
return ret;
|
||||||
|
#else
|
||||||
|
throw Error("clone not supported on this platform");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue