]> git.proxmox.com Git - mirror_lxc.git/commitdiff
add shared lxc_log_fd into TLS
authorS.Çağlar Onur <caglar@10ur.org>
Fri, 7 Mar 2014 05:05:23 +0000 (00:05 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 7 Mar 2014 05:17:43 +0000 (23:17 -0600)
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/log.c
src/lxc/log.h

index 1dd1aa800127a12d92cbc1d5e8db0c0d254e3dcf..a9f98a4c694abfa759f012b0f03a35c202ca8ccc 100644 (file)
@@ -40,8 +40,8 @@
 #define LXC_LOG_PREFIX_SIZE    32
 #define LXC_LOG_BUFFER_SIZE    512
 
-int lxc_log_fd = -1;
 #ifdef HAVE_TLS
+__thread int lxc_log_fd = -1;
 static __thread char log_prefix[LXC_LOG_PREFIX_SIZE] = "lxc";
 static __thread char *log_fname = NULL;
 /* command line values for logfile or logpriority should always override
@@ -50,6 +50,7 @@ static __thread char *log_fname = NULL;
 static __thread int lxc_logfile_specified = 0;
 static __thread int lxc_loglevel_specified = 0;
 #else
+int lxc_log_fd = -1;
 static char log_prefix[LXC_LOG_PREFIX_SIZE] = "lxc";
 static char *log_fname = NULL;
 /* command line values for logfile or logpriority should always override
index ff8e47da8fddf10222f87f40f2bcb958e46ad0c8..5252869a679df4b08208112acd58d945b4556cfb 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _log_h
 #define _log_h
 
+#include "config.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <sys/time.h>
@@ -285,7 +287,11 @@ static inline void LXC_##PRIORITY(struct lxc_log_locinfo* locinfo, \
        ERROR("%s - " format, strerror(errno), ##__VA_ARGS__);          \
 } while (0)
 
+#ifdef HAVE_TLS
+extern __thread int lxc_log_fd;
+#else
 extern int lxc_log_fd;
+#endif
 
 extern int lxc_log_init(const char *name, const char *file,
                        const char *priority, const char *prefix, int quiet,