Allow enabling core dumps from builds for nix & child processes

Fixes https://git.lix.systems/lix-project/lix/issues/268

Change-Id: I3f1b0ddf064f891cca8b53229c5c31c74cea3d9f
This commit is contained in:
midnightveil
2024-05-16 17:11:21 -07:00
committed by Jade Lovelace
parent 9322a1cbe7
commit 5b7dcb3005
8 changed files with 69 additions and 1 deletions
@@ -1977,6 +1977,9 @@ void LocalDerivationGoal::runChild()
/* Disable core dumps by default. */
struct rlimit limit = { 0, RLIM_INFINITY };
if (settings.enableCoreDumps) {
limit.rlim_cur = RLIM_INFINITY;
}
setrlimit(RLIMIT_CORE, &limit);
// FIXME: set other limits to deterministic values?
+9
View File
@@ -290,6 +290,15 @@ public:
Setting<off_t> reservedSize{this, 8 * 1024 * 1024, "gc-reserved-space",
"Amount of reserved disk space for the garbage collector."};
Setting<bool> enableCoreDumps{
this, false, "enable-core-dumps",
R"(
If set to `false` (the default), `RLIMIT_CORE` has a soft limit of zero.
If set to `true`, the soft limit is infinite.
The hard limit is always infinite.
)"};
Setting<bool> fsyncMetadata{
this, true, "fsync-metadata",
R"(