From 70293a6b766b3c761ba023d6f816e79c5d10de3d Mon Sep 17 00:00:00 2001 From: Gary Buhrmaster Date: Thu, 22 May 2014 22:11:27 +0000 Subject: [PATCH] Feature patch for backend systemd notify support --- mythtv/configure | 12 ++++++++++++ mythtv/programs/mythbackend/main_helpers.cpp | 8 ++++++++ mythtv/programs/mythbackend/mythbackend.pro | 2 ++ 3 files changed, 22 insertions(+) diff --git a/mythtv/configure b/mythtv/configure index 325a23d1b44..866ab4c300d 100755 --- a/mythtv/configure +++ b/mythtv/configure @@ -136,6 +136,7 @@ Advanced options (experts only): --disable-opengl-video disable OpenGL based video display --disable-quartz-video disable Mac OS X CoreVideo based video display --disable-libass disable libass SSA/ASS subtitle support + --disable-systemd_notify disable systemd notify support --enable-mac-bundle produce standalone OS X apps (e.g. mythfrontend.app) @@ -1819,6 +1820,7 @@ MYTHTV_CONFIG_LIST=' profiletype debugtype mythlogserver + systemd_notify ' MYTHTV_HAVE_LIST=' @@ -2646,6 +2648,7 @@ enable libfftw3 enable taglib disable mythlogserver enable exiv2 +enable systemd_notify # mythtv paths dvb_path_default="${sysroot}/usr/include" @@ -5384,6 +5387,14 @@ enabled asi && check_cc < // O_SYNC #endif +#ifdef USING_SYSTEMD_NOTIFY + #include +#endif // C headers #include @@ -696,6 +699,11 @@ int run_backend(MythBackendCommandLineParser &cmdline) if (gCoreContext->IsMasterBackend()) gCoreContext->SendSystemEvent("MASTER_STARTED"); +#ifdef USING_SYSTEMD_NOTIFY + // Provide systemd ready notification (for type=notify units) + (void)sd_notify(0, "READY=1"); +#endif + /////////////////////////////// /////////////////////////////// exitCode = qApp->exec(); diff --git a/mythtv/programs/mythbackend/mythbackend.pro b/mythtv/programs/mythbackend/mythbackend.pro index 71b9cd6f50f..78175b788a9 100644 --- a/mythtv/programs/mythbackend/mythbackend.pro +++ b/mythtv/programs/mythbackend/mythbackend.pro @@ -59,6 +59,8 @@ using_valgrind:DEFINES += USING_VALGRIND using_libdns_sd:DEFINES += USING_LIBDNS_SD +using_systemd_notify:DEFINES += USING_SYSTEMD_NOTIFY + xml_conf.path = $${PREFIX}/share/mythtv/backend-config/ xml_conf.files = config_backend_general.xml config_backend_database.xml