Mercurial > hg > dhcpcd
changeset 2988:812e4e8e476d draft
Fix epoll fd moving read only.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Thu, 05 Mar 2015 02:55:53 +0000 |
| parents | 27cf600b8fed |
| children | 1fd4d6b25337 |
| files | eloop.c |
| diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/eloop.c Wed Mar 04 21:28:21 2015 +0000 +++ b/eloop.c Thu Mar 05 02:55:53 2015 +0000 @@ -198,8 +198,10 @@ eloop_event_delete(struct eloop_ctx *ctx, int fd, int write_only) { struct eloop_event *e; -#ifdef HAVE_KQUEUE +#if defined(HAVE_KQUEUE) struct kevent ke[2]; +#elif defined(HAVE_EPOLL) + struct epoll_event epe; #endif TAILQ_FOREACH(e, &ctx->events, next) { @@ -208,11 +210,17 @@ if (e->write_cb) { e->write_cb = NULL; e->write_cb_arg = NULL; -#ifdef HAVE_KQUEUE +#if defined(HAVE_KQUEUE) EV_SET(&ke[0], fd, EVFILT_WRITE, EV_DELETE, 0, 0, UPTR(NULL)); kevent(ctx->poll_fd, ke, 1, NULL, 0, NULL); +#elif defined(HAVE_EPOLL) + memset(&epe, 0, sizeof(epe)); + epe.data.fd = e->fd; + epe.data.ptr = e; + epe.events = EPOLLIN; + epoll_ctl(ctx->poll_fd, EPOLL_CTL_MOD, fd, &epe); #endif }
