diff --git a/src/common/Constants.h.in b/src/common/Constants.h.in index f7e31e4..654331d 100644 --- a/src/common/Constants.h.in +++ b/src/common/Constants.h.in @@ -33,6 +33,7 @@ #define CONFIG_FILE "@CONFIG_FILE@" #define LOG_FILE "@LOG_FILE@" +#define PID_FILE "@PID_FILE@" #define MINIMUM_VT @MINIMUM_VT@ #define HALT_COMMAND "@HALT_COMMAND@" diff --git a/src/daemon/DaemonApp.cpp b/src/daemon/DaemonApp.cpp index 662c0f4..c525efd 100644 --- a/src/daemon/DaemonApp.cpp +++ b/src/daemon/DaemonApp.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -46,6 +47,16 @@ namespace SDDM { // log message qDebug() << "Initializing..."; + // Write PID File + if ( ! QString(QStringLiteral(PID_FILE)).isEmpty() ) { + QFile pidFile(QStringLiteral(PID_FILE)); + QString pid = QString::number(QCoreApplication::applicationPid()); + if ( pidFile.open(QIODevice::WriteOnly | QIODevice::Text) ) { + pidFile.write(pid.toLatin1().data(), qstrlen(pid.toLatin1().data())); + pidFile.close(); + } + } + // set testing parameter m_testing = (arguments().indexOf("--test-mode") != -1);