diff options
author | midnightveil <midnight@trainwit.ch> | 2024-05-10 15:25:12 +1000 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-05-16 17:11:21 -0700 |
commit | 5b7dcb3005ed38d4634f228f01852ae18b2d9cd4 (patch) | |
tree | a254515d74a24144865ae37ef468306b2e112a85 /src/libstore | |
parent | 9322a1cbe775a32c7019a91236d9e37037b9241a (diff) |
Allow enabling core dumps from builds for nix & child processes
Fixes https://git.lix.systems/lix-project/lix/issues/268
Change-Id: I3f1b0ddf064f891cca8b53229c5c31c74cea3d9f
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/build/local-derivation-goal.cc | 3 | ||||
-rw-r--r-- | src/libstore/globals.hh | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc index 3429afafa..cdbd0f5a7 100644 --- a/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc @@ -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? diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 16af3a415..8856d8fae 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -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"( |