From 4c3e05304161087b689c3ff1db66f59b9c26b70e Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 2 Dec 2015 12:45:31 +0100 Subject: [PATCH] [Patch 1/2]: System reconfiguration causing system freeze This patch fixes a hang when performing a system reconfiguration using `initctl reload`, `SIGHUP` or running `(f)init q`, which caused Finit to wait for SIGHUP:able services to stop. Signed-off-by: Joachim Nilsson --- service.c | 4 +++- svc.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/service.c b/service.c index c6507710..e5700968 100644 --- a/service.c +++ b/service.c @@ -430,7 +430,9 @@ void service_stop_dynamic(void) if (svc_is_removed(svc)) new_state = SVC_HALTED_STATE; - dyn_stop_cnt++; + if (!svc_has_sighup(svc)) + dyn_stop_cnt++; + _d("Marking service %s as state %d", svc->cmd, new_state); service_stop(svc, new_state); } diff --git a/svc.h b/svc.h index 3e039e78..b15266f5 100644 --- a/svc.h +++ b/svc.h @@ -152,6 +152,7 @@ int svc_next_id (char *cmd); int svc_is_unique (svc_t *svc); static inline int svc_in_runlevel(svc_t *svc, int runlevel) { return svc && ISSET(svc->runlevels, runlevel); } +static inline int svc_has_sighup(svc_t *svc) { return svc && 0 != svc->sighup; } static inline int svc_is_dynamic(svc_t *svc) { return svc && 0 != svc->mtime; } static inline int svc_is_removed(svc_t *svc) { return svc && -1 == svc->dirty; }