mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
keventd: drop SIGCHLD save/restore dance, libuev reaps for us
modprobe_load() and run_program() used to temporarily restore the default SIGCHLD handler around fork+waitpid because the main loop set SIGCHLD=SIG_IGN. With the libuev conversion, sigchld_cb in keventd.c handles reaping via signalfd -- and signalfd does not interfere with synchronous waitpid(pid, ...) -- so the dance is dead code. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
2 files changed
+1
-23
No files matched your search
@@ -1038,13 +1038,9 @@ fail:
|
||||
* Synchronous: waits for modprobe to complete before returning so
|
||||
* that rules running after `kmod load` (e.g. IMPORT{builtin}=blkid
|
||||
* once the filesystem driver is in) see the post-load state.
|
||||
* keventd's main loop uses SIGCHLD=SIG_IGN to auto-reap stray
|
||||
* children, so we temporarily restore the default handler here to
|
||||
* make waitpid() observable.
|
||||
*/
|
||||
int modprobe_load(const char *modalias)
|
||||
{
|
||||
struct sigaction sa_dfl, sa_old;
|
||||
pid_t pid;
|
||||
int status = 0;
|
||||
|
||||
@@ -1053,15 +1049,9 @@ int modprobe_load(const char *modalias)
|
||||
|
||||
logit(LOG_DEBUG, "Loading module for %s", modalias);
|
||||
|
||||
sigemptyset(&sa_dfl.sa_mask);
|
||||
sa_dfl.sa_flags = 0;
|
||||
sa_dfl.sa_handler = SIG_DFL;
|
||||
sigaction(SIGCHLD, &sa_dfl, &sa_old);
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
logit(LOG_ERR, "fork failed: %s", strerror(errno));
|
||||
sigaction(SIGCHLD, &sa_old, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1072,7 +1062,6 @@ int modprobe_load(const char *modalias)
|
||||
|
||||
while (waitpid(pid, &status, 0) < 0 && errno == EINTR)
|
||||
;
|
||||
sigaction(SIGCHLD, &sa_old, NULL);
|
||||
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||
return -1;
|
||||
|
||||
Reference in new issue
Block a user