diff options
author | Mohammed Junaid Ahmed <junaid@gluster.com> | 2011-02-15 11:34:51 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-15 21:44:49 -0800 |
commit | 8ce08eb78165c9107925f23ac3057ee2cc01ff2f (patch) | |
tree | e22a07333a8bed2d5fdac2506073cb5ba227bcb0 /cli/src | |
parent | 1569424d1425a2f81c428d3968cd103ab2cad49e (diff) |
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 <junaid@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1570 (geosync related changes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli3_1-cops.c | 13 |
1 files changed, 6 insertions, 7 deletions
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; } |