/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "ioloop.h"
#include "fdpass.h"
#include "service.h"
#include "service-process.h"
#include "service-process-notify.h"
#include "service-anvil.h"
#include <unistd.h>
static void
{
}
}
{
if (ret <= 0) {
i_error("read(anvil fd) failed: %m");
}
}
{
}
{
}
{
return;
}
{
if (ret < 0) {
return -1;
}
if (ret == 0) {
return -1;
}
/* this is a pipe, it either wrote all of it or nothing */
return 0;
}
static int
{
const char *data;
i_error("write(anvil process) failed: %m");
return -1;
}
return 0;
}
{
if (service_anvil_global->process_count == 0)
else {
(void)service_process_create(service);
}
}
{
const char *error;
}
{
if (--service_anvil_global->process_count == 0)
service_anvil_global->pid = 0;
}
void service_anvil_send_log_fd(void)
{
char b = 0;
if (service_anvil_global->process_count == 0)
return;
if (ret < 0)
i_error("fd_send(anvil log fd) failed: %m");
else if (ret == 0)
i_error("fd_send(anvil log fd) failed: disconnected");
}
void service_anvil_global_init(void)
{
i_fatal("pipe() failed: %m");
i_fatal("pipe() failed: %m");
i_fatal("pipe() failed: %m");
i_fatal("socketpair() failed: %m");
}
void service_anvil_global_deinit(void)
{
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
i_error("close(anvil) failed: %m");
}