1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

util: unify implementation of NOP signal handler

This is highly complex code after all, we really should make sure to
only keep one implementation of this extremely difficult function
around.
This commit is contained in:
Lennart Poettering 2015-09-23 01:32:44 +02:00
parent e6e242ad2d
commit 189d5bac5c
4 changed files with 8 additions and 6 deletions

View File

@ -6916,3 +6916,7 @@ int receive_one_fd(int transport_fd, int flags) {
return *(int*) CMSG_DATA(found); return *(int*) CMSG_DATA(found);
} }
void nop_signal_handler(int sig) {
/* nothing here */
}

View 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 send_one_fd(int transport_fd, int fd, int flags);
int receive_one_fd(int transport_fd, int flags); int receive_one_fd(int transport_fd, int flags);
void nop_signal_handler(int sig);

View File

@ -115,8 +115,6 @@ static bool arg_default_blockio_accounting = false;
static bool arg_default_memory_accounting = false; static bool arg_default_memory_accounting = false;
static bool arg_default_tasks_accounting = false; static bool arg_default_tasks_accounting = false;
static void nop_handler(int sig) {}
static void pager_open_if_enabled(void) { static void pager_open_if_enabled(void) {
if (arg_no_pager <= 0) 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)); log_emergency("Caught <%s>, not dumping core.", signal_to_string(sig));
else { else {
struct sigaction sa = { struct sigaction sa = {
.sa_handler = nop_handler, .sa_handler = nop_signal_handler,
.sa_flags = SA_NOCLDSTOP|SA_RESTART, .sa_flags = SA_NOCLDSTOP|SA_RESTART,
}; };
pid_t pid; pid_t pid;

View File

@ -2282,8 +2282,6 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
return r; return r;
} }
static void nop_handler(int sig) {}
static int on_orderly_shutdown(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { static int on_orderly_shutdown(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
pid_t pid; pid_t pid;
@ -3241,7 +3239,7 @@ int main(int argc, char *argv[]) {
ContainerStatus container_status; ContainerStatus container_status;
_cleanup_(barrier_destroy) Barrier barrier = BARRIER_NULL; _cleanup_(barrier_destroy) Barrier barrier = BARRIER_NULL;
static const struct sigaction sa = { static const struct sigaction sa = {
.sa_handler = nop_handler, .sa_handler = nop_signal_handler,
.sa_flags = SA_NOCLDSTOP, .sa_flags = SA_NOCLDSTOP,
}; };
int ifi = 0; int ifi = 0;