main.c revision b70234f335410d6a8913f145d1cc9befa6f00b42
/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "lib-signals.h"
#include "ioloop.h"
#include "fd-close-on-exec.h"
#include "restrict-access.h"
#include "randgen.h"
#include "sql-api.h"
#include "dict.h"
#include "dict-client.h"
#include "dict-server.h"
#include "module-dir.h"
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#define DICT_MASTER_LISTENER_FD 3
static struct dict_server *dict_server;
{
/* warn about being killed because of some signal, except SIGINT (^C)
which is too common at least while testing :) */
i_warning("Killed with signal %d (by pid=%s uid=%s code=%s)",
}
}
{
/* the log fd is closed, don't die when trying to log later */
}
static void drop_privileges(void)
{
/* Log file or syslog opening probably requires roots */
chrooting. */
random_init();
/* Load built-in SQL drivers (if any) */
}
static void main_init(void)
{
int fd;
i_fatal("Dovecot version mismatch: "
"(if you don't care, set version_ignore=yes)", version);
}
/* If master dies, the log fd gets closed and we'll quit */
/* Register only after loading modules. They may contain SQL drivers,
which we'll need to register. */
}
static void main_deinit(void)
{
closelog();
}
int main(void)
{
#ifdef DEBUG
#endif
/* NOTE: we start rooted, so keep the code minimal until
restrict_access_by_env() is called */
lib_init();
ioloop = io_loop_create();
main_init();
main_deinit();
lib_deinit();
return 0;
}