diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-09-01 18:35:23 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-09-04 21:58:53 +0800 |
| commit | 00bb3bb6f07660bd914d29a1389342bb3060d254 (patch) | |
| tree | 431f574922494d2201718f13085f17bc6bd7fb42 /indra/media_plugins/base/media_plugin_base.cpp | |
| parent | a8636720129952c10cf49ab80da21bf8b340b96c (diff) | |
| parent | 4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff) | |
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/media_plugins/base/media_plugin_base.cpp')
| -rw-r--r-- | indra/media_plugins/base/media_plugin_base.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp index 2d55f99dbe..692c2f6c1c 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 || __FreeBSD__ +#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); + } } } @@ -268,13 +267,13 @@ pid_t getParentPid( pid_t aPid ) { std::string line; line.resize( 1024, 0 ); - in.getline( &line[0], line.length() ); + in.getline( &line[0], line.length() ); auto i = line.find( "PPid:" ); - + if( i == std::string::npos ) continue; - + char const *pIn = line.c_str() + 5; // Skip over pid; while( *pIn != 0 && isspace( *pIn ) ) ++pIn; |
