[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp

Henry Castro hcastro at collabora.com
Sun Jul 19 14:08:18 PDT 2015


 loolwsd/LOOLWSD.cpp |    9 +++++++++
 loolwsd/LOOLWSD.hpp |    1 +
 2 files changed, 10 insertions(+)

New commits:
commit de3d97d5a4f4a711808c98e067af8a01b4956e78
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Jul 19 16:49:11 2015 -0400

    loolwsd: create PID log file.
    
    The PID log file is used by external utilities
    to report processes, threads, etc.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index e38a971..0670876 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -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();
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 86896a8..099de04 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -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;


More information about the Libreoffice-commits mailing list