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

New commits:
commit 5a1ca4269064a1cc5c8c2b2e70fec6ac0238ab52
Author: Henry Castro <[email protected]>
Date:   Mon Jul 27 23:48:47 2015 -0400

    loolwsd: preload soffice, sc, sw, sd shared ...
    
    library

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 4145d7a..9af12cf 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -5,6 +5,7 @@
 #include <utime.h>
 #include <ftw.h>
 #include <unistd.h>
+#include <dlfcn.h>
 
 #include <mutex>
 #include <cstring>
@@ -26,6 +27,11 @@
 #define INTERVAL_PROBES 10
 #define MAINTENANCE_INTERVAL 1
 
+#define LIB_SOFFICEAPP  "lib" "sofficeapp" ".so"
+#define LIB_SCLO        "lib" "sclo" ".so"
+#define LIB_SWLO        "lib" "swlo" ".so"
+#define LIB_SDLO        "lib" "sdlo" ".so"
+
 using Poco::Path;
 using Poco::File;
 using Poco::ThreadLocal;
@@ -393,6 +399,34 @@ int main(int argc, char** argv)
         Thread::sleep(std::stoul(std::getenv("SLEEPFORDEBUGGER")) * 1000);
     }
 
+    void* dlOffice = dlopen(Path("/"+ loSubPath + "/program", 
LIB_SOFFICEAPP).toString().c_str(), RTLD_NOW);
+    if ( !dlOffice )
+    {
+        std::cout << Util::logPrefix() << " Failed to load library :" << 
LIB_SOFFICEAPP << std::endl;
+        exit(-1);
+    }
+
+    void* dlSC = dlopen(Path("/"+ loSubPath + "/program", 
LIB_SCLO).toString().c_str(), RTLD_NOW);
+    if ( !dlOffice )
+    {
+        std::cout << Util::logPrefix() << " Failed to load library :" << 
LIB_SCLO << std::endl;
+        exit(-1);
+    }
+
+    void* dlSW = dlopen(Path("/"+ loSubPath + "/program", 
LIB_SWLO).toString().c_str(), RTLD_NOW);
+    if ( !dlOffice )
+    {
+        std::cout << Util::logPrefix() << " Failed to load library :" << 
LIB_SWLO << std::endl;
+        exit(-1);
+    }
+
+    void* dlSD = dlopen(Path("/"+ loSubPath + "/program", 
LIB_SDLO).toString().c_str(), RTLD_NOW);
+    if ( !dlOffice )
+    {
+        std::cout << Util::logPrefix() << " Failed to load library :" << 
LIB_SDLO << std::endl;
+        exit(-1);
+    }
+
     startupLibreOfficeKit(_numPreSpawnedChildren, loSubPath, _childId);
 
     while (_childProcesses.size() > 0)
@@ -452,6 +486,11 @@ int main(int argc, char** argv)
         Process::requestTermination(i.first);
     }
     
+    dlclose(dlOffice);
+    dlclose(dlSC);
+    dlclose(dlSW);
+    dlclose(dlSD);
+
     std::cout << Util::logPrefix() << "loolbroker finished OK!" << std::endl;
     return 0;
 }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to