This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cluster Project branch, master, updated. cluster-2.99.00-28-gbde3c7b


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]