Added systemd notification. Fixes NEMO#637

Signed-off-by: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
pull/1/head
Pekka Lundstrom 13 years ago
parent 5b3e45bf8a
commit 23aa7485ce

@ -19,7 +19,7 @@ set(HEADERS appdata.h booster.h boosterfactory.h boosterpluginregistry.h
# Set libraries to be linked. Shared libraries to be preloaded are not linked in anymore,
# but dlopen():ed and listed in src/launcher/preload.h instead.
link_libraries(${LIBDL} ${X11_LIBRARIES})
link_libraries(${LIBDL} ${X11_LIBRARIES} "-L/lib -lsystemd-daemon")
# Set executable
add_library(applauncherd MODULE ${SRC} ${MOC_SRC})

@ -41,6 +41,7 @@
#include <fstream>
#include <sstream>
#include <stdlib.h>
#include <systemd/sd-daemon.h>
#include "coverage.h"
@ -60,7 +61,8 @@ Daemon::Daemon(int & argc, char * argv[]) :
m_bootMode(false),
m_socketManager(new SocketManager),
m_singleInstance(new SingleInstance),
m_reExec(false)
m_reExec(false),
m_notifySystemd(false)
{
if (!Daemon::m_instance)
{
@ -195,6 +197,12 @@ void Daemon::run()
forkBoosters();
}
// Notify systemd that init is done
if (m_notifySystemd) {
Logger::logDebug("Daemon: initialization done. Notify systemd\n");
sd_notify(0, "READY=1");
}
// Main loop
while (true)
{
@ -721,6 +729,10 @@ void Daemon::parseArgs(const ArgVect & args)
{
m_reExec = true;
}
else if ((*i) == "--systemd")
{
m_notifySystemd = true;
}
else
{
if ((*i).find_first_not_of(' ') != string::npos)
@ -743,6 +755,7 @@ void Daemon::usage(int status)
" Boot mode can be activated also by sending SIGUSR2\n"
" to the launcher.\n"
" -d, --daemon Run as %s a daemon.\n"
" --systemd Notify systemd when initialization is done\n"
" --debug Enable debug messages and log everything also to stdout.\n"
" -h, --help Print this help.\n\n",
PROG_NAME_LAUNCHER, PROG_NAME_LAUNCHER, PROG_NAME_LAUNCHER);

@ -240,6 +240,9 @@ private:
//! True if re-execing
bool m_reExec;
//! True if systemd needs to be notified
bool m_notifySystemd;
//! Name of the state saving directory and file
static const std::string m_stateDir;
static const std::string m_stateFile;

@ -20,7 +20,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES} -ldl)
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES} -ldl "-L/lib -lsystemd-daemon")
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -20,7 +20,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES} -ldl)
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES} -ldl "-L/lib -lsystemd-daemon")
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -17,7 +17,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} "-L/lib -lsystemd-daemon")
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

Loading…
Cancel
Save