Visibility hidden by default
[babeltrace.git] / src / logging / log.c
index 6f8de7b4959bfebfb8eb1a363cb1cc35fa0d9110..788c00c44c4adba6e86fe12ac3f02a6e70f05479 100644 (file)
@@ -313,8 +313,8 @@ extern unsigned long pthread_getsequence_np(pthread_t *);
        #include <sys/time.h>
        #if defined(__linux__)
                #include <linux/limits.h>
-       #elif (defined(__sun__) || defined(__CYGWIN__))
-               /* Solaris and Cygwin have no sys/syslimits.h */
+       #elif (defined(__sun__) || defined(__CYGWIN__) || defined(__GNU__))
+               /* Solaris, Cygwin and Hurd have no sys/syslimits.h */
        #else
                #include <sys/syslimits.h>
        #endif
@@ -330,6 +330,9 @@ extern unsigned long pthread_getsequence_np(pthread_t *);
 #if defined(__MACH__)
        #include <pthread.h>
 #endif
+#if defined(__GNU__)
+       #include <mach.h>
+#endif
 
 #define INLINE _BT_LOG_INLINE
 #define VAR_UNUSED(var) (void)var
@@ -643,7 +646,6 @@ static INSTRUMENTED_CONST buffer_cb g_buffer_cb = buffer_callback;
        #define OUT_DEBUGSTRING OUT_DEBUGSTRING_MASK, 0, out_debugstring_callback
 #endif
 
-BT_HIDDEN
 void bt_log_out_stderr_callback(const bt_log_message *const msg, void *arg)
 {
        VAR_UNUSED(arg);
@@ -687,7 +689,6 @@ static const bt_log_output out_stderr = {BT_LOG_OUT_STDERR};
        BT_LOG_DEFINE_GLOBAL_OUTPUT_LEVEL = 0;
 #endif
 
-BT_HIDDEN
 const bt_log_spec _bt_log_stderr_spec =
 {
        BT_LOG_GLOBAL_FORMAT,
@@ -843,8 +844,12 @@ static void pid_callback(int *const pid, int *const tid)
        *tid = gettid();
        #elif defined(__linux__)
        *tid = syscall(SYS_gettid);
-       #elif defined(__MACH__)
+       #elif defined(__APPLE__) && defined(__MACH__)
        *tid = (int)pthread_mach_thread_np(pthread_self());
+       #elif defined(__GNU__)
+       mach_port_t mach_port = mach_thread_self();
+       mach_port_deallocate(mach_task_self(), mach_port);
+       *tid = (int)mach_port;
        #else
                #define Platform not supported
        #endif
@@ -1245,25 +1250,21 @@ static void output_mem(const bt_log_spec *log, bt_log_message *const msg,
        }
 }
 
-BT_HIDDEN
 void bt_log_set_tag_prefix(const char *const prefix)
 {
        _bt_log_tag_prefix = prefix;
 }
 
-BT_HIDDEN
 void bt_log_set_mem_width(const unsigned w)
 {
        _bt_log_global_format.mem_width = w;
 }
 
-BT_HIDDEN
 void bt_log_set_output_level(const int lvl)
 {
        _bt_log_global_output_lvl = lvl;
 }
 
-BT_HIDDEN
 void bt_log_set_output_v(const unsigned mask, void *const arg,
                                                 const bt_log_output_cb callback)
 {
@@ -1333,7 +1334,6 @@ void _bt_log_write_imp(
        }
 }
 
-BT_HIDDEN
 void _bt_log_write_d(
                const char *const func, const char *const file, const unsigned line,
                const int lvl, const char *const tag,
@@ -1346,7 +1346,6 @@ void _bt_log_write_d(
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write_aux_d(
                const char *const func, const char *const file, const unsigned line,
                const bt_log_spec *const log, const int lvl, const char *const tag,
@@ -1359,7 +1358,6 @@ void _bt_log_write_aux_d(
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write(const int lvl, const char *const tag,
                                   const char *const fmt, ...)
 {
@@ -1369,7 +1367,6 @@ void _bt_log_write(const int lvl, const char *const tag,
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write_aux(
                const bt_log_spec *const log, const int lvl, const char *const tag,
                const char *const fmt, ...)
@@ -1380,7 +1377,6 @@ void _bt_log_write_aux(
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write_mem_d(
                const char *const func, const char *const file, const unsigned line,
                const int lvl, const char *const tag,
@@ -1395,7 +1391,6 @@ void _bt_log_write_mem_d(
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write_mem_aux_d(
                const char *const func, const char *const file, const unsigned line,
                const bt_log_spec *const log, const int lvl, const char *const tag,
@@ -1410,7 +1405,6 @@ void _bt_log_write_mem_aux_d(
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write_mem(const int lvl, const char *const tag,
                                           const void *const d, const unsigned d_sz,
                                           const char *const fmt, ...)
@@ -1422,7 +1416,6 @@ void _bt_log_write_mem(const int lvl, const char *const tag,
        va_end(va);
 }
 
-BT_HIDDEN
 void _bt_log_write_mem_aux(
                const bt_log_spec *const log, const int lvl, const char *const tag,
                const void *const d, const unsigned d_sz,
This page took 0.045379 seconds and 4 git commands to generate.