Skip to content

Commit

Permalink
use syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Mar 4, 2022
1 parent 0cb2912 commit f3bdf6c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* @file trace.c RE_TRACE helpers
* JSON traces (chrome://tracing)
*/
#define _DEFAULT_SOURCE 1

#include <re_types.h>
#include <re_mem.h>
#include <re_trace.h>
Expand All @@ -17,9 +19,13 @@

#if defined(WIN32)
#include <windows.h>
#else
#define _GNU_SOURCE
#define __USE_GNU 1
#endif

#ifdef LINUX
#include <sys/syscall.h>
#endif

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

Expand Down Expand Up @@ -68,7 +74,7 @@ static inline unsigned long get_thread_id(void)
#if defined(WIN32)
return (unsigned long)GetCurrentThreadId();
#elif defined(LINUX)
return (unsigned long)gettid();
return (unsigned long)syscall(SYS_gettid);
#elif defined(HAVE_PTHREAD)
#if defined(DARWIN) || defined(FREEBSD) || defined(OPENBSD) || \
defined(NETBSD) || defined(DRAGONFLY)
Expand Down

0 comments on commit f3bdf6c

Please sign in to comment.