X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flogging%2Flog.c;h=613e056880fb3716ba2c6c5121421f7c8ec325a6;hb=26aad6001b3ddbca1d248f669bccd0da32a7760a;hp=6f8de7b4959bfebfb8eb1a363cb1cc35fa0d9110;hpb=0235b0db7de5bcacdb3650c92461f2ce5eb2143d;p=babeltrace.git diff --git a/src/logging/log.c b/src/logging/log.c index 6f8de7b4..613e0568 100644 --- a/src/logging/log.c +++ b/src/logging/log.c @@ -313,8 +313,8 @@ extern unsigned long pthread_getsequence_np(pthread_t *); #include #if defined(__linux__) #include - #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 #endif @@ -330,6 +330,9 @@ extern unsigned long pthread_getsequence_np(pthread_t *); #if defined(__MACH__) #include #endif +#if defined(__GNU__) + #include +#endif #define INLINE _BT_LOG_INLINE #define VAR_UNUSED(var) (void)var @@ -843,8 +846,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