lib.c revision 5a580c3a38ced62d4bcc95b8ac7c4f2935b5d294
/* Copyright (c) 2001-2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "env-util.h"
#include "hostpid.h"
#include "ipwd.h"
#include "process-title.h"
#include <stdlib.h>
#include <unistd.h>
{
size_t n = 1;
while (n < num) n <<= 1;
return n;
}
int close_keep_errno(int *fd)
{
*fd = -1;
return ret;
}
{
lib_atexit_callback_t *const *callbacks;
unsigned int i, count;
if (!array_is_created(&atexit_callbacks))
else {
/* skip if it's already added */
for (i = count; i > 0; i--) {
return;
}
}
}
void lib_init(void)
{
/* standard way to get rand() return different values. */
i_fatal("gettimeofday(): %m");
hostpid_init();
}
void lib_deinit(void)
{
lib_atexit_callback_t *const *cbp;
if (array_is_created(&atexit_callbacks)) {
(**cbp)();
}
ipwd_deinit();
env_deinit();
}