summaryrefslogtreecommitdiff
path: root/src/bin/evas/evas_cserve2_main_loop_linux.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-06-12 15:34:48 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-06-14 16:38:18 +0900
commit338218109bf4c889d5392fb8a810b189eb661ca1 (patch)
tree6b7a0c7a102f5fe50df4f6b51da6887d459a95f0 /src/bin/evas/evas_cserve2_main_loop_linux.c
parent07ef0fdd93d0c1fd0f0cb7c5638d6cba5dc96466 (diff)
evas/cserve2: catch more signals and exit nicely
Also, ignore USR1 and USR2.
Diffstat (limited to 'src/bin/evas/evas_cserve2_main_loop_linux.c')
-rw-r--r--src/bin/evas/evas_cserve2_main_loop_linux.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/bin/evas/evas_cserve2_main_loop_linux.c b/src/bin/evas/evas_cserve2_main_loop_linux.c
index 35c9d56578..590a8625f2 100644
--- a/src/bin/evas/evas_cserve2_main_loop_linux.c
+++ b/src/bin/evas/evas_cserve2_main_loop_linux.c
@@ -90,16 +90,19 @@ _signal_handle_child(struct signalfd_siginfo *sinfo EINA_UNUSED)
90} 90}
91 91
92static void 92static void
93_signal_handle_int(struct signalfd_siginfo *sinfo EINA_UNUSED) 93_signal_handle_exit(struct signalfd_siginfo *sinfo)
94{ 94{
95 DBG("Received SIGINT. Honoring request."); 95 const char *name;
96 terminate = EINA_TRUE;
97}
98 96
99static void 97 switch (sinfo->ssi_signo)
100_signal_handle_term(struct signalfd_siginfo *sinfo EINA_UNUSED) 98 {
101{ 99 case SIGINT: name = "SIGINT"; break;
102 DBG("Received SIGTERM. Honoring request."); 100 case SIGTERM: name = "SIGTERM"; break;
101 case SIGQUIT: name = "SIGQUIT"; break;
102 default: return;
103 }
104
105 DBG("Received %s. Honoring request.", name);
103 terminate = EINA_TRUE; 106 terminate = EINA_TRUE;
104} 107}
105 108
@@ -123,16 +126,19 @@ _signalfd_handler(int fd, Fd_Flags flags EINA_UNUSED, void *data EINA_UNUSED)
123 switch(sinfo.ssi_signo) 126 switch(sinfo.ssi_signo)
124 { 127 {
125 case SIGCHLD: 128 case SIGCHLD:
126 _signal_handle_child(&sinfo); 129 _signal_handle_child(&sinfo);
127 break; 130 break;
128 case SIGINT: 131 case SIGINT:
129 _signal_handle_int(&sinfo);
130 break;
131 case SIGTERM: 132 case SIGTERM:
132 _signal_handle_term(&sinfo); 133 case SIGQUIT:
133 break; 134 _signal_handle_exit(&sinfo);
135 break;
136 case SIGUSR1:
137 case SIGUSR2:
138 DBG("Ignored signal %d", sinfo.ssi_signo);
139 break;
134 default: 140 default:
135 ERR("Caught unexpected signal '%d'.", sinfo.ssi_signo); 141 ERR("Caught unexpected signal '%d'.", sinfo.ssi_signo);
136 } 142 }
137 } 143 }
138} 144}
@@ -146,6 +152,9 @@ _signalfd_setup(void)
146 sigaddset(&mask, SIGCHLD); 152 sigaddset(&mask, SIGCHLD);
147 sigaddset(&mask, SIGINT); 153 sigaddset(&mask, SIGINT);
148 sigaddset(&mask, SIGTERM); 154 sigaddset(&mask, SIGTERM);
155 sigaddset(&mask, SIGQUIT);
156 sigaddset(&mask, SIGUSR1);
157 sigaddset(&mask, SIGUSR2);
149 158
150 if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1) 159 if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
151 { 160 {