about summary refs log tree commit diff
path: root/src/nix-build/nix-build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-09-20T13·10+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-09-20T13·41+0200
commit9fc4cb2ae970f860bc309cbaf40957f53a36d423 (patch)
treeae8a2b106bff7332c75d1ee927e3074842b379ea /src/nix-build/nix-build.cc
parent0d38b4c7926890decbe2b03ed8f84584a5ce9b8a (diff)
nix-shell: Restore CPU affinity
Otherwise the shell and its children will be bound to one CPU core...
Diffstat (limited to 'src/nix-build/nix-build.cc')
-rwxr-xr-xsrc/nix-build/nix-build.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 248474d5316a..a31f7c96c3b3 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -1,18 +1,20 @@
 #include <cstring>
+#include <fstream>
+#include <iostream>
 #include <regex>
-#include "util.hh"
-#include <unistd.h>
-#include "shared.hh"
 #include <sstream>
 #include <vector>
-#include <iostream>
-#include <fstream>
+
+#include <unistd.h>
+
 #include "store-api.hh"
 #include "globals.hh"
 #include "derivations.hh"
+#include "affinity.hh"
+#include "util.hh"
+#include "shared.hh"
 
 using namespace nix;
-using std::stringstream;
 
 extern char ** environ;
 
@@ -400,6 +402,8 @@ int main(int argc, char ** argv)
                 for (const auto & env : drv.env)
                     setenv(env.first.c_str(), env.second.c_str(), 1);
 
+                restoreAffinity();
+
                 // Run a shell using the derivation's environment.  For
                 // convenience, source $stdenv/setup to setup additional
                 // environment variables and shell functions.  Also don't lose