From fea6693410fd4bdd4cb3d22b2d26bcd4d68b049b Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Wed, 31 Oct 2018 18:58:10 +0900 Subject: [PATCH] apps: signal usage cleanup --- apps/background.c | 1 + apps/compositor.c | 1 + apps/live-session.c | 1 - apps/panel.c | 2 ++ apps/pidof.c | 2 -- apps/serial-console.c | 1 - apps/sh.c | 6 +++--- apps/sudo.c | 1 - 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/background.c b/apps/background.c index af37da12..337d7cac 100644 --- a/apps/background.c +++ b/apps/background.c @@ -89,6 +89,7 @@ static void check_click(struct yutani_msg_window_mouse_event * evt) { static void sig_usr2(int sig) { yutani_set_stack(yctx, wallpaper_window, YUTANI_ZORDER_BOTTOM); yutani_flip(yctx, wallpaper_window); + signal(SIGUSR2, sig_usr2); } int main (int argc, char ** argv) { diff --git a/apps/compositor.c b/apps/compositor.c index 35369f5c..107543f9 100644 --- a/apps/compositor.c +++ b/apps/compositor.c @@ -1999,6 +1999,7 @@ static void yutani_display_resize_handle(int signum) { (void)signum; TRACE("Display change request, one moment."); _static_yg->resize_on_next = 1; + signal(SIGWINEVENT, yutani_display_resize_handle); } /** diff --git a/apps/live-session.c b/apps/live-session.c index 5632e668..ed801167 100644 --- a/apps/live-session.c +++ b/apps/live-session.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/apps/panel.c b/apps/panel.c index 0383f5b8..2cbf0508 100644 --- a/apps/panel.c +++ b/apps/panel.c @@ -193,6 +193,7 @@ static void toggle_hide_panel(void) { static void sig_int(int sig) { printf("Received shutdown signal in panel!\n"); _continue = 0; + signal(SIGINT, sig_int); } static void launch_application(char * app) { @@ -1111,6 +1112,7 @@ static void sig_usr2(int sig) { yutani_set_stack(yctx, panel, YUTANI_ZORDER_TOP); yutani_flip(yctx, panel); bind_keys(); + signal(SIGUSR2, sig_usr2); } int main (int argc, char ** argv) { diff --git a/apps/pidof.c b/apps/pidof.c index 497e63d8..90122923 100644 --- a/apps/pidof.c +++ b/apps/pidof.c @@ -7,7 +7,6 @@ * */ #include -#include #include #include #include @@ -15,7 +14,6 @@ #include #include #include -#include typedef struct process { int pid; diff --git a/apps/serial-console.c b/apps/serial-console.c index 4fbb7158..6bdef908 100644 --- a/apps/serial-console.c +++ b/apps/serial-console.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/apps/sh.c b/apps/sh.c index 8dfec1e8..fc8c4b3d 100644 --- a/apps/sh.c +++ b/apps/sh.c @@ -350,9 +350,10 @@ volatile int break_while = 0; pid_t suspended_pgid = 0; hashmap_t * job_hash = NULL; -void sig_pass(int sig) { +void sig_break_loop(int sig) { /* Interrupt handler */ break_while = sig; + signal(sig, sig_break_loop); } void redraw_prompt_func(rline_context_t * context) { @@ -1500,8 +1501,7 @@ int main(int argc, char ** argv) { pid = getpid(); - signal(SIGINT, sig_pass); - signal(SIGWINCH, sig_pass); + signal(SIGINT, sig_break_loop); job_hash = hashmap_create_int(10); diff --git a/apps/sudo.c b/apps/sudo.c index ce0367d4..685db4af 100644 --- a/apps/sudo.c +++ b/apps/sudo.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include