From 6d549aecf5256b0664a33482481627d0dd30a80d Mon Sep 17 00:00:00 2001 From: nia Date: Tue, 25 May 2021 13:34:52 +0200 Subject: [PATCH] threadpool_generic: support future NetBSD kqueue versions In NetBSD 9.x and prior, udata is an intptr_t, but in 10.x (current development branch) it was changed to be a void * for compatibility with other BSDs a year or so ago. Unfortunately, this does not simplify the code, as NetBSD 8.x and 9.x are still supported and will be for a few more years. Signed-off-by: Nia Alarie --- sql/threadpool_generic.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index b6bb47e8f29..f59c7cbea9d 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -234,14 +234,19 @@ static void *native_event_get_userdata(native_event *event) #elif defined(HAVE_KQUEUE) /* - NetBSD is incompatible with other BSDs , last parameter in EV_SET macro - (udata, user data) needs to be intptr_t, whereas it needs to be void* - everywhere else. + NetBSD prior to 9.99.17 is incompatible with other BSDs, last parameter + in EV_SET macro (udata, user data) needs to be intptr_t, whereas it needs + to be void* everywhere else. */ #ifdef __NetBSD__ +#include +# if !__NetBSD_Prereq__(9,99,17) #define MY_EV_SET(a, b, c, d, e, f, g) EV_SET(a, b, c, d, e, f, (intptr_t)g) -#else +# endif +#endif + +#ifndef MY_EV_SET #define MY_EV_SET(a, b, c, d, e, f, g) EV_SET(a, b, c, d, e, f, g) #endif