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

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 7 11:25:21 UTC 2022


Hi Jake,

On 2022-10-06 at 23:07:17 -0500, Jake Freeland wrote:
> 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>

Please send this outside of your series, it can be merged as
separate patch. See also some notes below.

> ---
>  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

Instead of this please just include igt_aux.h header.

>  
>  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
--- ^
Put space before define to keep style.

> +#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

Same here, include igt_aux.h

Regards,
Kamil

>  
>  static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
>  {
> -- 
> 2.37.3
> 


More information about the igt-dev mailing list