summaryrefslogtreecommitdiff
path: root/kqueue.c
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2019-10-04 01:26:47 +0200
committerKamil Rytarowski <n54@gmx.com>2019-10-04 01:30:39 +0200
commit72e6eff0251bffec72e0b8b2cedf72f173c8b9e9 (patch)
tree2db04f9217f7abba2f5b43383c4be22d20cb5304 /kqueue.c
parent8d5c5650d281019832fa7b5133b85c7ad29f664e (diff)
downloadlibevent-72e6eff0251bffec72e0b8b2cedf72f173c8b9e9.tar.gz
Fix compat with NetBSD >= 10
kevent::udata was switched from intptr_t to void*. Handle both cases with the GCC extension typeof().
Diffstat (limited to 'kqueue.c')
-rw-r--r--kqueue.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kqueue.c b/kqueue.c
index d08f512c..dfd7751d 100644
--- a/kqueue.c
+++ b/kqueue.c
@@ -51,7 +51,10 @@
/* Some platforms apparently define the udata field of struct kevent as
* intptr_t, whereas others define it as void*. There doesn't seem to be an
* easy way to tell them apart via autoconf, so we need to use OS macros. */
-#if defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
+#if defined(__NetBSD__)
+#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x))
+#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
+#elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
#define PTR_TO_UDATA(x) ((intptr_t)(x))
#define INT_TO_UDATA(x) ((intptr_t)(x))
#else