diff options
| author | Reepca Russelstein <reepca@russelstein.xyz> | 2025-06-26 01:28:02 -0500 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-06-26 15:41:57 +0200 |
| commit | 1ee291139fcb05335961562cf1baa1aa632c2abf (patch) | |
| tree | a3674bbe0916d3967eccf3426b2e5eb9f9f1ec43 | |
| parent | 53b23512ee32b92ae6376ea80e9e1f56aeaf0ce0 (diff) | |
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>
| -rw-r--r-- | nix/libutil/spawn.cc | 7 |
1 files changed, 7 insertions, 0 deletions
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 @@ | |||
| 26 | #include <grp.h> | 26 | #include <grp.h> |
| 27 | #include <limits.h> | 27 | #include <limits.h> |
| 28 | #include <sys/wait.h> | 28 | #include <sys/wait.h> |
| 29 | #include <fcntl.h> | ||
| 29 | #include <cstring> | 30 | #include <cstring> |
| 30 | #include <cstdlib> | 31 | #include <cstdlib> |
| 32 | #include <cstdint> | ||
| 31 | 33 | ||
| 32 | #if HAVE_SYS_MOUNT_H | 34 | #if HAVE_SYS_MOUNT_H |
| 33 | #include <sys/mount.h> | 35 | #include <sys/mount.h> |
| @@ -852,6 +854,7 @@ int runChildSetupEntry(void *data) | |||
| 852 | 854 | ||
| 853 | int cloneChild(CloneSpawnContext & ctx) | 855 | int cloneChild(CloneSpawnContext & ctx) |
| 854 | { | 856 | { |
| 857 | #if CLONE_ENABLED | ||
| 855 | char stack[32 * 1024]; | 858 | char stack[32 * 1024]; |
| 856 | /* Ensure proper alignment on the stack. On aarch64, it has to be 16 | 859 | /* Ensure proper alignment on the stack. On aarch64, it has to be 16 |
| 857 | bytes. */ | 860 | bytes. */ |
| @@ -860,6 +863,10 @@ int cloneChild(CloneSpawnContext & ctx) | |||
| 860 | if(ret == -1) | 863 | if(ret == -1) |
| 861 | throw SysError("clone"); | 864 | throw SysError("clone"); |
| 862 | return ret; | 865 | return ret; |
| 866 | #else | ||
| 867 | throw Error("clone not supported on this platform"); | ||
| 868 | #endif | ||
| 863 | } | 869 | } |
| 864 | 870 | ||
| 871 | |||
| 865 | } | 872 | } |
