public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: teigland@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, master, updated. cluster-2.99.00-28-gbde3c7b Date: Wed, 07 May 2008 16:18:00 -0000 [thread overview] Message-ID: <20080507161815.21582.qmail@sourceware.org> (raw) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=bde3c7b21d7270174285956b81329efe84d50ba4 The branch, master has been updated via bde3c7b21d7270174285956b81329efe84d50ba4 (commit) from de09a3c352c5c5bb9dcc4e63d22a38c23798b4ea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bde3c7b21d7270174285956b81329efe84d50ba4 Author: David Teigland <dct@localhost.localdomain> Date: Wed May 7 11:16:28 2008 -0500 daemons: mostly daemonization stuff - do lockfile before daemonizing - use daemon(3) - openlog even if not forking - other little odds and ends Signed-off-by: David Teigland <dct@localhost.localdomain> ----------------------------------------------------------------------- Summary of changes: dlm/tool/main.c | 2 +- fence/fenced/main.c | 9 +++------ group/dlm_controld/deadlock.c | 4 ++-- group/dlm_controld/main.c | 34 +++++++++------------------------- group/gfs_controld/lock_dlm.h | 1 - group/gfs_controld/main.c | 39 ++++++++++----------------------------- group/tool/main.c | 2 +- 7 files changed, 26 insertions(+), 65 deletions(-) diff --git a/dlm/tool/main.c b/dlm/tool/main.c index 13a7a23..c22dc3c 100644 --- a/dlm/tool/main.c +++ b/dlm/tool/main.c @@ -55,7 +55,7 @@ static void print_usage(void) { printf("Usage:\n"); printf("\n"); - printf("%s [options] [join|leave|lockdump|lockdebug|list|dump|plocks|deadlock_check]\n", prog_name); + printf("%s [options] [join|leave|lockdump|lockdebug|ls|dump|plocks|deadlock_check]\n", prog_name); printf("\n"); printf("Options:\n"); printf(" -v Verbose output\n"); diff --git a/fence/fenced/main.c b/fence/fenced/main.c index 2201bcc..647494a 100644 --- a/fence/fenced/main.c +++ b/fence/fenced/main.c @@ -867,19 +867,16 @@ int main(int argc, char **argv) read_arguments(argc, argv); + lockfile(); + if (!daemon_debug_opt) { if (daemon(0, 0) < 0) { perror("main: cannot fork"); exit(EXIT_FAILURE); } - if(chdir("/") < 0) { - perror("main: unable to chdir"); - exit(EXIT_FAILURE); - } umask(0); - openlog("fenced", LOG_PID, LOG_DAEMON); } - lockfile(); + openlog("fenced", LOG_PID, LOG_DAEMON); signal(SIGTERM, sigterm_handler); set_oom_adj(-16); diff --git a/group/dlm_controld/deadlock.c b/group/dlm_controld/deadlock.c index 36a4e5f..5c189a4 100644 --- a/group/dlm_controld/deadlock.c +++ b/group/dlm_controld/deadlock.c @@ -367,7 +367,7 @@ static int read_debugfs_master(struct lockspace *ls) return -1; /* skip the header on the first line */ - if(!fgets(line, LOCK_LINE_MAX, file)) { + if (!fgets(line, LOCK_LINE_MAX, file)) { log_error("Unable to read %s: %d", path, errno); goto out; } @@ -438,7 +438,7 @@ static int read_debugfs_locks(struct lockspace *ls) return -1; /* skip the header on the first line */ - if(!fgets(line, LOCK_LINE_MAX, file)) { + if (!fgets(line, LOCK_LINE_MAX, file)) { log_error("Unable to read %s: %d", path, errno); goto out; } diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index ca4d3c0..dc305e7 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -985,29 +985,6 @@ static void lockfile(void) } } -static void daemonize(void) -{ - pid_t pid = fork(); - if (pid < 0) { - perror("main: cannot fork"); - exit(EXIT_FAILURE); - } - if (pid) - exit(EXIT_SUCCESS); - setsid(); - if(chdir("/") < 0) { - perror("main: unable to chdir"); - exit(EXIT_FAILURE); - } - umask(0); - close(0); - close(1); - close(2); - openlog("dlm_controld", LOG_PID, LOG_DAEMON); - - lockfile(); -} - static void print_usage(void) { printf("Usage:\n"); @@ -1176,8 +1153,15 @@ int main(int argc, char **argv) read_arguments(argc, argv); - if (!daemon_debug_opt) - daemonize(); + lockfile(); + + if (!daemon_debug_opt) { + if (daemon(0, 0) < 0) { + perror("daemon error"); + exit(EXIT_FAILURE); + } + } + openlog("dlm_controld", LOG_PID, LOG_DAEMON); signal(SIGTERM, sigterm_handler); read_ccs(); diff --git a/group/gfs_controld/lock_dlm.h b/group/gfs_controld/lock_dlm.h index 3cc96d2..c5bcb80 100644 --- a/group/gfs_controld/lock_dlm.h +++ b/group/gfs_controld/lock_dlm.h @@ -67,7 +67,6 @@ enum { DO_DELIVER, }; -extern char *prog_name; extern int plock_debug_opt; extern int daemon_debug_opt; extern char daemon_debug_buf[256]; diff --git a/group/gfs_controld/main.c b/group/gfs_controld/main.c index 14c7f14..a31a2cc 100644 --- a/group/gfs_controld/main.c +++ b/group/gfs_controld/main.c @@ -781,34 +781,11 @@ static void lockfile(void) } } -void daemonize(void) -{ - pid_t pid = fork(); - if (pid < 0) { - perror("main: cannot fork"); - exit(EXIT_FAILURE); - } - if (pid) - exit(EXIT_SUCCESS); - setsid(); - if(chdir("/") < 0) { - perror("main: unable to chdir"); - exit(EXIT_FAILURE); - } - umask(0); - close(0); - close(1); - close(2); - openlog("gfs_controld", LOG_PID, LOG_DAEMON); - - lockfile(); -} - static void print_usage(void) { printf("Usage:\n"); printf("\n"); - printf("%s [options]\n", prog_name); + printf("gfs_controld [options]\n"); printf("\n"); printf("Options:\n"); printf("\n"); @@ -944,8 +921,6 @@ void set_scheduler(void) int main(int argc, char **argv) { - prog_name = argv[0]; - INIT_LIST_HEAD(&mounts); INIT_LIST_HEAD(&withdrawn_mounts); @@ -959,8 +934,15 @@ int main(int argc, char **argv) decode_arguments(argc, argv); - if (!daemon_debug_opt) - daemonize(); + lockfile(); + + if (!daemon_debug_opt) { + if (daemon(0, 0) < 0) { + perror("daemon error"); + exit(EXIT_FAILURE); + } + } + openlog("gfs_controld", LOG_PID, LOG_DAEMON); /* ccs settings override the defaults, but not the command line */ set_ccs_config(); @@ -1002,7 +984,6 @@ void daemon_dump_save(void) } } -char *prog_name; int plock_debug_opt; int daemon_debug_opt; char daemon_debug_buf[256]; diff --git a/group/tool/main.c b/group/tool/main.c index 3a0d7d4..0a63aae 100644 --- a/group/tool/main.c +++ b/group/tool/main.c @@ -245,7 +245,7 @@ char *state_str(group_data_t *data) snprintf(buf, 127, "%s %d %llx %d", ev_state_str(data->event_state), data->event_nodeid, - data->event_id, + (unsigned long long)data->event_id, data->event_local_status); else snprintf(buf, 127, "%s", ev_state_str(data->event_state)); hooks/post-receive -- Cluster Project
reply other threads:[~2008-05-07 16:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080507161815.21582.qmail@sourceware.org \ --to=teigland@sourceware.org \ --cc=cluster-cvs@sources.redhat.com \ --cc=cluster-devel@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).