Files
haikuports/dev-libs/libevent/patches/libevent-2.1.12.patchset
OscarL 675a99fe82 libevent: (kqueue backend) Allow building without EVFILT_SIGNAL. (#10821)
Patchset thanks to waddlesplash.

(reference: #10815)

While we're at it, remove an unused .patchset for an older version.
2024-08-12 17:24:21 -04:00

84 lines
2.0 KiB
Plaintext

From 4fe7cfeafe027f14ff0b0112d5d605e2cb3e17ce Mon Sep 17 00:00:00 2001
From: Augustin Cavalier <waddlesplash@gmail.com>
Date: Mon, 12 Aug 2024 15:16:05 -0400
Subject: kqueue backend: Allow building without EVFILT_SIGNAL.
Just use the standard signal handling system in this case.
diff --git a/kqueue.c b/kqueue.c
index dfd7751..1e7ead6 100644
--- a/kqueue.c
+++ b/kqueue.c
@@ -105,6 +105,7 @@ const struct eventop kqops = {
EVENT_CHANGELIST_FDINFO_SIZE
};
+#ifdef EVFILT_SIGNAL
static const struct eventop kqsigops = {
"kqueue_signal",
NULL,
@@ -116,6 +117,7 @@ static const struct eventop kqsigops = {
0,
0
};
+#endif
static void *
kq_init(struct event_base *base)
@@ -164,7 +166,11 @@ kq_init(struct event_base *base)
goto err;
}
+#ifdef EVFILT_SIGNAL
base->evsigsel = &kqsigops;
+#else
+ evsig_init_(base);
+#endif
return (kqueueop);
err:
@@ -401,8 +407,10 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
which |= EV_READ;
} else if (events[i].filter == EVFILT_WRITE) {
which |= EV_WRITE;
+#ifdef EVFILT_SIGNAL
} else if (events[i].filter == EVFILT_SIGNAL) {
which |= EV_SIGNAL;
+#endif
#ifdef EVFILT_USER
} else if (events[i].filter == EVFILT_USER) {
base->is_notify_pending = 0;
@@ -412,9 +420,12 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
if (!which)
continue;
+#ifdef EVFILT_SIGNAL
if (events[i].filter == EVFILT_SIGNAL) {
evmap_signal_active_(base, events[i].ident, 1);
- } else {
+ } else
+#endif
+ {
evmap_io_active_(base, events[i].ident, which | EV_ET);
}
}
@@ -449,6 +460,7 @@ kq_dealloc(struct event_base *base)
kqop_free(kqop);
}
+#ifdef EVFILT_SIGNAL
/* signal handling */
static int
kq_sig_add(struct event_base *base, int nsignal, short old, short events, void *p)
@@ -510,6 +522,7 @@ kq_sig_del(struct event_base *base, int nsignal, short old, short events, void *
return (0);
}
+#endif
/* OSX 10.6 and FreeBSD 8.1 add support for EVFILT_USER, which we can use
--
2.45.2