util: unify implementation of NOP signal handler
authorLennart Poettering <lennart@poettering.net>
Tue, 22 Sep 2015 23:32:44 +0000 (01:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 29 Sep 2015 19:08:37 +0000 (21:08 +0200)
This is highly complex code after all, we really should make sure to
only keep one implementation of this extremely difficult function
around.

src/basic/util.c
src/basic/util.h
src/core/main.c
src/nspawn/nspawn.c

index c788a1d..f7e4aef 100644 (file)
@@ -6916,3 +6916,7 @@ int receive_one_fd(int transport_fd, int flags) {
 
         return *(int*) CMSG_DATA(found);
 }
+
+void nop_signal_handler(int sig) {
+        /* nothing here */
+}
index e6417b4..96811f2 100644 (file)
@@ -944,3 +944,5 @@ int fgetxattr_malloc(int fd, const char *name, char **value);
 
 int send_one_fd(int transport_fd, int fd, int flags);
 int receive_one_fd(int transport_fd, int flags);
+
+void nop_signal_handler(int sig);
index dac233e..76abb0b 100644 (file)
@@ -115,8 +115,6 @@ static bool arg_default_blockio_accounting = false;
 static bool arg_default_memory_accounting = false;
 static bool arg_default_tasks_accounting = false;
 
-static void nop_handler(int sig) {}
-
 static void pager_open_if_enabled(void) {
 
         if (arg_no_pager <= 0)
@@ -134,7 +132,7 @@ noreturn static void crash(int sig) {
                 log_emergency("Caught <%s>, not dumping core.", signal_to_string(sig));
         else {
                 struct sigaction sa = {
-                        .sa_handler = nop_handler,
+                        .sa_handler = nop_signal_handler,
                         .sa_flags = SA_NOCLDSTOP|SA_RESTART,
                 };
                 pid_t pid;
index cb4e87f..6b5d5d5 100644 (file)
@@ -2282,8 +2282,6 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
         return r;
 }
 
-static void nop_handler(int sig) {}
-
 static int on_orderly_shutdown(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
         pid_t pid;
 
@@ -3241,7 +3239,7 @@ int main(int argc, char *argv[]) {
                 ContainerStatus container_status;
                 _cleanup_(barrier_destroy) Barrier barrier = BARRIER_NULL;
                 static const struct sigaction sa = {
-                        .sa_handler = nop_handler,
+                        .sa_handler = nop_signal_handler,
                         .sa_flags = SA_NOCLDSTOP,
                 };
                 int ifi = 0;