32#define LOG(kind, ...) GNUNET_log_from (kind, "util-plugin", __VA_ARGS__)
87 _ (
"Initialization of plugin mechanism failed: %s!\n"),
91 opath = lt_dlgetsearchpath ();
103 lt_dlsetsearchpath (cpath);
109 lt_dlsetsearchpath (path);
128 if (NULL ==
getenv (
"VALGRINDING_PLUGINS"))
151 mptr = lt_dlsym (plug->
handle,
154 mptr = lt_dlsym (plug->
handle,
158 _ (
"`%s' failed to resolve method '%s' with error: %s\n"),
179 libhandle = lt_dlopenext (library_name);
180 if (NULL == libhandle)
183 plug.
name = (
char *) library_name;
189 lt_dlclose (libhandle);
192 lt_dlclose (libhandle);
211 libhandle = lt_dlopenext (library_name);
212 if (NULL == libhandle)
215 _ (
"`%s' failed for library `%s' with error: %s\n"),
228 if ( (NULL ==
init) ||
231 lt_dlclose (libhandle);
252 while ( (NULL != pos) &&
253 (0 != strcmp (pos->
name,
271 if (NULL ==
getenv (
"VALGRINDING_PLUGINS"))
325 const char *slashpos;
333 while (NULL != (slashpos = strstr (libname,
335 libname = slashpos + 1;
336 n = strlen (libname);
342 (0 == strcmp (&libname[n - 3],
".la")) )
345 if (NULL != (dot = strstr (
basename,
".")))
371 _ (
"Could not determine plugin installation path.\n"));
static int ret
Final status code.
static char * init
Set to the name of a service to start.
static struct GNUNET_FS_Handle * ctx
static char * name
Name (label) of the records to list.
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
#define GNUNET_log(kind,...)
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
char * GNUNET_OS_installation_get_path(enum GNUNET_OS_InstallationPathKind dirkind)
Get the path to a specific GNUnet installation directory or, with GNUNET_OS_IPK_SELF_PREFIX,...
void GNUNET_OS_init(const struct GNUNET_OS_ProjectData *pd)
Setup OS subsystem with project data.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
@ GNUNET_OS_IPK_LIBDIR
Return the directory where libraries are installed.
void GNUNET_PLUGIN_load_all(const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name.
void * GNUNET_PLUGIN_load(const char *library_name, void *arg)
Setup plugin (runs the "init" callback and returns whatever "init" returned).
void *(* GNUNET_PLUGIN_Callback)(void *arg)
Signature of any function exported by a plugin.
void GNUNET_PLUGIN_load_all_in_context(const struct GNUNET_OS_ProjectData *ctx, const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name while inside the given context (i....
void * GNUNET_PLUGIN_unload(const char *library_name, void *arg)
Unload plugin (runs the "done" callback and returns whatever "done" returned).
enum GNUNET_GenericReturnValue GNUNET_PLUGIN_test(const char *library_name)
Test if a plugin exists.
void(* GNUNET_PLUGIN_LoaderCallback)(void *cls, const char *library_name, void *lib_ret)
Signature of a function called by GNUNET_PLUGIN_load_all().
static void plugin_fini(void)
Shutdown libtool.
static GNUNET_PLUGIN_Callback resolve_function(struct PluginList *plug, const char *name)
Lookup a function in the plugin.
static int find_libraries(void *cls, const char *filename)
Function called on each plugin in the directory.
static void plugin_init(void)
Setup libtool paths.
static char * old_dlsearchpath
Libtool search path before we started.
static struct PluginList * plugins
List of plugins we have loaded.
static int initialized
Have we been initialized?
Project-specific data used to help the OS subsystem find installation paths.
Closure for find_libraries().
const char * basename
Prefix the plugin names we find have to match.
void * cb_cls
Closure for cb.
void * arg
Argument to give to 'init' when loading the plugin.
GNUNET_PLUGIN_LoaderCallback cb
Function to call for each plugin.
Linked list of active plugins.
char * name
Name of the library.
struct PluginList * next
This is a linked list.
void * handle
System handle.