summaryrefslogtreecommitdiffstats
path: root/lib/libevent/kqueue.c
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2006-03-30 06:32:36 +0000
committerbrad <brad@openbsd.org>2006-03-30 06:32:36 +0000
commit3ac1ba99f4e58fb1a42c390f97c7508790c97eae (patch)
tree98fc8ff79d29c3d4dbae3acc011af2589818fcc6 /lib/libevent/kqueue.c
parentAdd rlog -r[REV1][:][REV2] support (diff)
downloadwireguard-openbsd-3ac1ba99f4e58fb1a42c390f97c7508790c97eae.tar.xz
wireguard-openbsd-3ac1ba99f4e58fb1a42c390f97c7508790c97eae.zip
introduce a way to free the base.
From libevent CVS
Diffstat (limited to 'lib/libevent/kqueue.c')
-rw-r--r--lib/libevent/kqueue.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libevent/kqueue.c b/lib/libevent/kqueue.c
index 2f7f8484238..500d7c4dd68 100644
--- a/lib/libevent/kqueue.c
+++ b/lib/libevent/kqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kqueue.c,v 1.19 2005/12/20 02:15:28 brad Exp $ */
+/* $OpenBSD: kqueue.c,v 1.20 2006/03/30 06:32:36 brad Exp $ */
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -75,6 +75,7 @@ int kq_del (void *, struct event *);
int kq_recalc (struct event_base *, void *, int);
int kq_dispatch (struct event_base *, void *, struct timeval *);
int kq_insert (struct kqop *, struct kevent *);
+void kq_dealloc (void *);
const struct eventop kqops = {
"kqueue",
@@ -82,7 +83,8 @@ const struct eventop kqops = {
kq_add,
kq_del,
kq_recalc,
- kq_dispatch
+ kq_dispatch,
+ kq_dealloc
};
void *
@@ -394,3 +396,18 @@ kq_del(void *arg, struct event *ev)
return (0);
}
+
+void
+kq_dealloc(void *arg)
+{
+ struct kqop *kqop = arg;
+
+ if (kqop->changes)
+ free(kqop->changes);
+ if (kqop->events)
+ free(kqop->events);
+ if (kqop->kq)
+ close(kqop->kq);
+ memset(kqop, 0, sizeof(struct kqop));
+ free(kqop);
+}