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

Jake Freeland jake at technologyfriends.net
Fri Oct 7 21:30:56 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 | 3 +--
 lib/igt_aux.h               | 2 +-
 tests/i915/gem_close_race.c | 3 +--
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index c67b23cf..e98bb2a7 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -48,8 +48,7 @@
 
 #include "i915/gem_create.h"
 #include "i915/gem_ring.h"
-
-#define sigev_notify_thread_id _sigev_un._tid
+#include "igt_aux.h"
 
 static volatile int done;
 
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index c98cf28f..e734c87b 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
+# define sigev_notify_thread_id _sigev_un._tid
 #endif
-#define sigev_notify_thread_id _sigev_un._tid
 
 /* 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..e37a8882 100644
--- a/tests/i915/gem_close_race.c
+++ b/tests/i915/gem_close_race.c
@@ -46,6 +46,7 @@
 #include "i915/gem_create.h"
 #include "i915/gem_mman.h"
 #include "igt.h"
+#include "igt_aux.h"
 
 #define OBJECT_SIZE (256 * 1024)
 
@@ -61,8 +62,6 @@ static bool has_softpin;
 static uint64_t exec_addr;
 static uint64_t data_addr;
 
-#define sigev_notify_thread_id _sigev_un._tid
-
 static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
 {
 	struct drm_i915_gem_relocation_entry reloc[2];
-- 
2.37.3



More information about the igt-dev mailing list