doveadm-master.c revision a4a7440a1033203c48d5f0174b3d85514b79f3a0
/* Copyright (c) 2010-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "strescape.h"
#include "istream.h"
#include "write-full.h"
#include "doveadm.h"
#include "doveadm-print.h"
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#define MASTER_PID_FILE_NAME "master.pid"
{
char buf[32];
int fd;
bool found;
if (fd == -1) {
return FALSE;
}
if (ret <= 0) {
if (ret == 0)
else
} else {
ret--;
else {
}
}
i_close_fd(&fd);
return found;
}
void doveadm_master_send_signal(int signo)
{
const char *pidfile_path;
unsigned int i;
/* wait for a while for the process to die */
usleep(1000);
for (i = 0; i < 30; i++) {
i_error("kill() failed: %m");
break;
}
usleep(100000);
}
}
}
{
}
{
}
{
const char *path;
if (fd == -1)
const char *str =
}
static struct istream *
{
}
}
}
{
i_fatal("service parameter missing");
alarm(5);
} else if (line[0] == '-') {
} else if (line[0] != '+') {
i_error("Unexpected input from %s: %s",
}
alarm(0);
}
{
doveadm_print_header_simple("name");
doveadm_print_header_simple("process_count");
doveadm_print_header_simple("process_avail");
doveadm_print_header_simple("process_limit");
doveadm_print_header_simple("client_limit");
doveadm_print_header_simple("throttle_secs");
doveadm_print_header_simple("exit_failure_last");
doveadm_print_header_simple("exit_failures_in_sec");
doveadm_print_header_simple("last_drop_warning");
doveadm_print_header_simple("listen_pending");
doveadm_print_header_simple("listening");
alarm(5);
if (line[0] == '\0')
break;
T_BEGIN {
for (unsigned int i = 0; i < 11; i++)
doveadm_print(args[i]);
}
} T_END;
}
}
alarm(0);
}
{
doveadm_print_header_simple("name");
doveadm_print_header_simple("pid");
doveadm_print_header_simple("available_count");
doveadm_print_header_simple("total_count");
doveadm_print_header_simple("idle_start");
doveadm_print_header_simple("last_status_update");
doveadm_print_header_simple("last_kill_sent");
alarm(5);
if (line[0] == '\0')
break;
T_BEGIN {
for (unsigned int i = 0; i < 7; i++)
doveadm_print(args[i]);
}
} T_END;
}
}
alarm(0);
}
struct doveadm_cmd_ver2 doveadm_cmd_stop_ver2 = {
.name = "stop",
.usage = "",
};
struct doveadm_cmd_ver2 doveadm_cmd_reload_ver2 = {
.old_cmd = cmd_reload,
.name = "reload",
.usage = "",
};
struct doveadm_cmd_ver2 doveadm_cmd_service_stop_ver2 = {
.cmd = cmd_service_stop,
.name = "service stop",
.usage = "<service> [<service> [...]]",
};
struct doveadm_cmd_ver2 doveadm_cmd_service_status_ver2 = {
.name = "service status",
.usage = "[<service> [...]]",
};
struct doveadm_cmd_ver2 doveadm_cmd_process_status_ver2 = {
.name = "process status",
.usage = "[<service> [...]]",
};