[PATCH] Move qb_loop creation after daemonization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Creating qb_loop before daemonization is not problem for poll or epoll
type loops, but it's problem for kqueue, because kqueue is not shared
in child with parent after fork.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/main.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/exec/main.c b/exec/main.c
index abd8fbd..6a5dc45 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1088,16 +1088,9 @@ int main (int argc, char **argv, char **envp)
 	log_printf (LOGSYS_LEVEL_NOTICE, "Corosync Cluster Engine ('%s'): started and ready to provide service.", VERSION);
 	log_printf (LOGSYS_LEVEL_INFO, "Corosync built-in features:" PACKAGE_FEATURES "");
 
-	corosync_poll_handle = qb_loop_create ();
-
-	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_LOW,
-		SIGUSR2, NULL, sig_diag_handler, NULL);
-	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
-		SIGINT, NULL, sig_exit_handler, NULL);
-	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
-		SIGQUIT, NULL, sig_exit_handler, NULL);
-	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
-		SIGTERM, NULL, sig_exit_handler, NULL);
+	/*
+	 * Other signals are registered later via qb_loop_signal_add
+	 */
 	(void)signal (SIGSEGV, sigsegv_handler);
 	(void)signal (SIGABRT, sigabrt_handler);
 #if MSG_NOSIGNAL != 0
@@ -1199,6 +1192,18 @@ int main (int argc, char **argv, char **envp)
 	if (background) {
 		corosync_tty_detach ();
 	}
+
+	corosync_poll_handle = qb_loop_create ();
+
+	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_LOW,
+		SIGUSR2, NULL, sig_diag_handler, NULL);
+	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
+		SIGINT, NULL, sig_exit_handler, NULL);
+	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
+		SIGQUIT, NULL, sig_exit_handler, NULL);
+	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
+		SIGTERM, NULL, sig_exit_handler, NULL);
+
 	if (logsys_thread_start() != 0) {
 		log_printf (LOGSYS_LEVEL_ERROR, "Can't initialize log thread");
 		corosync_exit_error (COROSYNC_DONE_LOGCONFIGREAD);
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux