mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
restoreSignals() + restoreAffinity() -> restoreProcessContext()
This commit is contained in:
parent
8a29052cb2
commit
9b9e703df4
9 changed files with 32 additions and 42 deletions
|
@ -1116,7 +1116,7 @@ void runProgram2(const RunOptions & options)
|
|||
Strings args_(options.args);
|
||||
args_.push_front(options.program);
|
||||
|
||||
restoreSignals();
|
||||
restoreProcessContext();
|
||||
|
||||
if (options.searchPath)
|
||||
execvp(options.program.c_str(), stringsToCharPtrs(args_).data());
|
||||
|
@ -1612,12 +1612,19 @@ void startSignalHandlerThread()
|
|||
std::thread(signalHandlerThread, set).detach();
|
||||
}
|
||||
|
||||
void restoreSignals()
|
||||
static void restoreSignals()
|
||||
{
|
||||
if (sigprocmask(SIG_SETMASK, &savedSignalMask, nullptr))
|
||||
throw SysError("restoring signals");
|
||||
}
|
||||
|
||||
void restoreProcessContext()
|
||||
{
|
||||
restoreSignals();
|
||||
|
||||
restoreAffinity();
|
||||
}
|
||||
|
||||
/* RAII helper to automatically deregister a callback. */
|
||||
struct InterruptCallbackImpl : InterruptCallback
|
||||
{
|
||||
|
@ -1680,10 +1687,11 @@ string showBytes(uint64_t bytes)
|
|||
}
|
||||
|
||||
|
||||
// FIXME: move to libstore/build
|
||||
void commonChildInit(Pipe & logPipe)
|
||||
{
|
||||
const static string pathNullDevice = "/dev/null";
|
||||
restoreSignals();
|
||||
restoreProcessContext();
|
||||
|
||||
/* Put the child in a separate session (and thus a separate
|
||||
process group) so that it has no controlling terminal (meaning
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue