flu.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | flu.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
#include "../common/gdsassert.h" | #include "../common/gdsassert.h" | |||
#include "../jrd/flu_proto.h" | #include "../jrd/flu_proto.h" | |||
#include "../yvalve/gds_proto.h" | #include "../yvalve/gds_proto.h" | |||
#include "../jrd/err_proto.h" | #include "../jrd/err_proto.h" | |||
#include "gen/iberror.h" | #include "gen/iberror.h" | |||
#include <string.h> | #include <string.h> | |||
#if (defined SOLARIS || defined LINUX || defined AIX_PPC || defined FREEBSD || d efined NETBSD || defined HPUX) | #if (defined SOLARIS || defined LINUX || defined DARWIN || defined AIX_PPC || de fined FREEBSD || defined NETBSD || defined HPUX) | |||
#define DYNAMIC_SHARED_LIBRARIES | #define DYNAMIC_SHARED_LIBRARIES | |||
#endif | #endif | |||
using namespace Firebird; | using namespace Firebird; | |||
namespace { | namespace { | |||
Firebird::InitInstance<Jrd::Module::LoadedModules> loadedModules; | Firebird::InitInstance<Jrd::Module::LoadedModules> loadedModules; | |||
Firebird::GlobalPtr<Firebird::Mutex> modulesMutex; | Firebird::GlobalPtr<Firebird::Mutex> modulesMutex; | |||
template <typename S> | template <typename S> | |||
skipping to change at line 116 | skipping to change at line 116 | |||
{MOD_SUFFIX, ".DLL", false}, | {MOD_SUFFIX, ".DLL", false}, | |||
#endif | #endif | |||
// always try to use module "as is" | // always try to use module "as is" | |||
{MOD_SUFFIX, "", false}, | {MOD_SUFFIX, "", false}, | |||
#ifdef DYNAMIC_SHARED_LIBRARIES | #ifdef DYNAMIC_SHARED_LIBRARIES | |||
{MOD_SUFFIX, "." SHRLIB_EXT, true}, | {MOD_SUFFIX, "." SHRLIB_EXT, true}, | |||
{MOD_PREFIX, "lib", true}, | {MOD_PREFIX, "lib", true}, | |||
#endif | #endif | |||
/* | ||||
#ifdef DARWIN | ||||
{MOD_SUFFIX, ".dylib", true}, | ||||
#endif | ||||
*/ | ||||
}; | }; | |||
// UDF/BLOB filter verifier | // UDF/BLOB filter verifier | |||
class UdfDirectoryList : public Firebird::DirectoryList | class UdfDirectoryList : public Firebird::DirectoryList | |||
{ | { | |||
private: | private: | |||
const Firebird::PathName getConfigString() const | const Firebird::PathName getConfigString() const | |||
{ | { | |||
return Firebird::PathName(Config::getUdfAccess()); | return Firebird::PathName(Config::getUdfAccess()); | |||
} | } | |||
skipping to change at line 167 | skipping to change at line 163 | |||
for (itr it = loadedModules().begin(); it != loadedModules().end( ); ++it) | for (itr it = loadedModules().begin(); it != loadedModules().end( ); ++it) | |||
{ | { | |||
if (**it == name) | if (**it == name) | |||
{ | { | |||
return *it; | return *it; | |||
} | } | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
FPTR_INT Module::lookup(const char* module, const char* name, DatabaseMod ules& interest) | FPTR_INT Module::lookup(const char* module, const char* name, Database* d bb) | |||
{ | { | |||
// Try to find loadable module | // Try to find loadable module | |||
Module m = lookupModule(module); | Module m = lookupModule(module); | |||
if (! m) | if (! m) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
Firebird::string symbol; | Firebird::string symbol; | |||
terminate_at_space(symbol, name); | terminate_at_space(symbol, name); | |||
void* rc = m.lookupSymbol(symbol); | void* rc = m.lookupSymbol(symbol); | |||
if (rc) | if (rc) | |||
{ | dbb->registerModule(m); | |||
if (!interest.exist(m)) | ||||
{ | ||||
interest.add(m); | ||||
} | ||||
} | ||||
return (FPTR_INT)rc; | return (FPTR_INT)rc; | |||
} | } | |||
// flag 'udf' means pass name-path through UdfDirectoryList | // flag 'udf' means pass name-path through UdfDirectoryList | |||
Module Module::lookupModule(const char* name) | Module Module::lookupModule(const char* name) | |||
{ | { | |||
Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION); | Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION); | |||
Firebird::PathName initialModule; | Firebird::PathName initialModule; | |||
skipping to change at line 256 | skipping to change at line 247 | |||
} | } | |||
// The module name, including directory path, | // The module name, including directory path, | |||
// must satisfy UdfAccess entry in config file. | // must satisfy UdfAccess entry in config file. | |||
if (! iUdfDirectoryList().isPathInList(fixedModule)) | if (! iUdfDirectoryList().isPathInList(fixedModule)) | |||
{ | { | |||
ERR_post(Arg::Gds(isc_conf_access_denied) << Arg: :Str("UDF/BLOB-filter module") << | ERR_post(Arg::Gds(isc_conf_access_denied) << Arg: :Str("UDF/BLOB-filter module") << | |||
Arg::Str(initialModule)); | Arg::Str(initialModule)); | |||
} | } | |||
ModuleLoader::Module* mlm = ModuleLoader::loadModule(fixe dModule); | ModuleLoader::Module* mlm = ModuleLoader::loadModule(NULL , fixedModule); | |||
if (mlm) | if (mlm) | |||
{ | { | |||
im = FB_NEW_POOL(*getDefaultMemoryPool()) | im = FB_NEW_POOL(*getDefaultMemoryPool()) | |||
InternalModule(*getDefaultMemoryPool(), m lm, initialModule, fixedModule); | InternalModule(*getDefaultMemoryPool(), m lm, initialModule, fixedModule); | |||
loadedModules().add(im); | loadedModules().add(im); | |||
return Module(im); | return Module(im); | |||
} | } | |||
} | } | |||
// let others raise 'missing library' error if needed | // let others raise 'missing library' error if needed | |||
return Module(); | return Module(); | |||
} | } | |||
Module::~Module() | ||||
{ | ||||
if (interMod) | ||||
{ | ||||
Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION); | ||||
interMod = NULL; // This makes RefPtr call release | ||||
() | ||||
} | ||||
} | ||||
Module::InternalModule::~InternalModule() | Module::InternalModule::~InternalModule() | |||
{ | { | |||
delete handle; | fb_assert(modulesMutex->locked()); | |||
Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION); | delete handle; | |||
for (FB_SIZE_T m = 0; m < loadedModules().getCount(); m++) | for (FB_SIZE_T m = 0; m < loadedModules().getCount(); m++) | |||
{ | { | |||
if (loadedModules()[m] == this) | if (loadedModules()[m] == this) | |||
{ | { | |||
loadedModules().remove(m); | loadedModules().remove(m); | |||
return; | return; | |||
} | } | |||
} | } | |||
End of changes. 8 change blocks. | ||||
16 lines changed or deleted | 17 lines changed or added |