/* we don't have any extra idling processes anymore. */
timeout_remove(&process->to_idle);
} else if (process->last_kill_sent > process->last_status_update+1) {
- service_error(service, "Process %s is ignoring idle SIGINT",
- dec2str(process->pid));
+ e_error(service->event, "Process %s is ignoring idle SIGINT",
+ dec2str(process->pid));
/* assume this process is busy */
i_zero(&status);
process->available_count = 0;
} else {
if (kill(process->pid, SIGINT) < 0 && errno != ESRCH) {
- service_error(service, "kill(%s, SIGINT) failed: %m",
- dec2str(process->pid));
+ e_error(service->event, "kill(%s, SIGINT) failed: %m",
+ dec2str(process->pid));
}
process->last_kill_sent = ioloop_time;
}
randomness here, but the worst they can do is DoS and there
are already more serious problems if someone is able to do
this.. */
- service_error(service, "Ignoring invalid update from child %s "
+ e_error(service->event, "Ignoring invalid update from child %s "
"(UID=%u)", dec2str(status->pid), status->uid);
return;
}
ret = read(service->status_fd[0], &status, sizeof(status));
if (ret <= 0) {
if (ret == 0)
- service_error(service, "read(status) failed: EOF");
+ e_error(service->event, "read(status) failed: EOF");
else if (errno != EAGAIN)
- service_error(service, "read(status) failed: %m");
+ e_error(service->event, "read(status) failed: %m");
else
return;
service_monitor_stop(service);
}
if ((ret % sizeof(struct master_status)) != 0) {
- service_error(service, "service sent partial status update "
+ e_error(service->event, "service sent partial status update "
"(%d bytes)", (int)ret);
return;
}
i_assert(service->throttle_msecs > 0);
- service_error(service,
+ e_error(service->event,
"command startup failed, throttling for %u.%03u secs",
service->throttle_msecs / 1000,
service->throttle_msecs % 1000);
path = str_c(prefix);
if (fd == -1) {
- service_error(service, "safe_mkstemp(%s) failed: %m",
+ e_error(service->event, "safe_mkstemp(%s) failed: %m",
path);
} else if (unlink(path) < 0) {
- service_error(service, "unlink(%s) failed: %m", path);
+ e_error(service->event, "unlink(%s) failed: %m", path);
} else {
fd_close_on_exec(fd, TRUE);
service->login_notify_fd = fd;
}
if (service->master_dead_pipe_fd[0] == -1) {
if (pipe(service->master_dead_pipe_fd) < 0) {
- service_error(service, "pipe() failed: %m");
+ e_error(service->event, "pipe() failed: %m");
continue;
}
fd_close_on_exec(service->master_dead_pipe_fd[0], TRUE);
if (service->status_fd[0] == -1) {
/* we haven't yet created status pipe */
if (pipe(service->status_fd) < 0) {
- service_error(service, "pipe() failed: %m");
+ e_error(service->event, "pipe() failed: %m");
continue;
}
service->type != SERVICE_TYPE_ANVIL) {
for (i = 0; i < 2; i++) {
if (close(service->status_fd[i]) < 0) {
- service_error(service,
+ e_error(service->event,
"close(status fd) failed: %m");
}
service->status_fd[i] = -1;
service_monitor_close_dead_pipe(service);
if (service->login_notify_fd != -1) {
if (close(service->login_notify_fd) < 0) {
- service_error(service,
+ e_error(service->event,
"close(login notify fd) failed: %m");
}
service->login_notify_fd = -1;
if (kill(process->pid, SIGQUIT) == 0)
ret = TRUE;
else if (errno != ESRCH) {
- service_error(service, "kill(%s, SIGQUIT) failed: %m",
+ e_error(service->event, "kill(%s, SIGQUIT) failed: %m",
dec2str(process->pid));
}
}
static void service_process_status_timeout(struct service_process *process)
{
- service_error(process->service,
- "Initial status notification not received in %d "
- "seconds, killing the process",
- SERVICE_FIRST_STATUS_TIMEOUT_SECS);
+ e_error(process->service->event,
+ "Initial status notification not received in %d "
+ "seconds, killing the process",
+ SERVICE_FIRST_STATUS_TIMEOUT_SECS);
if (kill(process->pid, SIGKILL) < 0 && errno != ESRCH) {
- service_error(process->service, "kill(%s, SIGKILL) failed: %m",
- dec2str(process->pid));
+ e_error(process->service->event, "kill(%s, SIGKILL) failed: %m",
+ dec2str(process->pid));
}
timeout_remove(&process->to_status);
}
(unsigned long long)limit);
}
errno = fork_errno;
- service_error(service, "fork() failed: %m%s", limit_str);
+ e_error(service->event, "fork() failed: %m%s", limit_str);
return NULL;
}
if (pid == 0) {
HASH_TABLE_TYPE(pid_process) service_pids;
-void service_error(struct service *service, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- i_error("service(%s): %s", service->set->name,
- t_strdup_vprintf(format, args));
- va_end(args);
-}
-
static struct service_listener *
service_create_file_listener(struct service *service,
enum service_listener_type type,
if (kill(process->pid, signo) == 0)
count++;
else if (errno != ESRCH) {
- service_error(service, "kill(%s, %d) failed: %m",
- dec2str(process->pid), signo);
+ e_error(service->event, "kill(%s, %d) failed: %m",
+ dec2str(process->pid), signo);
}
}
if (count > 0 && signo != SIGUSR1) {
state = all_processes_full ? MASTER_LOGIN_STATE_FULL :
MASTER_LOGIN_STATE_NONFULL;
if (lseek(service->login_notify_fd, state, SEEK_SET) < 0)
- service_error(service, "lseek(notify fd) failed: %m");
+ e_error(service->event, "lseek(notify fd) failed: %m");
/* but don't send signal to processes too often */
diff = ioloop_time - service->last_login_notify_time;