|
| 1 | +commit 129137d5182967dbfcfec66bad843df2a992a78f |
| 2 | +Author: fanquake < [email protected]> |
| 3 | +Date: Mon Jan 3 20:13:33 2022 +0800 |
| 4 | + |
| 5 | + problem: kevent udata is now void* on NetBSD Current (10) |
| 6 | + |
| 7 | + solution: check for the intptr_t variant in configure. |
| 8 | + |
| 9 | +diff --git a/configure.ac b/configure.ac |
| 10 | +index 1a571291..402f8b86 100644 |
| 11 | +--- a/configure.ac |
| 12 | ++++ b/configure.ac |
| 13 | +@@ -308,6 +308,27 @@ case "${host_os}" in |
| 14 | + if test "x$libzmq_netbsd_has_atomic" = "xno"; then |
| 15 | + AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes]) |
| 16 | + fi |
| 17 | ++ # NetBSD Current (to become 10) has changed the type of udata in it's |
| 18 | ++ # kevent struct from intptr_t to void * to align with darwin and other |
| 19 | ++ # BSDs, see upstream commit: |
| 20 | ++ # https://github.com/NetBSD/src/commit/e5ead823eb916b56589d2c6c560dbcfe4a2d0afc |
| 21 | ++ AC_MSG_CHECKING([whether kevent udata type is intptr_t]) |
| 22 | ++ AC_LANG_PUSH([C++]) |
| 23 | ++ AC_LINK_IFELSE([AC_LANG_PROGRAM( |
| 24 | ++ [[#include <sys/types.h> |
| 25 | ++ #include <sys/event.h> |
| 26 | ++ #include <sys/time.h>]], |
| 27 | ++ [[struct kevent ev; |
| 28 | ++ intptr_t udata; |
| 29 | ++ EV_SET(&ev, 0, 0, EV_ADD, 0, 0, udata); |
| 30 | ++ return 0;]])], |
| 31 | ++ [libzmq_netbsd_kevent_udata_intptr_t=yes], |
| 32 | ++ [libzmq_netbsd_kevent_udata_intptr_t=no]) |
| 33 | ++ AC_LANG_POP([C++]) |
| 34 | ++ AC_MSG_RESULT([$libzmq_netbsd_kevent_udata_intptr_t]) |
| 35 | ++ if test "x$libzmq_netbsd_kevent_udata_intptr_t" = "xyes"; then |
| 36 | ++ AC_DEFINE(ZMQ_NETBSD_KEVENT_UDATA_INTPTR_T, 1, [kevent udata type is intptr_t]) |
| 37 | ++ fi |
| 38 | + ;; |
| 39 | + *openbsd*|*bitrig*) |
| 40 | + # Define on OpenBSD to enable all library features |
| 41 | +diff --git a/src/kqueue.cpp b/src/kqueue.cpp |
| 42 | +index 53d82ac4..a6a7a7f2 100644 |
| 43 | +--- a/src/kqueue.cpp |
| 44 | ++++ b/src/kqueue.cpp |
| 45 | +@@ -46,9 +46,9 @@ |
| 46 | + #include "i_poll_events.hpp" |
| 47 | + #include "likely.hpp" |
| 48 | + |
| 49 | +-// NetBSD defines (struct kevent).udata as intptr_t, everyone else |
| 50 | +-// as void *. |
| 51 | +-#if defined ZMQ_HAVE_NETBSD |
| 52 | ++// NetBSD up to version 9 defines (struct kevent).udata as intptr_t, |
| 53 | ++// everyone else as void *. |
| 54 | ++#if defined ZMQ_HAVE_NETBSD && defined(ZMQ_NETBSD_KEVENT_UDATA_INTPTR_T) |
| 55 | + #define kevent_udata_t intptr_t |
| 56 | + #else |
| 57 | + #define kevent_udata_t void * |
0 commit comments