From d34d2b2bbf784c0bb420a50905af25e02c6e4989 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 5 Dec 2014 20:34:41 +0100 Subject: Use posix_spawn to run the pager In low memory environments, "nix-env -qa" failed because the fork to run the pager hit the kernel's overcommit limits. Using posix_spawn gets around this. (Actually, you have to use posix_spawn with the undocumented POSIX_SPAWN_USEVFORK flag, otherwise it just uses fork/exec...) --- src/libutil/types.hh | 1 + src/libutil/util.cc | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 160884ee1a..030996a060 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -73,6 +73,7 @@ class SysError : public Error public: int errNo; SysError(const FormatOrString & fs); + SysError(int errNo, const FormatOrString & fs); }; diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 305e470ebd..60be02cd46 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -45,8 +45,14 @@ BaseError & BaseError::addPrefix(const FormatOrString & fs) SysError::SysError(const FormatOrString & fs) - : Error(format("%1%: %2%") % fs.s % strerror(errno)) - , errNo(errno) + : SysError(errno, fs) +{ +} + + +SysError::SysError(int errNo, const FormatOrString & fs) + : Error(format("%1%: %2%") % fs.s % strerror(errNo)) + , errNo(errNo) { } -- cgit 1.4.1