From 8ce08eb78165c9107925f23ac3057ee2cc01ff2f Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Ahmed Date: Tue, 15 Feb 2011 11:34:51 +0000 Subject: syncdaemon: Checking for the existence of gsyncd by trying to aquire a lock on the pidfile. If the locking succeeds then gsyncd is not running and if it fails then it means that gsyncd is running. Signed-off-by: Junaid Signed-off-by: Anand V. Avati BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570 --- cli/src/cli3_1-cops.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'cli') diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index 55c69f88f35..1f54b86bef8 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -2476,16 +2476,15 @@ gf_cli3_1_gsync_status (char *master, char *slave, file = fopen (pidfile, "r+"); if (file) { - //ret = lockf (fileno (file), F_TLOCK, 0); - //if (ret == 0) { - // lockf (fileno (file), F_ULOCK, 0); - // *status = -1; - //} - //else + ret = lockf (fileno (file), F_TEST, 0); + if (ret == 0) { + *status = -1; + } + else *status = 0; } else *status = -1; - + ret = 0; out: return ret; } -- cgit