From 158efe6cc8d8a6e3d8e7b9b4a909c890bd88cf7e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 6 Sep 2025 16:32:19 +0200 Subject: [PATCH] Remove unused function setChildSignalMask() (cherry picked from commit a44dcbff13b7c70aaefd9e99517b30c0546f36d9) --- .../unix/include/nix/util/signals-impl.hh | 9 --------- src/libutil/unix/signals.cc | 20 ------------------- 2 files changed, 29 deletions(-) diff --git a/src/libutil/unix/include/nix/util/signals-impl.hh b/src/libutil/unix/include/nix/util/signals-impl.hh index 1bcc90cdf..2456119be 100644 --- a/src/libutil/unix/include/nix/util/signals-impl.hh +++ b/src/libutil/unix/include/nix/util/signals-impl.hh @@ -42,13 +42,6 @@ extern thread_local std::function interruptCheck; void _interrupted(); -/** - * Sets the signal mask. Like saveSignalMask() but for a signal set that doesn't - * necessarily match the current thread's mask. - * See saveSignalMask() to set the saved mask to the current mask. - */ -void setChildSignalMask(sigset_t * sigs); - /** * Start a thread that handles various signals. Also block those signals * on the current thread (and thus any threads created by it). @@ -60,8 +53,6 @@ void startSignalHandlerThread(); /** * Saves the signal mask, which is the signal mask that nix will restore * before creating child processes. - * See setChildSignalMask() to set an arbitrary signal mask instead of the - * current mask. */ void saveSignalMask(); diff --git a/src/libutil/unix/signals.cc b/src/libutil/unix/signals.cc index 8a94cc2b1..d6efd6aa7 100644 --- a/src/libutil/unix/signals.cc +++ b/src/libutil/unix/signals.cc @@ -99,26 +99,6 @@ void unix::triggerInterrupt() static sigset_t savedSignalMask; static bool savedSignalMaskIsSet = false; -void unix::setChildSignalMask(sigset_t * sigs) -{ - assert(sigs); // C style function, but think of sigs as a reference - -#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 1) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE) \ - || (defined(_POSIX_SOURCE) && _POSIX_SOURCE) - sigemptyset(&savedSignalMask); - // There's no "assign" or "copy" function, so we rely on (math) idempotence - // of the or operator: a or a = a. - sigorset(&savedSignalMask, sigs, sigs); -#else - // Without sigorset, our best bet is to assume that sigset_t is a type that - // can be assigned directly, such as is the case for a sigset_t defined as - // an integer type. - savedSignalMask = *sigs; -#endif - - savedSignalMaskIsSet = true; -} - void unix::saveSignalMask() { if (sigprocmask(SIG_BLOCK, nullptr, &savedSignalMask))