[igt-dev] [PATCH i-g-t 09/10] Restrict sigev_notify_thread_id macro definition to Linux

Jake Freeland jake at technologyfriends.net
Fri Oct 7 04:07:17 UTC 2022


The `#define sigev_notify_thread_id _sigev_un._tid` macro differs on
FreeBSD. This patch uses ifdefs to stop the compiler from overriding
FreeBSD's existing definition.

Signed-off-by: Jake Freeland <jfree at freebsd.org>
---
 benchmarks/gem_syslatency.c | 2 ++
 lib/igt_aux.h               | 2 +-
 tests/i915/gem_close_race.c | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 395d2e71..366c8af6 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -53,7 +53,9 @@
 #include "igt_freebsd.h"
 #endif
 
+#ifdef __linux__
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static volatile int done;
 
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index c98cf28f..569b92d7 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -48,8 +48,8 @@
 # ifndef HAVE_GETTID
 #  define gettid() (pid_t)(syscall(__NR_gettid))
 # endif
-#endif
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 /* auxialiary igt helpers from igt_aux.c */
 /* generally useful helpers */
diff --git a/tests/i915/gem_close_race.c b/tests/i915/gem_close_race.c
index 938fde8f..42fe1657 100644
--- a/tests/i915/gem_close_race.c
+++ b/tests/i915/gem_close_race.c
@@ -61,7 +61,9 @@ static bool has_softpin;
 static uint64_t exec_addr;
 static uint64_t data_addr;
 
+#ifdef __linux__
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
 {
-- 
2.37.3



More information about the igt-dev mailing list