about summary refs log tree commit diff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-08T15·44+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-08T15·44+0000
commit9dbfe242e3bdbfc7728a36c8a2b9fbbea2c8ed68 (patch)
treedc27874c617eabfa591ac32eca387de7e82835ae /src/libstore/globals.cc
parentd3fe6ab024df7764f4de2a9dcf88e2daa981f786 (diff)
* Kill a build if it has gone for more than a certain number of
  seconds without producing output on stdout or stderr (NIX-65).  This
  timeout can be specified using the `--max-silent-time' option or the
  `build-max-silent-time' configuration setting.  The default is
  infinity (0).

* Fix a tricky race condition: if we kill the build user before the
  child has done its setuid() to the build user uid, then it won't be
  killed, and we'll potentially lock up in pid.wait().  So also send a
  conventional kill to the child.

Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index e8c033db2ec1..b0316f77c292 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -24,6 +24,7 @@ Verbosity buildVerbosity = lvlInfo;
 unsigned int maxBuildJobs = 1;
 bool readOnlyMode = false;
 string thisSystem = "unset";
+unsigned int maxSilentTime = 0;
 
 
 static bool settingsRead = false;
@@ -104,5 +105,14 @@ bool queryBoolSetting(const string & name, bool def)
         % name % v);
 }
 
+
+unsigned int queryIntSetting(const string & name, unsigned int def)
+{
+    int n;
+    if (!string2Int(querySetting(name, int2String(def)), n) || n < 0)
+        throw Error(format("configuration setting `%1%' should have an integer value") % name);
+    return n;
+}
+
  
 }