[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLBroker.cpp

Henry Castro hcastro at collabora.com
Sun Sep 27 14:33:47 PDT 2015


 loolwsd/LOOLBroker.cpp |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 764f9f398ad86004509f5d8b3c527fc40c787bb6
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Sep 27 17:33:05 2015 -0400

    loolwsd: create reader FIFO to read messages from childs

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 1c52500..f120ff6 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -57,9 +57,12 @@ using Poco::Process;
 using Poco::Thread;
 using Poco::ProcessHandle;
 
+const std::string FIFO_BROKER = "/tmp/loolbroker.fifo";
 const std::string BROKER_SUFIX = ".fifo";
 const std::string BROKER_PREFIX = "/tmp/lokit";
 
+static int readerChild = -1;
+
 static unsigned int childCounter = 0;
 
 static std::map<Poco::Process::PID, int> _childProcesses;
@@ -466,6 +469,12 @@ int main(int argc, char** argv)
     dropCapability();
 #endif
 
+    if (mkfifo(FIFO_BROKER.c_str(), 0666) == -1)
+    {
+        std::cout << Util::logPrefix() << "Fail to create pipe FIFO " << strerror(errno) << std::endl;
+        exit(-1);
+    }
+
     bool sharePages = globalPreinit(loSubPath);
 
     if ( startupLibreOfficeKit(sharePages, _numPreSpawnedChildren, loSubPath, _childId) < 0 )
@@ -474,6 +483,12 @@ int main(int argc, char** argv)
         exit(-1);
     }
 
+    if ( (readerChild = open(FIFO_BROKER.c_str(), O_RDONLY) ) < 0 )
+    {
+        std::cout << Util::logPrefix() << "pipe opened for reading: " << strerror(errno) << std::endl;
+        exit(-1);
+    }
+
     while (_childProcesses.size() > 0)
     {
         int status;


More information about the Libreoffice-commits mailing list