nix-shell: Restore CPU affinity

Otherwise the shell and its children will be bound to one CPU core...
This commit is contained in:
Eelco Dolstra 2016-09-20 15:10:51 +02:00
parent 0d38b4c792
commit 9fc4cb2ae9

View file

@ -1,18 +1,20 @@
#include <cstring> #include <cstring>
#include <fstream>
#include <iostream>
#include <regex> #include <regex>
#include "util.hh"
#include <unistd.h>
#include "shared.hh"
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <iostream>
#include <fstream> #include <unistd.h>
#include "store-api.hh" #include "store-api.hh"
#include "globals.hh" #include "globals.hh"
#include "derivations.hh" #include "derivations.hh"
#include "affinity.hh"
#include "util.hh"
#include "shared.hh"
using namespace nix; using namespace nix;
using std::stringstream;
extern char ** environ; extern char ** environ;
@ -400,6 +402,8 @@ int main(int argc, char ** argv)
for (const auto & env : drv.env) for (const auto & env : drv.env)
setenv(env.first.c_str(), env.second.c_str(), 1); setenv(env.first.c_str(), env.second.c_str(), 1);
restoreAffinity();
// Run a shell using the derivation's environment. For // Run a shell using the derivation's environment. For
// convenience, source $stdenv/setup to setup additional // convenience, source $stdenv/setup to setup additional
// environment variables and shell functions. Also don't lose // environment variables and shell functions. Also don't lose