qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r832853 - in /qpid/trunk/qpid/cpp/src: qpid/Modules.cpp qpid/sys/posix/Shlib.cpp qpidd.cpp
Date Wed, 04 Nov 2009 19:33:56 GMT
Author: aconway
Date: Wed Nov  4 19:33:56 2009
New Revision: 832853

URL: http://svn.apache.org/viewvc?rev=832853&view=rev
Log:
Automatically add shared library suffix to module name in --load-module.

Allows the suffix to be omitted in qpidd.conf or qpidd options so they are portable.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/Modules.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
    qpid/trunk/qpid/cpp/src/qpidd.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/Modules.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/Modules.cpp?rev=832853&r1=832852&r2=832853&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/Modules.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/Modules.cpp Wed Nov  4 19:33:56 2009
@@ -30,6 +30,21 @@
 
 namespace fs=boost::filesystem;
 
+namespace {
+
+// CMake sets QPID_MODULE_SUFFIX; Autoconf doesn't, so assume Linux .so
+#if defined (QPID_MODULE_SUFFIX)
+    std::string suffix(QPID_MODULE_SUFFIX);
+#else
+    std::string suffix(".so");
+#endif
+
+bool isShlibName(const std::string& name) {
+    return name.find (suffix) == name.length() - suffix.length();
+}
+
+}
+
 namespace qpid {
 
 ModuleOptions::ModuleOptions(const std::string& defaultModuleDir)
@@ -41,7 +56,9 @@
         ("no-module-dir", optValue(noLoad),          "Don't load modules from module directory");
 }
 
-void tryShlib(const char* libname, bool noThrow) {
+void tryShlib(const char* libname_, bool noThrow) {
+    std::string libname(libname_);
+    if (!isShlibName(libname)) libname += suffix;
     try {
         sys::Shlib shlib(libname);
         QPID_LOG (info, "Loaded Module: " << libname);
@@ -68,17 +85,9 @@
     }
 
     fs::directory_iterator endItr;
-    // CMake sets QPID_MODULE_SUFFIX; Autoconf doesn't, so assume Linux .so
-#if defined (QPID_MODULE_SUFFIX)
-    std::string suffix(QPID_MODULE_SUFFIX);
-#else
-    std::string suffix(".so");
-#endif
     for (fs::directory_iterator itr (dirPath); itr != endItr; ++itr)
     {
-        if (!fs::is_directory(*itr) &&
-            itr->string().find (suffix) ==
-                itr->string().length() - suffix.length())
+        if (!fs::is_directory(*itr) && isShlibName(itr->string()))
             tryShlib (itr->string().data(), true);
     }
 }

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/posix/Shlib.cpp?rev=832853&r1=832852&r2=832853&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/posix/Shlib.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/posix/Shlib.cpp Wed Nov  4 19:33:56 2009
@@ -27,7 +27,7 @@
 namespace sys {
 
 void Shlib::load(const char* name) {
-    dlerror();
+    ::dlerror();
     handle = ::dlopen(name, RTLD_NOW);
     const char* error = ::dlerror();
     if (error) {

Modified: qpid/trunk/qpid/cpp/src/qpidd.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpidd.cpp?rev=832853&r1=832852&r2=832853&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpidd.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpidd.cpp Wed Nov  4 19:33:56 2009
@@ -24,7 +24,6 @@
 #include "qpid/Version.h"
 #include "qpid/log/Logger.h"
 #include "qpid/log/Statement.h"
-#include "qpid/sys/Shlib.h"
 
 #include <iostream>
 #include <memory>



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message