summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2019-04-23 18:50:56 -0400
committerLyude Paul <lyude@redhat.com>2019-05-07 17:37:56 -0400
commit998288337d87b9fac8ae3a2f06ee97bfa9bfdfa3 (patch)
tree01cf7f5109a92232da85b3ff50343b3106c31dc6 /lib
parent71a46ea98a946437993b16b1cb2433f85d19a94e (diff)
Use gettid() wrapper everywhere
Currently we have multiple different parts of IGT that define their own wrapper around the gettid() syscall (or just call it directly with no wrapper). Additionally, add the appropriate #includes for igt_aux.h to make sure syscall() is available. Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_aux.h7
-rw-r--r--lib/igt_core.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 67e8fbf4..a6e3770e 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -32,11 +32,16 @@
#include <stdbool.h>
#include <stddef.h>
#include <sys/time.h>
+#ifdef __linux__
+# include <sys/syscall.h>
+#endif
#include <i915/gem_submission.h>
/* signal interrupt helpers */
-#define gettid() syscall(__NR_gettid)
+#ifdef __linux__
+# define gettid() syscall(__NR_gettid)
+#endif
#define sigev_notify_thread_id _sigev_un._tid
/* auxialiary igt helpers from igt_aux.c */
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 3141d923..43fa197f 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1992,7 +1992,7 @@ static void fatal_sig_handler(int sig)
#ifdef __linux__
/* Workaround cached PID and TID races on glibc and Bionic libc. */
pid_t pid = syscall(SYS_getpid);
- pid_t tid = syscall(SYS_gettid);
+ pid_t tid = gettid();
syscall(SYS_tgkill, pid, tid, sig);
#else