summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/globals.c')
-rw-r--r--libglusterfs/src/globals.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 38727a25afe..ae7fdcd616a 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -149,6 +149,61 @@ glusterfs_this_set (xlator_t *this)
}
+/* IS_CENTRAL_LOG */
+
+static pthread_key_t central_log_flag_key;
+
+void
+glusterfs_central_log_flag_destroy (void *ptr)
+{
+ if (ptr)
+ FREE (ptr);
+}
+
+
+int
+glusterfs_central_log_flag_init ()
+{
+ int ret = 0;
+
+ ret = pthread_key_create (&central_log_flag_key,
+ glusterfs_central_log_flag_destroy);
+
+ if (ret != 0) {
+ return ret;
+ }
+
+ pthread_setspecific (central_log_flag_key, (void *) 0);
+
+ return ret;
+}
+
+
+void
+glusterfs_central_log_flag_set ()
+{
+ pthread_setspecific (central_log_flag_key, (void *) 1);
+}
+
+
+long
+glusterfs_central_log_flag_get ()
+{
+ long flag = 0;
+
+ flag = (long) pthread_getspecific (central_log_flag_key);
+
+ return flag;
+}
+
+
+void
+glusterfs_central_log_flag_unset ()
+{
+ pthread_setspecific (central_log_flag_key, (void *) 0);
+}
+
+
int
glusterfs_globals_init ()
{
@@ -161,6 +216,10 @@ glusterfs_globals_init ()
ret = glusterfs_this_init ();
if (ret)
goto out;
+
+ ret = glusterfs_central_log_flag_init ();
+ if (ret)
+ goto out;
out:
return ret;
}