loolwsd: create PID log file.
The PID log file is used by external utilities to report processes, threads, etc.
This commit is contained in:
parent
6e5df9acda
commit
de3d97d5a4
2 changed files with 10 additions and 0 deletions
|
@ -92,6 +92,7 @@ DEALINGS IN THE SOFTWARE.
|
|||
#include <Poco/Net/Net.h>
|
||||
#include <Poco/ThreadLocal.h>
|
||||
#include <Poco/NamedMutex.h>
|
||||
#include <Poco/FileStream.h>
|
||||
|
||||
|
||||
#include "LOOLProtocol.hpp"
|
||||
|
@ -429,6 +430,7 @@ bool LOOLWSD::runningAsRoot = false;
|
|||
int LOOLWSD::uid = 0;
|
||||
#endif
|
||||
const std::string LOOLWSD::CHILD_URI = "/loolws/child/";
|
||||
const std::string LOOLWSD::PIDLOG = "/tmp/loolwsd.pid";
|
||||
|
||||
LOOLWSD::LOOLWSD() :
|
||||
_doTest(false),
|
||||
|
@ -1024,6 +1026,13 @@ int LOOLWSD::main(const std::vector<std::string>& args)
|
|||
if (_doTest)
|
||||
_numPreSpawnedChildren = 1;
|
||||
|
||||
// log pid information
|
||||
{
|
||||
Poco::FileOutputStream filePID(LOOLWSD::PIDLOG);
|
||||
if (filePID.good())
|
||||
filePID << Process::id();
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> rngLock(_rngMutex);
|
||||
_childId = (((Poco::UInt64)_rng.next()) << 32) | _rng.next() | 1;
|
||||
rngLock.unlock();
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
static const int MASTER_PORT_NUMBER = 9981;
|
||||
static const int FILE_PORT_NUMBER = 9979;
|
||||
static const std::string CHILD_URI;
|
||||
static const std::string PIDLOG;
|
||||
|
||||
protected:
|
||||
void initialize(Poco::Util::Application& self) override;
|
||||
|
|
Loading…
Reference in a new issue