Skip to content
Snippets Groups Projects
Commit 4a68570c authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti Committed by Steven Murray
Browse files

Fixed bug #102602: RFE: Remove support for loading service libraries at run-time

parent aa5a5f60
Branches
Tags
No related merge requests found
......@@ -261,7 +261,7 @@ ClientDependsOnLibrary(ns,castorns)
ClientDependsOnLibrary(dlf,castordlf)
STGLIB_OBJS = $(STGLIB_SRCS:.cpp=.o)
ClientSharedLibraryTarget(castorclient,$(STGLIB_OBJS) $(STAGERLIB_OBJS),,-lm -ldl)
ClientSharedLibraryTarget(castorclient,$(STGLIB_OBJS) $(STAGERLIB_OBJS),,-lm)
EXAMPLEFILE(castor.conf,/etc/castor,install)
EXAMPLEFILE(rsyslog.conf.client,/etc/castor,install)
......
......@@ -34,8 +34,6 @@
#include "ICnvSvc.hpp"
#include "castor/exception/Exception.hpp"
#include "castor/exception/Internal.hpp"
#include "common.h" // for getconfent
#include "dlfcn.h"
//-----------------------------------------------------------------------------
// Constructor
......@@ -54,13 +52,6 @@ castor::Services::~Services() {
delete it->second;
}
m_services.clear();
// close all dlopen handles
for (std::vector<void*>::const_iterator it = m_dlopenHandles.begin();
it != m_dlopenHandles.end();
it++) {
dlclose(*it);
}
m_dlopenHandles.clear();
}
//-----------------------------------------------------------------------------
......@@ -74,43 +65,19 @@ castor::IService* castor::Services::service(const std::string name,
if (id > 0) {
// build the service using the associated factory
const ISvcFactory* fac = castor::Factories::instance()->factory(id);
int id2 = id;
if (fac == 0) {
// no factory found: search for id remapping in the config file
char* targetId = getconfent("SvcMapping", castor::ServicesIdStrings[id], 0);
if (0 != targetId) {
id2 = strtol(targetId, NULL, 10);
if(id2 == 0) id2 = id;
}
// build the service using the new associated factory - 2nd try
fac = castor::Factories::instance()->factory(id2);
}
if (fac == 0) {
// not yet found: check if a .so library has to be loaded
char* targetLib = getconfent("DynamicLib", castor::ServicesIdStrings[id2], 0);
if(0 != targetLib) {
void* handle = dlopen(targetLib, RTLD_NOW);//RTLD_GLOBAL
if (handle == 0) {
// something wrong in the config file?
castor::exception::Internal ex;
ex.getMessage() << "Couldn't load dynamic library for service "
<< name << ": " << dlerror();
throw ex;
} else {
m_dlopenHandles.push_back(handle);
}
}
// build the service - 3rd try
fac = castor::Factories::instance()->factory(id2);
// if no factory is available, complain
if (0 == fac) {
castor::exception::Internal e;
e.getMessage() << "No factory found for object type " << id;
throw e;
}
// if no factory is available yet, we give up
if(fac == 0) return 0;
IService* svc = fac->instantiate(name);
// if the service was not instantiated, complain
if (0 == svc) {
return 0;
castor::exception::Internal e;
e.getMessage() << "No service found for service " << name;
throw e;
} else {
m_services[name] = svc;
}
......
......@@ -221,9 +221,6 @@ namespace castor {
/** the list of services, by name */
std::map<const std::string, IService*> m_services;
/** the list of dlopen handles to be closed at the end */
std::vector<void*> m_dlopenHandles;
};
} // end of namespace castor
......
......@@ -835,41 +835,7 @@
#LogMask diskmanagerd LOG_INFO
#LogMask repackd LOG_INFO
################################################################################
#
# Service mapping - which type of database should be used for a given service.
# This is still supported in the code but deprecated as the only functioning
# database backend for CASTOR is Oracle.
#
#SvcMapping DBCNV 16 #SVC_ORACNV
#SvcMapping DBRHSVC 42 #SVC_ORARHSVC
#SvcMapping DBSTAGERSVC 18 #SVC_ORASTAGERSVC
#SvcMapping DBJOBSVC 21 #SVC_ORAJOBSVC
#SvcMapping DBGCSVC 22 #SVC_ORAGCSVC
#SvcMapping DBQUERYSVC 23 #SVC_ORAQUERYSVC
#SvcMapping DBVDQMSVC 24 #SVC_ORAVDQMSVC
#
# Library definition (dlopen) - which library holds which service.
# This is still supported in the code but deprecated as all daemons are linked
# to their libraries and don't need to load extra libraries at runtime.
#
#DynamicLib ORACNV libcastorcommonora.so.2.1
#DynamicLib ORARHSVC libcastorcommonora.so.2.1
#DynamicLib ORASTAGERSVC libcastorcommonora.so.2.1
#DynamicLib ORATAPESVC libcastorcommonora.so.2.1
#DynamicLib ORAFSSVC libcastorcommonora.so.2.1
#DynamicLib ORAJOBSVC libcastorcommonora.so.2.1
#DynamicLib ORAGCSVC libcastorcommonora.so.2.1
#DynamicLib ORAQUERYSVC libcastorcommonora.so.2.1
#DynamicLib ORAVDQMSVC libcastorvdqmora.so.2.1
# To be documented or dropped
#ACCT RFIO no
# End-of-File
......@@ -18,8 +18,8 @@ RFIOLIB = DepSharedLibraryTargetName(rfio,castorrfio)
#if UseGSI
LIBCRYPTO += -lcrypto
#endif
AddLdFlags(-ldl)
#endif
CKSUMLIB = -lz
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment