diff --git a/lix/libutil/signals.cc b/lix/libutil/signals.cc index 1e9bf7b21..aca599a67 100644 --- a/lix/libutil/signals.cc +++ b/lix/libutil/signals.cc @@ -122,16 +122,10 @@ void saveSignalMask() { savedSignalMaskIsSet = true; } -void startSignalHandlerThread(DoSignalSave doSave) +void startSignalHandlerThread() { updateWindowSize(); - - switch (doSave) { - case DoSignalSave::Save: - saveSignalMask(); - break; - case DoSignalSave::DontSaveBecauseAdvancedProcess: break; - } + saveSignalMask(); sigset_t set; sigemptyset(&set); diff --git a/lix/libutil/signals.hh b/lix/libutil/signals.hh index 3abdd05fe..f9d9bc93e 100644 --- a/lix/libutil/signals.hh +++ b/lix/libutil/signals.hh @@ -1,24 +1,16 @@ #pragma once /** @file Signal handling in Lix * - * Processes are expected to be either: - * - Advanced processes which call into Lix's logic, like the daemon processes. - * - Basic processes that are just going to execve. - * - * Processes should be set up accordingly following a fork: - * In the first case, such processes should have a signal handler thread that - * catches SIGINT and dispatches it to the rest of the system so they should - * call startSignalHandlerThread(). In the second case, processes should call - * restoreProcessContext(), possibly with `false` (depends on whether mounts - * should be restored), which will unmask SIGINT and other signals that were - * previously masked in an advanced process such as the one that started - * them, so the process can be interrupted. + * Processes are expected to be simple, mostly just calling execve. + * All processes should call restoreProcessContext(), possibly with + * `false` (depends on whether mounts should be restored), which will unmask + * SIGINT and other signals that were previously masked in an advanced process + * such as the one that started them, so the process can be interrupted. * * It is generally a mistake to fork a process without at least calling * restoreSignals() or restoreProcessContext(). */ - #include "lix/libutil/error.hh" #include "lix/libutil/result.hh" @@ -66,32 +58,14 @@ MakeError(Interrupted, BaseError); void restoreSignals(); - -/** - * Whether to save the signal mask when starting the signal handler thread. - * - * The signal mask shouldn't be saved if the current signal mask is the one for - * processes with a signal handler thread. - */ -enum class DoSignalSave -{ - Save, - DontSaveBecauseAdvancedProcess, -}; - /** * Start a thread that handles various signals. Also block those signals * on the current thread (and thus any threads created by it). * - * Optionally saves the signal mask before changing the mask to block those + * Also saves the signal mask before changing the mask to block those * signals. See saveSignalMask(). - * - * This should also be executed after certain forks from Lix processes that - * expect to be "advanced" (see file doc comment), since the signal thread will - * die on fork. Of course this whole situation is kind of unsound since we - * definitely violate async-signal-safety requirements, but, well. */ -void startSignalHandlerThread(DoSignalSave doSave = DoSignalSave::Save); +void startSignalHandlerThread(); /** * Saves the signal mask, which is the signal mask that nix will restore