EXPERIMENTAL: tevent_kqueue support

Jeremy Allison jra at samba.org
Fri Feb 22 11:57:07 MST 2013


On Wed, Feb 20, 2013 at 09:36:30AM -0800, Jeremy Allison wrote:
> On Wed, Feb 20, 2013 at 06:32:47PM +0100, Stefan (metze) Metzmacher wrote:
> > Am 20.02.2013 01:50, schrieb Jeremy Allison:
> > > On Sun, Feb 17, 2013 at 05:07:30PM +0100, Stefan (metze) Metzmacher wrote:
> > >> Hi Timur,
> > >>
> > >> I've started with a tevent_kqueue implementation
> > >> (just looking at the man page).
> > >>
> > >> It compiles for me on linux with the 2nd HACK patch.
> > >>
> > >> Can you have a look and test it?
> > >>
> > >> @Jeremy: we may want to pick up some of the simplified logic into the
> > >> epoll backend:
> > >>          kqueue_update_fd_event() instead of
> > >>          epoll_add_event/epoll_mod_event/epoll_del_event/epoll_change_event.
> > > 
> > > Don't think that will work. The difference between epoll/kqueue
> > > is that kqueue doesn't seem to have the restriction on adding
> > > 2 events with the same fd, which means we'd have to migrate
> > > all the logic in my epoll patch into a epoll_update_fd_event
> > > function, which might get rather messy :-).
> > 
> > We already had a epoll_change_event(), which I renamed to
> > epoll_update_event()
> > and used in all places instead of using epoll_{add,mod,del}_event directly.
> > 
> > I current epoll patchset is attached, please take a look, but don't push
> > it to master yet.
> 
> Ok, I'll run under test and wait for you to confirm you're
> happy.

Finally got time to look at this. Needs this additional
patch to compile (but I'm sure you already knew that :-).

Jeremy.
-------------- next part --------------
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 0b8c4b8..25370a1 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -746,6 +746,7 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde)
 	struct epoll_event_context *epoll_ev = NULL;
 	bool panic_triggered = false;
 	int flags = fde->flags;
+	struct tevent_fd *mpx_fde = NULL;
 
 	if (ev == NULL) {
 		return tevent_common_fd_destructor(fde);
@@ -762,8 +763,7 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde)
 	DLIST_REMOVE(ev->fd_events, fde);
 
 	if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) {
-		struct tevent_fd *mpx_fde =
-			talloc_get_type_abort(fde->additional_data,
+		mpx_fde = talloc_get_type_abort(fde->additional_data,
 			struct tevent_fd);
 
 		fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX;


More information about the samba-technical mailing list