[LEDE-DEV] [PATCH] uloop: make SIGCHLD signal handling optional

Petar Paradzik petar.paradzik at sartura.hr
Mon Jul 3 04:37:56 PDT 2017


Some programs want to manage their own child life cycle without using
SIGCHLD signal handler. In these cases, uloop is reaping children for
them because they don't have SIGCHLD handler set. This patch makes it
possible to disable reaping children through 'uloop_handle_sigchld'
variable.

Signed-off-by: Petar Paradzik <petar.paradzik at sartura.hr>
---
 uloop.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/uloop.c b/uloop.c
index d2f41bb..c43082b 100644
--- a/uloop.c
+++ b/uloop.c
@@ -58,6 +58,7 @@ static struct list_head processes = LIST_HEAD_INIT(processes);
 
 static int poll_fd = -1;
 bool uloop_cancelled = false;
+bool uloop_handle_sigchld = true;
 static int uloop_status = 0;
 static bool do_sigchld = false;
 
@@ -462,7 +463,9 @@ static void uloop_setup_signals(bool add)
 
 	uloop_install_handler(SIGINT, uloop_handle_sigint, &old_sigint, add);
 	uloop_install_handler(SIGTERM, uloop_handle_sigint, &old_sigterm, add);
-	uloop_install_handler(SIGCHLD, uloop_sigchld, &old_sigchld, add);
+
+	if (uloop_handle_sigchld)
+		uloop_install_handler(SIGCHLD, uloop_sigchld, &old_sigchld, add);
 
 	uloop_ignore_signal(SIGPIPE, add);
 }
-- 
2.13.1




More information about the Lede-dev mailing list