From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacek Konieczny Date: Sat, 3 Nov 2012 16:27:55 +0100 Subject: [Cluster-devel] [PATCH 1/2] --foreground option added to dlm_controld In-Reply-To: <1351956476-4261-1-git-send-email-jajcus@jajcus.net> References: <1351956476-4261-1-git-send-email-jajcus@jajcus.net> Message-ID: <1351956476-4261-2-git-send-email-jajcus@jajcus.net> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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