Loading...
Searching...
No Matches
XrdOucPreload.cc File Reference
`#include <cstdio>`
`#include "XrdVersion.hh"`
`#include "XrdOuc/XrdOucVerName.hh"`
`#include "XrdOuc/XrdOucPreload.hh"`
`#include "XrdSys/XrdSysPlugin.hh"`
Include dependency graph for XrdOucPreload.cc:

Go to the source code of this file.

## Functions

bool | XrdOucPreload (const char *plib, char *eBuff, int eBlen, bool retry)
| This include file define a utility function that pre-loads a plugin.

## Function Documentation

## XrdOucPreload()

bool XrdOucPreload | ( | const char * | plib,
|  | char * | eBuff,
|  | int | eBlen,
|  | bool | retry = false )

This include file define a utility function that pre-loads a plugin.

Preload a plugin and persist its image. Internal plugin version checking is performed when the plugin is actually initialized.

Parameters

  plib | Pointer to the shared library path that contains the plugin.
  eBuff | Pointer to a buffer tat is to receive any messages. Upon failure it will contain an eror message. Upon success it will contain an informational message that describes the version that was loaded.
  eBlen | The length of the eBuff, it should be at least 1K to avoid message truncation as the message may have a path.
  retry | When true: if the version name of the plugin is not found, try to preload the unversioned name. When false: Only the versioned name of the plugin may be preloaded (i.e. libXXXX-n.so).

Returns
  true The plugin was successfully loaded.
  false The plugin could not be loaded, eBuff contains the reason.

Definition at line 42 of file XrdOucPreload.cc.

{
char theLib[2048];
bool dummy;
// Perform versioning
//
if (!XrdOucVerName::Version(XRDPLUGIN_SOVERSION, plib, dummy,
theLib, sizeof(theLib)))
{snprintf(eBuff, eBlen,
"Unable to preload plugin via %s; path too long.", plib);
return false;
}
// Preload the library. If we failed, we will try to fallback to the
// unversioned name is we are allowed to do so.
//
*eBuff = 0;
if (XrdSysPlugin::Preload(theLib, eBuff, eBlen)
|| (retry && XrdSysPlugin::Preload(plib, eBuff, eBlen))) return true;
return false;
}
XrdOucVerName::Version
static int Version(const char *piVers, const char *piPath, bool &noFBK, char *buff, int blen)
Definition XrdOucVerName.cc:96
XrdSysPlugin::Preload
static bool Preload(const char *path, char *ebuff=0, int eblen=0)
Definition XrdSysPlugin.cc:435

References XrdSysPlugin::Preload(), and XrdOucVerName::Version().

Here is the call graph for this function: