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

[Cluster-devel] [PATCH 1/2] --foreground option added to dlm_controld



Foreground is the preferred way to run services from systemd
and it is easier to provide startup notification this way.

Signed-off-by: Jacek Konieczny <jajcus jajcus net>
---
 dlm_controld/dlm_controld.8 |    3 +++
 dlm_controld/dlm_daemon.h   |    1 +
 dlm_controld/main.c         |    7 ++++++-
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlm_controld/dlm_controld.8 b/dlm_controld/dlm_controld.8
index 262ef8a..c9011fd 100644
--- a/dlm_controld/dlm_controld.8
+++ b/dlm_controld/dlm_controld.8
@@ -23,6 +23,9 @@ For default settings, see dlm_controld -h.
 .B --daemon_debug | -D
         enable debugging to stderr and don't fork
 
+.B --foreground
+        don't fork
+
 .B --log_debug | -K
         enable kernel dlm debugging messages
 
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 916ee58..377f28d 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -109,6 +109,7 @@ enum {
         enable_quorum_lockspace_ind,
         help_ind,
         version_ind,
+        foreground_ind,
         dlm_options_max,
 };
 
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index fd469f9..deda60c 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -1245,6 +1245,11 @@ static void set_opt_defaults(void)
 			0, NULL,
 			"enable debugging to stderr and don't fork");
 
+	set_opt_default(foreground_ind,
+			"foreground", '\0', no_arg,
+			0, NULL,
+			"don't fork");
+
 	set_opt_default(log_debug_ind,
 			"log_debug", 'K', no_arg,
 			0, NULL,
@@ -1562,7 +1567,7 @@ int main(int argc, char **argv)
 	INIT_LIST_HEAD(&fs_register_list);
 	init_daemon();
 
-	if (!opt(daemon_debug_ind)) {
+	if (!opt(daemon_debug_ind) && !opt(foreground_ind)) {
 		if (daemon(0, 0) < 0) {
 			perror("daemon error");
 			exit(EXIT_FAILURE);
-- 
1.7.7.4


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