2003-03-07 23:20:36 +00:00
|
|
|
/*
|
2009-01-27 22:34:36 +00:00
|
|
|
* Copyright 2000-2007 Niels Provos <provos@citi.umich.edu>
|
2010-03-04 01:25:51 -05:00
|
|
|
* Copyright 2007-2010 Niels Provos, Nick Mathewson
|
2003-03-07 23:20:36 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-10-04 23:27:26 +00:00
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
2003-03-07 23:20:36 +00:00
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2010-07-07 16:45:03 -04:00
|
|
|
#include "event2/event-config.h"
|
2003-03-07 23:20:36 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
2003-04-09 18:12:11 +00:00
|
|
|
#include <sys/resource.h>
|
2009-01-27 22:30:46 +00:00
|
|
|
#ifdef _EVENT_HAVE_SYS_TIME_H
|
2003-03-07 23:20:36 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/epoll.h>
|
|
|
|
#include <signal.h>
|
2010-03-31 20:30:55 -07:00
|
|
|
#include <limits.h>
|
2003-03-07 23:20:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
2009-01-27 22:30:46 +00:00
|
|
|
#ifdef _EVENT_HAVE_FCNTL_H
|
2004-08-10 18:29:37 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2007-03-10 06:37:53 +00:00
|
|
|
#include "event-internal.h"
|
2009-01-13 20:26:37 +00:00
|
|
|
#include "evsignal-internal.h"
|
2009-10-21 03:54:00 +00:00
|
|
|
#include "event2/thread.h"
|
|
|
|
#include "evthread-internal.h"
|
2009-01-13 20:26:37 +00:00
|
|
|
#include "log-internal.h"
|
|
|
|
#include "evmap-internal.h"
|
2010-01-16 15:24:58 -05:00
|
|
|
#include "changelist-internal.h"
|
2003-03-07 23:20:36 +00:00
|
|
|
|
|
|
|
struct epollop {
|
|
|
|
struct epoll_event *events;
|
|
|
|
int nevents;
|
|
|
|
int epfd;
|
2005-01-03 18:58:40 +00:00
|
|
|
};
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2010-03-05 13:00:15 -05:00
|
|
|
static void *epoll_init(struct event_base *);
|
|
|
|
static int epoll_dispatch(struct event_base *, struct timeval *);
|
|
|
|
static void epoll_dealloc(struct event_base *);
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2008-12-13 06:11:12 +00:00
|
|
|
const struct eventop epollops = {
|
2003-03-07 23:20:36 +00:00
|
|
|
"epoll",
|
|
|
|
epoll_init,
|
2010-01-16 15:24:58 -05:00
|
|
|
event_changelist_add,
|
|
|
|
event_changelist_del,
|
2006-03-28 04:40:54 +00:00
|
|
|
epoll_dispatch,
|
2007-11-25 06:57:59 +00:00
|
|
|
epoll_dealloc,
|
2008-05-31 14:37:31 +00:00
|
|
|
1, /* need reinit */
|
|
|
|
EV_FEATURE_ET|EV_FEATURE_O1,
|
2010-01-16 15:24:58 -05:00
|
|
|
EVENT_CHANGELIST_FDINFO_SIZE
|
2003-03-07 23:20:36 +00:00
|
|
|
};
|
|
|
|
|
2009-09-11 18:47:35 +00:00
|
|
|
#define INITIAL_NEVENT 32
|
|
|
|
#define MAX_NEVENT 4096
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2008-04-11 20:02:50 +00:00
|
|
|
/* On Linux kernels at least up to 2.6.24.4, epoll can't handle timeout
|
|
|
|
* values bigger than (LONG_MAX - 999ULL)/HZ. HZ in the wild can be
|
|
|
|
* as big as 1000, and LONG_MAX can be as small as (1<<31)-1, so the
|
|
|
|
* largest number of msec we can support here is 2147482. Let's
|
|
|
|
* round that down by 47 seconds.
|
|
|
|
*/
|
|
|
|
#define MAX_EPOLL_TIMEOUT_MSEC (35*60*1000)
|
|
|
|
|
2008-03-29 01:45:45 +00:00
|
|
|
static void *
|
2007-03-10 06:37:53 +00:00
|
|
|
epoll_init(struct event_base *base)
|
2003-03-07 23:20:36 +00:00
|
|
|
{
|
2009-09-11 18:47:35 +00:00
|
|
|
int epfd;
|
2005-01-03 18:58:40 +00:00
|
|
|
struct epollop *epollop;
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2009-10-16 13:19:57 +00:00
|
|
|
/* Initialize the kernel queue. (The size field is ignored since
|
2009-09-11 18:47:35 +00:00
|
|
|
* 2.6.8.) */
|
|
|
|
if ((epfd = epoll_create(32000)) == -1) {
|
2008-04-10 19:34:50 +00:00
|
|
|
if (errno != ENOSYS)
|
|
|
|
event_warn("epoll_create");
|
2003-03-07 23:20:36 +00:00
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
2009-12-29 16:21:26 -02:00
|
|
|
evutil_make_socket_closeonexec(epfd);
|
2004-08-10 18:29:37 +00:00
|
|
|
|
2008-04-25 01:18:08 +00:00
|
|
|
if (!(epollop = mm_calloc(1, sizeof(struct epollop))))
|
2005-01-03 18:58:40 +00:00
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
epollop->epfd = epfd;
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2009-10-16 13:19:57 +00:00
|
|
|
/* Initialize fields */
|
2009-11-15 19:00:12 +00:00
|
|
|
epollop->events = mm_calloc(INITIAL_NEVENT, sizeof(struct epoll_event));
|
2005-01-03 18:58:40 +00:00
|
|
|
if (epollop->events == NULL) {
|
2008-04-25 01:18:08 +00:00
|
|
|
mm_free(epollop);
|
2003-03-07 23:20:36 +00:00
|
|
|
return (NULL);
|
2005-01-03 18:58:40 +00:00
|
|
|
}
|
2009-09-11 18:47:35 +00:00
|
|
|
epollop->nevents = INITIAL_NEVENT;
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2008-12-23 22:23:37 +00:00
|
|
|
evsig_init(base);
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2005-01-03 18:58:40 +00:00
|
|
|
return (epollop);
|
2003-03-07 23:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-07-29 18:12:05 -04:00
|
|
|
static const char *
|
|
|
|
change_to_string(int change)
|
|
|
|
{
|
|
|
|
change &= (EV_CHANGE_ADD|EV_CHANGE_DEL);
|
|
|
|
if (change == EV_CHANGE_ADD) {
|
|
|
|
return "add";
|
|
|
|
} else if (change == EV_CHANGE_DEL) {
|
|
|
|
return "del";
|
|
|
|
} else if (change == 0) {
|
|
|
|
return "none";
|
|
|
|
} else {
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
epoll_op_to_string(int op)
|
|
|
|
{
|
|
|
|
return op == EPOLL_CTL_ADD?"ADD":
|
|
|
|
op == EPOLL_CTL_DEL?"DEL":
|
|
|
|
op == EPOLL_CTL_MOD?"MOD":
|
|
|
|
"???";
|
|
|
|
}
|
|
|
|
|
2010-01-16 15:24:58 -05:00
|
|
|
static int
|
|
|
|
epoll_apply_changes(struct event_base *base)
|
|
|
|
{
|
|
|
|
struct event_changelist *changelist = &base->changelist;
|
|
|
|
struct epollop *epollop = base->evbase;
|
|
|
|
struct event_change *ch;
|
|
|
|
struct epoll_event epev;
|
|
|
|
int i;
|
|
|
|
int op, events;
|
|
|
|
|
|
|
|
for (i = 0; i < changelist->n_changes; ++i) {
|
|
|
|
int precautionary_add = 0;
|
|
|
|
ch = &changelist->changes[i];
|
|
|
|
events = 0;
|
|
|
|
|
|
|
|
/* The logic here is a little tricky. If we had no events set
|
|
|
|
on the fd before, we need to set op="ADD" and set
|
|
|
|
events=the events we want to add. If we had any events set
|
|
|
|
on the fd before, and we want any events to remain on the
|
|
|
|
fd, we need to say op="MOD" and set events=the events we
|
|
|
|
want to remain. But if we want to delete the last event,
|
|
|
|
we say op="DEL" and set events=the remaining events. What
|
|
|
|
fun!
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ((ch->read_change & EV_CHANGE_ADD) ||
|
|
|
|
(ch->write_change & EV_CHANGE_ADD)) {
|
|
|
|
/* If we are adding anything at all, we'll want to do
|
|
|
|
* either an ADD or a MOD. */
|
|
|
|
short new_events = ch->old_events;
|
|
|
|
events = 0;
|
|
|
|
op = EPOLL_CTL_ADD;
|
|
|
|
if (ch->read_change & EV_CHANGE_ADD) {
|
|
|
|
events |= EPOLLIN;
|
|
|
|
new_events |= EV_READ;
|
|
|
|
} else if (ch->read_change & EV_CHANGE_DEL) {
|
|
|
|
new_events &= ~EV_READ;
|
|
|
|
} else if (ch->old_events & EV_READ) {
|
|
|
|
events |= EPOLLIN;
|
|
|
|
}
|
|
|
|
if (ch->write_change & EV_CHANGE_ADD) {
|
|
|
|
events |= EPOLLOUT;
|
|
|
|
new_events |= EV_WRITE;
|
|
|
|
} else if (ch->write_change & EV_CHANGE_DEL) {
|
|
|
|
new_events &= ~EV_WRITE;
|
|
|
|
} else if (ch->old_events & EV_WRITE) {
|
|
|
|
events |= EPOLLOUT;
|
|
|
|
}
|
|
|
|
if ((ch->read_change|ch->write_change) & EV_ET)
|
|
|
|
events |= EPOLLET;
|
|
|
|
|
|
|
|
if (new_events == ch->old_events) {
|
|
|
|
/*
|
|
|
|
If the changelist has an "add" operation,
|
|
|
|
but no visible change to the events enabled
|
|
|
|
on the fd, we need to try the ADD anyway, in
|
|
|
|
case the fd was closed at some in the
|
|
|
|
middle. If it wasn't, the ADD operation
|
|
|
|
will fail with; that's okay.
|
|
|
|
*/
|
|
|
|
precautionary_add = 1;
|
|
|
|
} else if (ch->old_events) {
|
|
|
|
op = EPOLL_CTL_MOD;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if ((ch->read_change & EV_CHANGE_DEL) ||
|
|
|
|
(ch->write_change & EV_CHANGE_DEL)) {
|
|
|
|
/* If we're deleting anything, we'll want to do a MOD
|
|
|
|
* or a DEL. */
|
|
|
|
op = EPOLL_CTL_DEL;
|
|
|
|
|
|
|
|
if (ch->read_change & EV_CHANGE_DEL) {
|
|
|
|
if (ch->write_change & EV_CHANGE_DEL) {
|
|
|
|
events = EPOLLIN|EPOLLOUT;
|
|
|
|
} else if (ch->old_events & EV_WRITE) {
|
|
|
|
events = EPOLLOUT;
|
|
|
|
op = EPOLL_CTL_MOD;
|
|
|
|
} else {
|
|
|
|
events = EPOLLIN;
|
|
|
|
}
|
|
|
|
} else if (ch->write_change & EV_CHANGE_DEL) {
|
|
|
|
if (ch->old_events & EV_READ) {
|
|
|
|
events = EPOLLIN;
|
|
|
|
op = EPOLL_CTL_MOD;
|
|
|
|
} else {
|
|
|
|
events = EPOLLOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!events)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
memset(&epev, 0, sizeof(epev));
|
|
|
|
epev.data.fd = ch->fd;
|
|
|
|
epev.events = events;
|
|
|
|
if (epoll_ctl(epollop->epfd, op, ch->fd, &epev) == -1) {
|
|
|
|
if (op == EPOLL_CTL_MOD && errno == ENOENT) {
|
|
|
|
/* If a MOD operation fails with ENOENT, the
|
|
|
|
* fd was probably closed and re-opened. We
|
|
|
|
* should retry the operation as an ADD.
|
|
|
|
*/
|
|
|
|
if (epoll_ctl(epollop->epfd, EPOLL_CTL_ADD, ch->fd, &epev) == -1) {
|
2010-09-21 22:23:32 -04:00
|
|
|
event_warn("Epoll MOD(%d) on %d retried as ADD; that failed too",
|
|
|
|
(int)epev.events, ch->fd);
|
2010-01-16 15:24:58 -05:00
|
|
|
} else {
|
2010-09-21 22:23:32 -04:00
|
|
|
event_debug(("Epoll MOD(%d) on %d retried as ADD; succeeded.",
|
|
|
|
(int)epev.events,
|
|
|
|
ch->fd));
|
2010-01-16 15:24:58 -05:00
|
|
|
}
|
|
|
|
} else if (op == EPOLL_CTL_ADD && errno == EEXIST &&
|
|
|
|
precautionary_add) {
|
|
|
|
/* If a precautionary ADD operation fails with
|
|
|
|
EEXIST, that's fine too.
|
|
|
|
*/
|
2010-09-21 22:23:32 -04:00
|
|
|
event_debug(("Epoll ADD(%d) on fd %d gave %s: ADD was redundant",
|
|
|
|
(int)epev.events,
|
|
|
|
ch->fd, strerror(errno)));
|
2010-01-16 15:24:58 -05:00
|
|
|
} else if (op == EPOLL_CTL_DEL &&
|
2010-07-08 14:41:02 -04:00
|
|
|
(errno == ENOENT || errno == EBADF ||
|
|
|
|
errno == EPERM)) {
|
2010-01-16 15:24:58 -05:00
|
|
|
/* If a delete fails with one of these errors,
|
|
|
|
* that's fine too: we closed the fd before we
|
|
|
|
* got around to calling epoll_dispatch. */
|
2010-09-21 22:23:32 -04:00
|
|
|
event_debug(("Epoll DEL(%d) on fd %d gave %s: DEL was unnecessary.",
|
|
|
|
(int)epev.events,
|
|
|
|
ch->fd,
|
|
|
|
strerror(errno)));
|
2010-01-16 15:24:58 -05:00
|
|
|
} else {
|
2010-09-21 22:23:32 -04:00
|
|
|
event_warn("Epoll %s(%d) on fd %d failed. Old events were %d; read change was %d (%s); write change was %d (%s)",
|
2010-07-29 18:12:05 -04:00
|
|
|
epoll_op_to_string(op),
|
2010-09-21 22:23:32 -04:00
|
|
|
(int)epev.events,
|
2010-01-16 15:24:58 -05:00
|
|
|
ch->fd,
|
|
|
|
ch->old_events,
|
2010-07-29 18:12:05 -04:00
|
|
|
ch->read_change,
|
|
|
|
change_to_string(ch->read_change),
|
|
|
|
ch->write_change,
|
|
|
|
change_to_string(ch->write_change));
|
2010-01-16 15:24:58 -05:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
event_debug(("Epoll %s(%d) on fd %d okay. [old events were %d; read change was %d; write change was %d]",
|
2010-07-29 18:12:05 -04:00
|
|
|
epoll_op_to_string(op),
|
2010-01-16 15:24:58 -05:00
|
|
|
(int)epev.events,
|
|
|
|
(int)ch->fd,
|
|
|
|
ch->old_events,
|
2010-07-29 18:12:05 -04:00
|
|
|
ch->read_change,
|
|
|
|
ch->write_change));
|
2010-01-16 15:24:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2007-12-16 19:34:09 +00:00
|
|
|
static int
|
2008-12-23 16:37:01 +00:00
|
|
|
epoll_dispatch(struct event_base *base, struct timeval *tv)
|
2003-03-07 23:20:36 +00:00
|
|
|
{
|
2008-12-23 16:37:01 +00:00
|
|
|
struct epollop *epollop = base->evbase;
|
2003-03-07 23:20:36 +00:00
|
|
|
struct epoll_event *events = epollop->events;
|
2010-03-31 20:30:55 -07:00
|
|
|
int i, res;
|
|
|
|
long timeout = -1;
|
|
|
|
|
|
|
|
if (tv != NULL) {
|
|
|
|
timeout = evutil_tv_to_msec(tv);
|
|
|
|
if (timeout < 0 || timeout > MAX_EPOLL_TIMEOUT_MSEC) {
|
|
|
|
/* Linux kernels can wait forever if the timeout is
|
|
|
|
* too big; see comment on MAX_EPOLL_TIMEOUT_MSEC. */
|
|
|
|
timeout = MAX_EPOLL_TIMEOUT_MSEC;
|
|
|
|
}
|
2008-04-11 20:02:50 +00:00
|
|
|
}
|
|
|
|
|
2010-01-16 15:24:58 -05:00
|
|
|
epoll_apply_changes(base);
|
|
|
|
event_changelist_remove_all(&base->changelist, base);
|
|
|
|
|
2009-11-27 16:44:47 -05:00
|
|
|
EVBASE_RELEASE_LOCK(base, th_base_lock);
|
2009-10-21 03:54:00 +00:00
|
|
|
|
2003-03-07 23:20:36 +00:00
|
|
|
res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout);
|
|
|
|
|
2009-11-27 16:44:47 -05:00
|
|
|
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
|
2009-10-21 03:54:00 +00:00
|
|
|
|
2003-03-07 23:20:36 +00:00
|
|
|
if (res == -1) {
|
|
|
|
if (errno != EINTR) {
|
2005-03-29 07:03:10 +00:00
|
|
|
event_warn("epoll_wait");
|
2003-03-07 23:20:36 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
2007-03-10 06:37:53 +00:00
|
|
|
}
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2005-03-29 07:03:10 +00:00
|
|
|
event_debug(("%s: epoll_wait reports %d", __func__, res));
|
2009-10-26 20:00:43 +00:00
|
|
|
EVUTIL_ASSERT(res <= epollop->nevents);
|
2003-03-07 23:20:36 +00:00
|
|
|
|
|
|
|
for (i = 0; i < res; i++) {
|
2003-10-25 21:58:33 +00:00
|
|
|
int what = events[i].events;
|
2009-09-11 18:47:35 +00:00
|
|
|
short ev = 0;
|
2003-03-07 23:20:36 +00:00
|
|
|
|
2007-11-11 03:05:03 +00:00
|
|
|
if (what & (EPOLLHUP|EPOLLERR)) {
|
2009-09-11 18:47:35 +00:00
|
|
|
ev = EV_READ | EV_WRITE;
|
2007-11-11 03:05:03 +00:00
|
|
|
} else {
|
2008-12-23 16:37:01 +00:00
|
|
|
if (what & EPOLLIN)
|
2009-09-11 18:47:35 +00:00
|
|
|
ev |= EV_READ;
|
2008-12-23 16:37:01 +00:00
|
|
|
if (what & EPOLLOUT)
|
2009-09-11 18:47:35 +00:00
|
|
|
ev |= EV_WRITE;
|
2007-11-10 05:18:11 +00:00
|
|
|
}
|
2007-11-11 03:05:03 +00:00
|
|
|
|
2010-09-30 23:15:47 -04:00
|
|
|
if (!ev)
|
2007-11-11 03:05:03 +00:00
|
|
|
continue;
|
|
|
|
|
2009-09-11 18:47:35 +00:00
|
|
|
evmap_io_active(base, events[i].data.fd, ev | EV_ET);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res == epollop->nevents && epollop->nevents < MAX_NEVENT) {
|
|
|
|
/* We used all of the event space this time. We should
|
|
|
|
be ready for more events next time. */
|
|
|
|
int new_nevents = epollop->nevents * 2;
|
|
|
|
struct epoll_event *new_events;
|
|
|
|
|
|
|
|
new_events = mm_realloc(epollop->events,
|
|
|
|
new_nevents * sizeof(struct epoll_event));
|
|
|
|
if (new_events) {
|
|
|
|
epollop->events = new_events;
|
|
|
|
epollop->nevents = new_nevents;
|
|
|
|
}
|
2003-03-07 23:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2006-03-28 04:40:54 +00:00
|
|
|
|
2008-03-29 01:45:45 +00:00
|
|
|
static void
|
2008-12-23 16:37:01 +00:00
|
|
|
epoll_dealloc(struct event_base *base)
|
2006-03-28 04:40:54 +00:00
|
|
|
{
|
2008-12-23 16:37:01 +00:00
|
|
|
struct epollop *epollop = base->evbase;
|
2006-03-28 04:40:54 +00:00
|
|
|
|
2008-12-23 22:23:37 +00:00
|
|
|
evsig_dealloc(base);
|
2006-03-28 04:40:54 +00:00
|
|
|
if (epollop->events)
|
2008-04-25 01:18:08 +00:00
|
|
|
mm_free(epollop->events);
|
2006-03-28 04:40:54 +00:00
|
|
|
if (epollop->epfd >= 0)
|
|
|
|
close(epollop->epfd);
|
|
|
|
|
|
|
|
memset(epollop, 0, sizeof(struct epollop));
|
2008-04-25 01:18:08 +00:00
|
|
|
mm_free(epollop);
|
2006-03-28 04:40:54 +00:00
|
|
|
}
|