Files
fruix/tests/guix/patches/phase5-guix-daemon-freebsd.patch

59 lines
2.0 KiB
Diff

--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -169,7 +169,11 @@
static void handleSignal(int signum)
{
+#if defined(__FreeBSD__)
+ string name = getprogname();
+#else
string name = program_invocation_short_name;
+#endif
auto message = name + ": PID " + std::to_string(getpid())
+ " caught signal " + std::to_string(signum) + "\n";
writeFull(STDERR_FILENO, (unsigned char *) message.c_str(), message.length());
@@ -940,12 +944,12 @@
/* If we're on a TCP connection, disable Nagle's algorithm so that
data is sent as soon as possible. */
- (void) setsockopt(remote, SOL_TCP, TCP_NODELAY,
+ (void) setsockopt(remote, IPPROTO_TCP, TCP_NODELAY,
&enabled, sizeof enabled);
#if defined(TCP_QUICKACK)
/* Enable TCP quick-ack if applicable; this might help a little. */
- (void) setsockopt(remote, SOL_TCP, TCP_QUICKACK,
+ (void) setsockopt(remote, IPPROTO_TCP, TCP_QUICKACK,
&enabled, sizeof enabled);
#endif
}
--- a/nix/libutil/spawn.cc
+++ b/nix/libutil/spawn.cc
@@ -31,6 +31,10 @@
#include <cstdlib>
#include <cassert>
#include <format>
+
+#if defined(__FreeBSD__)
+extern char **environ;
+#endif
#if HAVE_SYS_MOUNT_H
#include <sys/mount.h>
--- a/nix/libutil/archive.cc
+++ b/nix/libutil/archive.cc
@@ -298,9 +298,10 @@
errno = posix_fallocate(fd, 0, len);
/* Note that EINVAL may indicate that the underlying
filesystem doesn't support preallocation (e.g. on
- OpenSolaris). Since preallocation is just an
- optimisation, ignore it. */
- if (errno && errno != EINVAL)
+ OpenSolaris). On FreeBSD, EOPNOTSUPP/ENOTSUP can be
+ returned for the same reason. Since preallocation is
+ just an optimisation, ignore those cases. */
+ if (errno && errno != EINVAL && errno != EOPNOTSUPP && errno != ENOTSUP)
throw SysError(std::format("preallocating file of {} bytes", len));
}
#endif