summaryrefslogtreecommitdiff
path: root/indra/media_plugins/base
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2024-10-02 00:34:51 +0200
committerKitty Barnett <develop@catznip.com>2024-10-02 00:34:51 +0200
commit48b34e07ef33965edcc38006082be01ed7ed239d (patch)
treedc236a74a900921ab1fae039f655f1cb9aca7b6c /indra/media_plugins/base
parent689f723a5f314ffa0f54c0e50a51cbe464b36ccf (diff)
parent002a81ccf5a64fd08e29811a6edea36f2e0408be (diff)
Merge branch 'develop' into rlva/base
Diffstat (limited to 'indra/media_plugins/base')
-rw-r--r--indra/media_plugins/base/media_plugin_base.cpp23
-rw-r--r--indra/media_plugins/base/media_plugin_base.h7
2 files changed, 14 insertions, 16 deletions
diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp
index 9bb3bad035..f31708c4d7 100644
--- a/indra/media_plugins/base/media_plugin_base.cpp
+++ b/indra/media_plugins/base/media_plugin_base.cpp
@@ -169,6 +169,8 @@ void MediaPluginBase::sendStatus()
#if LL_LINUX
+#include <dlfcn.h>
+
size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol )
{
gSymbolsToGrab.emplace_back(aSymbol);
@@ -177,25 +179,22 @@ size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol )
bool SymbolGrabber::grabSymbols(std::vector< std::string > const &aDSONames)
{
- std::cerr << "SYMBOLS: " << gSymbolsToGrab.size() << std::endl;
-
if (sSymsGrabbed)
return true;
- //attempt to load the shared libraries
- apr_pool_create(&sSymDSOMemoryPool, nullptr);
-
for( std::vector< std::string >::const_iterator itr = aDSONames.begin(); itr != aDSONames.end(); ++itr )
{
- apr_dso_handle_t *pDSO(NULL);
- std::string strDSO{ *itr };
- if( APR_SUCCESS == apr_dso_load( &pDSO, strDSO.c_str(), sSymDSOMemoryPool ))
- sLoadedLibraries.push_back( pDSO );
+ auto pDSO = dlopen( itr->c_str(), RTLD_NOW );
- for( auto i = 0; i < gSymbolsToGrab.size(); ++i )
+ if( pDSO )
{
- if( !*gSymbolsToGrab[i].mPPFunc )
- apr_dso_sym( gSymbolsToGrab[i].mPPFunc, pDSO, gSymbolsToGrab[i].mName );
+ sLoadedLibraries.push_back(pDSO);
+
+ for (auto i = 0; i < gSymbolsToGrab.size(); ++i)
+ {
+ if (!*gSymbolsToGrab[i].mPPFunc)
+ *gSymbolsToGrab[i].mPPFunc = dlsym(pDSO, gSymbolsToGrab[i].mName);
+ }
}
}
diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h
index a084fc9834..98e9ce0316 100644
--- a/indra/media_plugins/base/media_plugin_base.h
+++ b/indra/media_plugins/base/media_plugin_base.h
@@ -38,7 +38,7 @@ struct SymbolToGrab
{
bool mRequired;
char const *mName;
- apr_dso_handle_sym_t *mPPFunc;
+ void **mPPFunc;
};
class SymbolGrabber
@@ -52,8 +52,7 @@ private:
std::vector< SymbolToGrab > gSymbolsToGrab;
bool sSymsGrabbed = false;
- apr_pool_t *sSymDSOMemoryPool = nullptr;
- std::vector<apr_dso_handle_t *> sLoadedLibraries;
+ std::vector<void *> sLoadedLibraries;
};
extern SymbolGrabber gSymbolGrabber;
@@ -63,7 +62,7 @@ extern SymbolGrabber gSymbolGrabber;
#define LL_GRAB_SYM(SYMBOL_GRABBER, REQUIRED, SYMBOL_NAME, RETURN, ...) \
RETURN (*ll##SYMBOL_NAME)(__VA_ARGS__) = nullptr; \
size_t gRegistered##SYMBOL_NAME = SYMBOL_GRABBER.registerSymbol( \
- { REQUIRED, #SYMBOL_NAME , (apr_dso_handle_sym_t*)&ll##SYMBOL_NAME} \
+ { REQUIRED, #SYMBOL_NAME , (void**)&ll##SYMBOL_NAME} \
);
#endif