ioloop-epoll.c revision 797de45dcf6e24642ab347d5033beb92034b779d
/*
* Linux epoll() based ioloop handler.
*
* Copyright (c) 2004 Andrey Panin <pazke@donpac.ru>
*
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
/* @UNSAFE: whole file */
#include "lib.h"
#include "ioloop-internal.h"
#ifdef IOLOOP_EPOLL
#include <unistd.h>
#define INITIAL_EPOLL_EVENTS 128
enum {
};
struct ioloop_handler_context {
int epfd;
int events_size, events_pos;
struct epoll_event *events;
unsigned int idx_size;
};
struct io_list {
};
{
struct ioloop_handler_context *ctx;
ctx->events_pos = 0;
ctx->events_size);
i_fatal("epoll_create(): %m");
}
{
}
{
int events = 0, i;
for (i = 0; i < EPOLL_IOS_PER_FD; i++) {
continue;
events |= IO_EPOLL_INPUT;
}
return events;
}
{
}
}
i_unreached();
return TRUE;
}
{
}
}
i_unreached();
return TRUE;
}
{
struct epoll_event event;
/* grow the fd -> iolist array */
sizeof(int) * old_size,
}
}
if (ret < 0)
i_fatal("epoll_ctl(): %m");
ctx->events_size);
}
ctx->events_pos++;
}
{
struct epoll_event event;
i_fatal("epoll_ctl(): %m");
ctx->events_pos--;
}
{
struct epoll_event *event;
unsigned int t_id;
/* get the time left for next timeout task */
i_fatal("epoll_wait(): %m");
/* execute timeout handlers */
/* No events */
return;
}
while (ret-- > 0) {
for (i = 0; i < EPOLL_IOS_PER_FD; i++) {
continue;
}
if (call) {
i_panic("Leaked a t_pop() call!");
}
}
event++;
}
}
#endif /* IOLOOP_EPOLL */