about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-05T19·34+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-05T19·34+0100
commitd34d2b2bbf784c0bb420a50905af25e02c6e4989 (patch)
tree6eb1ba5ea6940a55b475f93618e5511a37f807ff /src/libutil/util.cc
parentd51eed833a7bbd211a1601367e90d91f71025206 (diff)
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...)
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 305e470ebde0..60be02cd4647 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)
 {
 }