ioloop.c revision eb493a9993bce313e0750db6787459ef39067944
/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "time-util.h"
#include "ioloop-private.h"
#include <unistd.h>
time_t ioloop_time = 0;
struct timeval ioloop_timeval;
{
unsigned int initial_fd_count;
}
unsigned int source_linenum,
{
}
}
}
{
else
/* if we got here from an I/O handler callback, make sure we
don't try to handle this one next. */
}
{
/* make sure the callback doesn't get called anymore.
kqueue code relies on this. */
else {
}
}
{
}
{
}
{
i_fatal("gettimeofday(): %m");
} else {
}
/* we don't want microsecond accuracy or this function will be
called all the time - millisecond is more than enough */
}
}
{
}
NULL : &ioloop_timeval);
return timeout;
}
{
}
{
}
static void
{
/* if we came here from io_loop_handle_timeouts(),
next_run must be larger than tv_now or we could go to
infinite loop. +1000 to get 1 ms further, another +1000 to
account for timeout_update_next()'s truncation. */
}
}
}
{
}
{
int ret;
i_fatal("gettimeofday(): %m");
}
}
return 0;
}
/* round wait times up to next millisecond */
return ret;
}
{
struct priorityq_item *item;
int msecs;
/* no timeouts. use INT_MAX msecs for timeval and
return -1;
}
return msecs;
}
{
}
{
i_warning("Time moved backwards by %ld seconds.",
}
}
{
struct priorityq_item *const *items;
unsigned int i, count;
for (i = 0; i < count; i++) {
}
}
static void io_loops_timeouts_update(long diff_secs)
{
}
{
struct priorityq_item *item;
unsigned int t_id;
i_fatal("gettimeofday(): %m");
/* Don't bother comparing usecs. */
/* time moved backwards */
io_loops_timeouts_update(-(long)(ioloop_time -
/* the callback may have slept, so check the time again. */
i_fatal("gettimeofday(): %m");
ioloop->next_max_time)) {
/* time moved forwards */
}
/* use tv_call to make sure we don't get to infinite loop in
case callbacks update ioloop_timeval. */
break;
/* update timeout's next_run and reposition it in the queue */
i_panic("Leaked a t_pop() call in timeout handler %p",
}
}
}
{
T_BEGIN {
} T_END;
}
{
unsigned int t_id;
i_panic("Leaked a t_pop() call in I/O handler %p",
}
}
{
}
{
}
{
}
{
}
{
}
void io_loop_time_refresh(void)
{
i_fatal("gettimeofday(): %m");
}
struct ioloop *io_loop_create(void)
{
/* initialize time */
i_fatal("gettimeofday(): %m");
return ioloop;
}
{
struct priorityq_item *item;
i_warning("I/O leak: %p (line %u, fd %d)",
}
to->source_linenum);
}
/* ->prev won't work unless loops are destroyed in create order */
}
{
}
{
}
{
struct ioloop_context *ctx;
return ctx;
}
{
}
{
return;
/* cur_ctx itself keeps a reference */
}
{
struct ioloop_context_callback cb;
}
{
struct ioloop_context_callback *cb;
/* simply mark it as deleted, since we could get
here from activate/deactivate loop */
return;
}
}
i_panic("io_loop_context_remove_callbacks() context not found");
}
static void
{
const struct ioloop_context_callback *cbs;
unsigned int i, count;
for (i = 0; i < count; ) {
i++;
else {
}
}
}
{
const struct ioloop_context_callback *cb;
}
}
{
const struct ioloop_context_callback *cb;
}
}
{
}
{
struct io_file *old_io_file;
return old_io;
return new_io;
}
{
return old_to;
return new_to;
}