mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
Clarify setStackSize error message
Show the actual attempted stack size value (capped at hard limit) separately from the desired value, making it clearer what's happening when the hard limit is lower than requested.
This commit is contained in:
parent
341c42f321
commit
f6aeca0522
1 changed files with 4 additions and 2 deletions
|
|
@ -65,13 +65,15 @@ void setStackSize(size_t stackSize)
|
|||
struct rlimit limit;
|
||||
if (getrlimit(RLIMIT_STACK, &limit) == 0 && static_cast<size_t>(limit.rlim_cur) < stackSize) {
|
||||
savedStackSize = limit.rlim_cur;
|
||||
limit.rlim_cur = std::min(static_cast<rlim_t>(stackSize), limit.rlim_max);
|
||||
auto requestedSize = std::min(static_cast<rlim_t>(stackSize), limit.rlim_max);
|
||||
limit.rlim_cur = requestedSize;
|
||||
if (setrlimit(RLIMIT_STACK, &limit) != 0) {
|
||||
logger->log(
|
||||
lvlError,
|
||||
HintFmt(
|
||||
"Failed to increase stack size from %1% to %2% (maximum allowed stack size: %3%): %4%",
|
||||
"Failed to increase stack size from %1% to %2% (desired: %3%, maximum allowed: %4%): %5%",
|
||||
savedStackSize,
|
||||
requestedSize,
|
||||
stackSize,
|
||||
limit.rlim_max,
|
||||
std::strerror(errno))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue