ioloop-poll.c revision 231784063ad083c5d7dc9dc0690cfb2d66481329
/* Copyright (c) 2002-2003 Timo Sirainen */
/* @UNSAFE: whole file */
#include "lib.h"
#include "ioloop-internal.h"
#ifdef IOLOOP_POLL
#include <fcntl.h>
struct ioloop_handler_context {
unsigned int idx_count;
int *fd_index;
};
{
struct ioloop_handler_context *ctx;
}
{
}
{
unsigned int old_count;
/* grow the fd -> index array */
sizeof(int) * old_count,
}
/* grow the fd array */
}
/* update existing pollfd */
} else {
/* add new pollfd */
}
}
{
#ifdef DEBUG
/* io_remove() is required to be called before fd is closed.
This is required by kqueue, but since poll is more commonly used
while developing, this check here should catch the error early
enough not to cause problems for kqueue users. */
else
}
#endif
}
}
/* remove the whole pollfd */
return; /* removing last one */
/* move the last pollfd over the removed one */
}
}
{
unsigned int t_id;
bool call;
/* get the time left for next timeout task */
i_fatal("poll(): %m");
/* execute timeout handlers */
/* no I/O events */
return;
}
i_error("invalid I/O fd %d, callback %p",
} else {
}
ret--;
if (call) {
i_panic("Leaked a t_pop() call in "
"I/O handler %p",
}
}
}
}
}
#endif