From: Mikko Ylinen Date: Thu, 4 Sep 2014 13:42:31 +0000 (+0300) Subject: Unmask SIGTERM and enable PIDFile for systemd X-Git-Tag: accepted/tizen/common/20140918.164438^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_wearable;p=platform%2Fcore%2Fsystem%2Fsystem-server.git Unmask SIGTERM and enable PIDFile for systemd systemd service stop logic uses SIGTERM to stop services. However, system_server daemon ignores that signal: systemd[1]: Stopping Start the system server service... system_server[3392]: main.c: sig_quit(47) > received SIGTERM signal 15 Due to TimeoutStopSec=2 being set, systemd waits 2 seconds until it proceeds with kill: systemd[1]: system-server.service stopping timed out. Killing. systemd[1]: system-server.service: main process exited, code=killed, status=9/KILL This delays system shutdown time. Additionally, add PIDFile to tell systemd the .pid system_server uses. This is useful since system-service.service uses 'forking' and is run via device-daemon script. Bug-Tizen: TC-1502 Change-Id: I5b00cf11a67ab15b651d754d270b0549c3f806f4 Signed-off-by: Mikko Ylinen --- diff --git a/src/core/main.c b/src/core/main.c index 8ce0730..1e8f1aa 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -42,11 +42,6 @@ static void writepid(char *pidpath) } } -static void sig_quit(int signo) -{ - _E("received SIGTERM signal %d", signo); -} - static void sig_usr1(int signo) { _D("received SIGUSR1 signal %d, deviced'll be finished!", signo); @@ -60,7 +55,6 @@ static int system_main(int argc, char **argv) init_ad(&ad); devices_init(&ad); - signal(SIGTERM, sig_quit); signal(SIGUSR1, sig_usr1); ecore_main_loop_begin(); diff --git a/systemd/system-server.service b/systemd/system-server.service index 22540c9..26ce393 100644 --- a/systemd/system-server.service +++ b/systemd/system-server.service @@ -1,11 +1,11 @@ [Unit] -Description=Start the system server service +Description=System server After=vconf-setup.service [Service] # set DISPLAY for usb_setting launching Type=forking -Environment=DISPLAY=:0 +PIDFile=/var/run/.system_server.pid ExecStart=/usr/bin/device-daemon TimeoutStopSec=2 NotifyAccess=all