]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Replace service_error() with e_error()
authorMarco Bettini <marco.bettini@open-xchange.com>
Thu, 13 Oct 2022 14:44:09 +0000 (14:44 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 26 Oct 2022 16:35:08 +0000 (16:35 +0000)
This reverts commit e9ea9531521abf1e1a8456b30bf9d3668186b26a.

src/master/service-anvil.c
src/master/service-listen.c
src/master/service-log.c
src/master/service-monitor.c
src/master/service-process.c
src/master/service.c
src/master/service.h

index 812e6d526a1d21c2aa38d01088b6308d44859ba6..a6578415df03b75197ee304da71a1a27e321a44f 100644 (file)
@@ -112,7 +112,7 @@ void service_anvil_process_created(struct service_process *process)
 
        if (anvil_send_handshake(anvil->blocking_fd[1], &error) < 0 ||
            anvil_send_handshake(anvil->nonblocking_fd[1], &error) < 0)
-               service_error(process->service, "%s", error);
+               e_error(process->service->event, "%s", error);
 }
 
 void service_anvil_process_destroyed(struct service_process *process)
index 55c8fe2e91365d655a207447f202a933d4f7e5d1..25e83581dd19d853fba907de7a383990a4d61c20 100644 (file)
@@ -236,7 +236,7 @@ int service_listener_listen(struct service_listener *l)
                i_unreached();
        }
        if (ret <= 0)
-               service_error(l->service, "%s", error);
+               e_error(l->service->event, "%s", error);
        return ret;
 }
 
index f5af931f1910bd59e90252eaf740ba0e8c1ac888..9be26e0c0f882b2e92756aa6bce256e4fc72c36b 100644 (file)
@@ -123,12 +123,12 @@ void services_log_deinit(struct service_list *service_list)
        for (i = 0; i < count; i++) {
                if (services[i]->log_fd[0] != -1) {
                        if (close(services[i]->log_fd[0]) < 0) {
-                               service_error(services[i],
-                                             "close(log_fd) failed: %m");
+                               e_error(services[i]->event,
+                                       "close(log_fd) failed: %m");
                        }
                        if (close(services[i]->log_fd[1]) < 0) {
-                               service_error(services[i],
-                                             "close(log_fd) failed: %m");
+                               e_error(services[i]->event,
+                                       "close(log_fd) failed: %m");
                        }
                        services[i]->log_fd[0] = -1;
                        services[i]->log_fd[1] = -1;
index 99512f18d53c8e8de0910d5eb6e490fe0233875c..6b59bd4232f8a1d2a933c9bb2a75c9dfdd0a36e8 100644 (file)
@@ -45,8 +45,8 @@ static void service_process_kill_idle(struct service_process *process)
                /* 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);
@@ -54,8 +54,8 @@ static void service_process_kill_idle(struct service_process *process)
                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;
        }
@@ -149,7 +149,7 @@ service_status_input_one(struct service *service,
                   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;
        }
@@ -180,9 +180,9 @@ static void service_status_input(struct service *service)
        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);
@@ -190,7 +190,7 @@ static void service_status_input(struct service *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;
        }
@@ -235,7 +235,7 @@ static void service_monitor_throttle(struct service *service)
 
        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);
@@ -457,10 +457,10 @@ static int service_login_create_notify_fd(struct service *service)
                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;
@@ -497,7 +497,7 @@ void services_monitor_start(struct service_list *service_list)
                }
                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);
@@ -506,7 +506,7 @@ void services_monitor_start(struct service_list *service_list)
                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;
                        }
 
@@ -561,7 +561,7 @@ void service_monitor_stop(struct service *service)
            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;
@@ -570,7 +570,7 @@ void service_monitor_stop(struct service *service)
        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;
@@ -627,7 +627,7 @@ static bool service_processes_close_listeners(struct service *service)
                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));
                }
        }
index 4a0016a6a4f441abd1b27113fdd2024f8e115265..bccb6b6e2a3f76274d8be3c4d99b130c14d1d61e 100644 (file)
@@ -332,13 +332,13 @@ service_process_setup_environment(struct service *service, unsigned int uid,
 
 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);
 }
@@ -389,7 +389,7 @@ struct service_process *service_process_create(struct service *service)
                                                    (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) {
index ccdba1a4fb46a64996226e367a7dc6f9a77f4df4..1cd730f94b227f72b15327e935a3808b2666407e 100644 (file)
 
 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,
@@ -542,8 +532,8 @@ unsigned int service_signal(struct service *service, int signo,
                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) {
@@ -583,7 +573,7 @@ void service_login_notify(struct service *service, bool all_processes_full)
        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;
index e7a1b18f9b1fa54b98adff9a9facf3e8be3e8ed3..146abf6430bfaf389808bbfd7f685e758de3b617 100644 (file)
@@ -204,9 +204,6 @@ service_lookup(struct service_list *service_list, const char *name);
 struct service *
 service_lookup_type(struct service_list *service_list, enum service_type type);
 
-void service_error(struct service *service, const char *format, ...)
-       ATTR_FORMAT(2, 3);
-
 void service_pids_init(void);
 void service_pids_deinit(void);