Merge branch 'master' of github.com:OpenELEC/OpenELEC.tv

This commit is contained in:
Stephan Raue 2014-03-11 14:44:06 +01:00
commit 62d454a579
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,73 @@
From 3141728598291186cc4c9d243a1e258ce6e914ae Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Mon, 10 Mar 2014 22:00:40 +0200
Subject: [PATCH 1/2] handle SIGTERM
---
xbmc/main/main.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xbmc/main/main.cpp b/xbmc/main/main.cpp
index ec86426..aa4a925 100644
--- a/xbmc/main/main.cpp
+++ b/xbmc/main/main.cpp
@@ -40,9 +40,22 @@
#include "input/linux/LIRC.h"
#endif
#include "XbmcContext.h"
+#include "Application.h"
+
+void xbmc_term_handler(int signum)
+{
+ CLog::Log(LOGINFO, "Received SIGTERM...");
+ g_application.Stop(0);
+}
int main(int argc, char* argv[])
{
+ // SIGTERM handler
+ struct sigaction action;
+ memset(&action, 0, sizeof(struct sigaction));
+ action.sa_handler = xbmc_term_handler;
+ sigaction(SIGTERM, &action, NULL);
+
// set up some xbmc specific relationships
XBMC::Context context;
--
1.9.0
From 4945dbdeff5da8b162fdf0700f4026e9d71ffe04 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Mon, 10 Mar 2014 22:02:02 +0200
Subject: [PATCH 2/2] dont Stop() on shutdown/reboot
SIGTERM should be handled instead. systemd will take care
---
xbmc/ApplicationMessenger.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp
index 3524e89..c5521f7 100644
--- a/xbmc/ApplicationMessenger.cpp
+++ b/xbmc/ApplicationMessenger.cpp
@@ -259,7 +259,6 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
case TMSG_POWERDOWN:
{
- g_application.Stop(EXITCODE_POWERDOWN);
g_powerManager.Powerdown();
}
break;
@@ -287,7 +286,6 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
case TMSG_RESTART:
case TMSG_RESET:
{
- g_application.Stop(EXITCODE_REBOOT);
g_powerManager.Reboot();
}
break;
--
1.9.0

View File

@ -12,7 +12,7 @@ EnvironmentFile=-/run/openelec/debug/xbmc.conf
ExecStart=/bin/sh -c ". /etc/profile; exec /usr/lib/xbmc/xbmc.bin --standalone -fs $XBMC_ARGS $XBMC_DEBUG"
# keep KillMode=process unless there is no good reason to switch to cgroup
KillMode=process
TimeoutStopSec=10
TimeoutStopSec=5
Restart=always
RestartSec=2
StartLimitInterval=0