LLVM API Documentation

ltdl.c File Reference

#include "llvm/Config/config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <memory.h>
#include <errno.h>
#include <dirent.h>
#include <argz.h>
#include <assert.h>
#include "ltdl.h"
#include <dlfcn.h>

Include dependency graph for ltdl.c:

Go to the source code of this file.

Classes

struct  lt_caller_data
struct  lt_dlloader
struct  lt_dlhandle_struct
struct  lt_dlsymlists_t

Defines

#define LT_USE_POSIX_DIRENT
#define LT_D_NAMLEN(dirent)   (strlen((dirent)->d_name))
#define LT_GLOBAL_DATA
#define LT_READTEXT_MODE   "r"
#define LTDL_SEARCHPATH_VAR   "LTDL_LIBRARY_PATH"
#define LTDL_ARCHIVE_EXT   ".la"
#define LT_FILENAME_MAX   1024
#define LT_SYMBOL_LENGTH   128
#define LT_SYMBOL_OVERHEAD   5
#define rpl_realloc   realloc
#define LT_DLMALLOC(tp, n)   ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
#define LT_DLREALLOC(tp, p, n)   ((tp *) lt_dlrealloc ((p), (n) * sizeof(tp)))
#define LT_DLFREE(p)   LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END
#define LT_EMALLOC(tp, n)   ((tp *) lt_emalloc ((n) * sizeof(tp)))
#define LT_EREALLOC(tp, p, n)   ((tp *) lt_erealloc ((p), (n) * sizeof(tp)))
#define LT_DLMEM_REASSIGN(p, q)
#define strdup   rpl_strdup
#define LT_ERROR(name, diagnostic)   (diagnostic),
#define LT_DLGET_FLAG(handle, flag)   (((handle)->flags & (flag)) == (flag))
#define LT_DLSET_FLAG(handle, flag)   ((handle)->flags |= (flag))
#define LT_DLRESIDENT_FLAG   (0x01 << 0)
#define LT_DLIS_RESIDENT(handle)   LT_DLGET_FLAG(handle, LT_DLRESIDENT_FLAG)
#define LT_DLSTRERROR(name)   lt_dlerror_strings[LT_CONC(LT_ERROR_,name)]
#define LT_DLMUTEX_LOCK()
#define LT_DLMUTEX_UNLOCK()
#define LT_DLMUTEX_SETERROR(errormsg)
#define LT_DLMUTEX_GETERROR(errormsg)
#define LT_GLOBAL   0
#define LT_LAZY_OR_NOW   0
#define DLERROR(arg)   dlerror ()
#define STR_DLNAME   "dlname="
#define STR_OLD_LIBRARY   "old_library="
#define STR_LIBDIR   "libdir="
#define STR_DL_DEPLIBS   "dependency_libs="
#define STR_LIBRARY_NAMES   "library_names="

Typedefs

typedef int foreach_callback_func LT_PARAMS ((char *filename, lt_ptr data1, lt_ptr data2)) = (lt_ptr (*) LT_PARAMS((size_t))) malloc

Functions

static char *lt_estrdup LT_PARAMS ((const char *str))
static lt_ptr lt_emalloc LT_PARAMS ((size_t size))
static lt_ptr lt_erealloc LT_PARAMS ((lt_ptr addr, size_t size))
LT_GLOBAL_DATA lt_ptr lt_dlrealloc LT_PARAMS ((lt_ptr ptr, size_t size))
LT_GLOBAL_DATA void lt_dlfree LT_PARAMS ((lt_ptr ptr))
static char * strdup (char *str) const
int lt_dlmutex_register (lt_dlmutex_lock *lock, lt_dlmutex_unlock *unlock, lt_dlmutex_seterror *seterror, lt_dlmutex_geterror *geterror)
int lt_dladderror (char *diagnostic) const
int lt_dlseterror (int errindex)
static lt_ptr lt_emalloc (size_t size)
static lt_ptr lt_erealloc (lt_ptr addr, size_t size)
static char * lt_estrdup (char *str) const
static lt_module sys_dl_open (lt_user_data loader_data, const char *filename)
static int sys_dl_close (lt_user_data loader_data, lt_module module)
static lt_ptr sys_dl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
static int presym_init (lt_user_data loader_data)
static int presym_free_symlists ()
static int presym_exit (lt_user_data loader_data)
static int presym_add_symlist (lt_dlsymlist *preloaded) const
static lt_module presym_open (lt_user_data loader_data, const char *filename)
static int presym_close (lt_user_data loader_data, lt_module module)
static lt_ptr presym_sym (lt_user_data loader_data, lt_module module, const char *symbol)
static int foreach_dirinpath LT_PARAMS ((const char *search_path, const char *base_name, foreach_callback_func *func, lt_ptr data1, lt_ptr data2))
static int find_file_callback LT_PARAMS ((char *filename, lt_ptr data, lt_ptr ignored))
static int foreachfile_callback LT_PARAMS ((char *filename, lt_ptr data1, lt_ptr data2))
static int canonicalize_path LT_PARAMS ((const char *path, char **pcanonical))
static int argzize_path LT_PARAMS ((const char *path, char **pargz, size_t *pargz_len))
static FILE *find_file LT_PARAMS ((const char *search_path, const char *base_name, char **pdir))
static lt_dlhandle *find_handle LT_PARAMS ((const char *search_path, const char *base_name, lt_dlhandle *handle))
static int find_module LT_PARAMS ((lt_dlhandle *handle, const char *dir, const char *libdir, const char *dlname, const char *old_name, int installed))
static int free_vars LT_PARAMS ((char *dlname, char *oldname, char *libdir, char *deplibs))
static int load_deplibs LT_PARAMS ((lt_dlhandle handle, char *deplibs))
static int trim LT_PARAMS ((char **dest, const char *str))
static int try_dlopen LT_PARAMS ((lt_dlhandle *handle, const char *filename))
static int unload_deplibs LT_PARAMS ((lt_dlhandle handle))
static int lt_argz_insert LT_PARAMS ((char **pargz, size_t *pargz_len, char *before, const char *entry))
static int lt_argz_insertinorder LT_PARAMS ((char **pargz, size_t *pargz_len, const char *entry))
static int lt_argz_insertdir LT_PARAMS ((char **pargz, size_t *pargz_len, const char *dirnam, struct dirent *dp))
static int lt_dlpath_insertdir LT_PARAMS ((char **ppath, char *before, const char *dir))
static int list_files_by_dir LT_PARAMS ((const char *dirnam, char **pargz, size_t *pargz_len))
static int file_not_found LT_PARAMS ((void))
int lt_dlinit ()
int lt_dlpreload (lt_dlsymlist *preloaded) const
int lt_dlpreload_default (lt_dlsymlist *preloaded) const
int lt_dlexit ()
static int tryall_dlopen (lt_dlhandle *handle, const char *filename)
static int tryall_dlopen_module (lt_dlhandle *handle, const char *prefix, const char *dirname, const char *dlname)
static int find_module (lt_dlhandle *handle, const char *dir, const char *libdir, const char *dlname, const char *old_name, int installed)
static int canonicalize_path (char *path, char **pcanonical) const
static int argzize_path (char *path, char **pargz, size_t *pargz_len) const
static int foreach_dirinpath (char *search_path, const char *base_name, foreach_callback_func *func, lt_ptr data1, lt_ptr data2) const
static int find_file_callback (char *filename, lt_ptr data1, lt_ptr data2)
static FILE * find_file (char *search_path, const char *base_name, char **pdir) const
static int find_handle_callback (char *filename, lt_ptr data, lt_ptr ignored)
static lt_dlhandlefind_handle (char *search_path, const char *base_name, lt_dlhandle *handle) const
static int load_deplibs (lt_dlhandle handle, char *deplibs)
static int unload_deplibs (lt_dlhandle handle)
static int trim (char **dest, const char *str)
static int free_vars (char *dlname, char *oldname, char *libdir, char *deplibs)
static int try_dlopen (lt_dlhandle *phandle, const char *filename)
lt_dlhandle lt_dlopen (char *filename) const
static int file_not_found ()
lt_dlhandle lt_dlopenext (char *filename) const
static int lt_argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry)
static int lt_argz_insertinorder (char **pargz, size_t *pargz_len, const char *entry)
static int lt_argz_insertdir (char **pargz, size_t *pargz_len, const char *dirnam, struct dirent *dp)
static int list_files_by_dir (char *dirnam, char **pargz, size_t *pargz_len) const
static int foreachfile_callback (char *dirname, lt_ptr data1, lt_ptr data2)
int lt_dlforeachfile (char *search_path, int *func, lt_ptr data) const
int lt_dlclose (lt_dlhandle handle)
lt_ptr lt_dlsym (lt_dlhandle handle, const char *symbol)
const char * lt_dlerror ()
static int lt_dlpath_insertdir (char **ppath, char *before, const char *dir)
int lt_dladdsearchdir (char *search_dir) const
int lt_dlinsertsearchdir (char *before, const char *search_dir) const
int lt_dlsetsearchpath (char *search_path) const
const char * lt_dlgetsearchpath ()
int lt_dlmakeresident (lt_dlhandle handle)
int lt_dlisresident (lt_dlhandle handle)
const lt_dlinfolt_dlgetinfo (lt_dlhandle handle)
lt_dlhandle lt_dlhandle_next (lt_dlhandle place)
int lt_dlforeach (int *func, lt_ptr data)
lt_dlcaller_id lt_dlcaller_register ()
lt_ptr lt_dlcaller_set_data (lt_dlcaller_id key, lt_dlhandle handle, lt_ptr data)
lt_ptr lt_dlcaller_get_data (lt_dlcaller_id key, lt_dlhandle handle)
int lt_dlloader_add (lt_dlloader *place, const struct lt_user_dlloader *dlloader, const char *loader_name)
int lt_dlloader_remove (char *loader_name) const
lt_dlloaderlt_dlloader_next (lt_dlloader *place)
const char * lt_dlloader_name (lt_dlloader *place)
lt_user_datalt_dlloader_data (lt_dlloader *place)
lt_dlloaderlt_dlloader_find (char *loader_name) const

Variables

static const char * lt_dlerror_strings []
static const char objdir [] = LTDL_OBJDIR
static const char archive_ext [] = LTDL_ARCHIVE_EXT
static const char shlib_ext [] = LTDL_SHLIB_EXT
static const char sys_search_path [] = LTDL_SYSSEARCHPATH
static lt_dlmutex_lock * lt_dlmutex_lock_func = 0
static lt_dlmutex_unlock * lt_dlmutex_unlock_func = 0
static lt_dlmutex_seterror * lt_dlmutex_seterror_func = 0
static lt_dlmutex_geterror * lt_dlmutex_geterror_func = 0
static const char * lt_dllast_error = 0
static const char ** user_error_strings = 0
static int errorcount = LT_ERROR_MAX
static struct lt_user_dlloader sys_dl
static const lt_dlsymlistdefault_preloaded_symbols = 0
static lt_dlsymlists_tpreloaded_symbols = 0
static struct lt_user_dlloader presym
static char * user_search_path = 0
static lt_dlloaderloaders = 0
static lt_dlhandle handles = 0
static int initialized = 0


Define Documentation

#define DLERROR ( arg   )     dlerror ()

Definition at line 1100 of file ltdl.c.

Referenced by sys_dl_close(), sys_dl_open(), and sys_dl_sym().

#define LT_D_NAMLEN ( dirent   )     (strlen((dirent)->d_name))

Definition at line 103 of file ltdl.c.

Referenced by lt_argz_insertdir().

#define LT_DLFREE (  )     LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END

Definition at line 246 of file ltdl.c.

Referenced by find_file_callback(), foreach_dirinpath(), foreachfile_callback(), free_vars(), load_deplibs(), lt_argz_insertdir(), lt_dlclose(), lt_dlopenext(), lt_dlpath_insertdir(), lt_dlsetsearchpath(), lt_dlsym(), presym_free_symlists(), trim(), try_dlopen(), tryall_dlopen(), and tryall_dlopen_module().

#define LT_DLGET_FLAG ( handle,
flag   )     (((handle)->flags & (flag)) == (flag))

Definition at line 855 of file ltdl.c.

#define LT_DLIS_RESIDENT ( handle   )     LT_DLGET_FLAG(handle, LT_DLRESIDENT_FLAG)

Definition at line 861 of file ltdl.c.

Referenced by lt_dlclose(), lt_dlexit(), lt_dlisresident(), and unload_deplibs().

#define LT_DLMALLOC ( tp,
 )     ((tp *) lt_dlmalloc ((n) * sizeof(tp)))

Definition at line 244 of file ltdl.c.

Referenced by strdup().

#define LT_DLMEM_REASSIGN ( p,
 ) 

Value:

LT_STMT_START { \
  if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; } \
            } LT_STMT_END

Definition at line 254 of file ltdl.c.

Referenced by lt_dlexit(), lt_dlpath_insertdir(), and try_dlopen().

#define LT_DLMUTEX_GETERROR ( errormsg   ) 

Value:

LT_STMT_START { \
  if (lt_dlmutex_seterror_func)       \
    (errormsg) = (*lt_dlmutex_geterror_func) ();  \
  else  (errormsg) = lt_dllast_error; } LT_STMT_END

Definition at line 896 of file ltdl.c.

Referenced by file_not_found(), lt_dlerror(), lt_dlsym(), try_dlopen(), and tryall_dlopen().

 
#define LT_DLMUTEX_LOCK (  ) 

Value:

LT_STMT_START { \
  if (lt_dlmutex_lock_func) (*lt_dlmutex_lock_func)();  \
            } LT_STMT_END

Definition at line 886 of file ltdl.c.

Referenced by foreach_dirinpath(), load_deplibs(), lt_dladderror(), lt_dladdsearchdir(), lt_dlcaller_get_data(), lt_dlcaller_register(), lt_dlcaller_set_data(), lt_dlclose(), lt_dlexit(), lt_dlforeach(), lt_dlgetsearchpath(), lt_dlinit(), lt_dlinsertsearchdir(), lt_dlloader_add(), lt_dlloader_data(), lt_dlloader_find(), lt_dlloader_name(), lt_dlloader_next(), lt_dlloader_remove(), lt_dlmutex_register(), lt_dlpreload(), lt_dlpreload_default(), lt_dlseterror(), lt_dlsetsearchpath(), presym_add_symlist(), presym_free_symlists(), presym_init(), presym_open(), try_dlopen(), and tryall_dlopen().

#define LT_DLMUTEX_SETERROR ( errormsg   ) 

Value:

LT_STMT_START { \
  if (lt_dlmutex_seterror_func)       \
    (*lt_dlmutex_seterror_func) (errormsg);   \
  else  lt_dllast_error = (errormsg); } LT_STMT_END

Definition at line 892 of file ltdl.c.

Referenced by argzize_path(), foreach_dirinpath(), lt_argz_insert(), lt_dlclose(), lt_dlerror(), lt_dlexit(), lt_dlgetinfo(), lt_dlinit(), lt_dlinsertsearchdir(), lt_dlisresident(), lt_dlloader_add(), lt_dlloader_data(), lt_dlloader_name(), lt_dlloader_remove(), lt_dlmakeresident(), lt_dlmutex_register(), lt_dlopenext(), lt_dlseterror(), lt_dlsym(), lt_emalloc(), lt_erealloc(), lt_estrdup(), presym_open(), presym_sym(), sys_dl_close(), sys_dl_open(), sys_dl_sym(), try_dlopen(), and tryall_dlopen().

 
#define LT_DLMUTEX_UNLOCK (  ) 

Value:

LT_STMT_START { \
  if (lt_dlmutex_unlock_func) (*lt_dlmutex_unlock_func)();\
            } LT_STMT_END

Definition at line 889 of file ltdl.c.

Referenced by foreach_dirinpath(), load_deplibs(), lt_dladderror(), lt_dladdsearchdir(), lt_dlcaller_register(), lt_dlclose(), lt_dlforeach(), lt_dlgetsearchpath(), lt_dlinit(), lt_dlinsertsearchdir(), lt_dlloader_data(), lt_dlloader_name(), lt_dlloader_next(), lt_dlpreload(), lt_dlpreload_default(), lt_dlseterror(), lt_dlsetsearchpath(), presym_add_symlist(), presym_free_symlists(), presym_init(), presym_open(), try_dlopen(), and tryall_dlopen().

#define LT_DLREALLOC ( tp,
p,
 )     ((tp *) lt_dlrealloc ((p), (n) * sizeof(tp)))

Definition at line 245 of file ltdl.c.

Referenced by try_dlopen().

#define LT_DLRESIDENT_FLAG   (0x01 << 0)

Definition at line 858 of file ltdl.c.

Referenced by lt_dlmakeresident(), and try_dlopen().

#define LT_DLSET_FLAG ( handle,
flag   )     ((handle)->flags |= (flag))

Definition at line 856 of file ltdl.c.

Referenced by lt_dlmakeresident(), and try_dlopen().

#define LT_DLSTRERROR ( name   )     lt_dlerror_strings[LT_CONC(LT_ERROR_,name)]

Definition at line 864 of file ltdl.c.

Referenced by argzize_path(), file_not_found(), foreach_dirinpath(), lt_argz_insert(), lt_dlclose(), lt_dlexit(), lt_dlgetinfo(), lt_dlinit(), lt_dlinsertsearchdir(), lt_dlisresident(), lt_dlloader_add(), lt_dlloader_data(), lt_dlloader_name(), lt_dlloader_remove(), lt_dlmakeresident(), lt_dlmutex_register(), lt_dlopenext(), lt_dlseterror(), lt_dlsym(), lt_emalloc(), lt_erealloc(), lt_estrdup(), presym_open(), presym_sym(), and try_dlopen().

#define LT_EMALLOC ( tp,
 )     ((tp *) lt_emalloc ((n) * sizeof(tp)))

Definition at line 249 of file ltdl.c.

Referenced by canonicalize_path(), foreach_dirinpath(), load_deplibs(), lt_argz_insertdir(), lt_dlloader_add(), lt_dlopenext(), lt_dlsym(), presym_add_symlist(), trim(), try_dlopen(), and tryall_dlopen_module().

#define LT_EREALLOC ( tp,
p,
 )     ((tp *) lt_erealloc ((p), (n) * sizeof(tp)))

Definition at line 250 of file ltdl.c.

Referenced by lt_dladderror().

#define LT_ERROR ( name,
diagnostic   )     (diagnostic),

#define LT_FILENAME_MAX   1024

Definition at line 195 of file ltdl.c.

Referenced by try_dlopen().

#define LT_GLOBAL   0

Definition at line 1072 of file ltdl.c.

Referenced by sys_dl_open().

#define LT_GLOBAL_DATA

Definition at line 147 of file ltdl.c.

#define LT_LAZY_OR_NOW   0

Definition at line 1096 of file ltdl.c.

Referenced by sys_dl_open().

#define LT_READTEXT_MODE   "r"

Definition at line 155 of file ltdl.c.

Referenced by find_file_callback(), and try_dlopen().

#define LT_SYMBOL_LENGTH   128

Definition at line 200 of file ltdl.c.

Referenced by lt_dlsym().

#define LT_SYMBOL_OVERHEAD   5

Definition at line 204 of file ltdl.c.

Referenced by lt_dlsym().

#define LT_USE_POSIX_DIRENT

Definition at line 86 of file ltdl.c.

#define LTDL_ARCHIVE_EXT   ".la"

Definition at line 191 of file ltdl.c.

#define LTDL_SEARCHPATH_VAR   "LTDL_LIBRARY_PATH"

Definition at line 187 of file ltdl.c.

Referenced by try_dlopen().

#define rpl_realloc   realloc

Definition at line 220 of file ltdl.c.

#define STR_DL_DEPLIBS   "dependency_libs="

Referenced by try_dlopen().

#define STR_DLNAME   "dlname="

Referenced by try_dlopen().

#define STR_LIBDIR   "libdir="

Referenced by try_dlopen().

#define STR_LIBRARY_NAMES   "library_names="

Referenced by try_dlopen().

#define STR_OLD_LIBRARY   "old_library="

Referenced by try_dlopen().

#define strdup   rpl_strdup

Definition at line 263 of file ltdl.c.

Referenced by llvm::ValID::copy(), lle_X___strdup(), lle_X_strdup(), lt_estrdup(), ParseCStringVector(), and llvm::cl::ParseEnvironmentOptions().


Typedef Documentation

LT_SCOPE int lt_dlloader_remove LT_PARAMS = (lt_ptr (*) LT_PARAMS((size_t))) malloc

Definition at line 2132 of file ltdl.c.


Function Documentation

static int argzize_path ( char *  path,
char **  pargz,
size_t *  pargz_len 
) const [static]

Definition at line 2618 of file ltdl.c.

References LT_DLMUTEX_SETERROR, LT_DLSTRERROR, and LT_PATHSEP_CHAR.

Referenced by foreach_dirinpath(), and lt_dlpath_insertdir().

static int canonicalize_path ( char *  path,
char **  pcanonical 
) const [static]

Definition at line 2555 of file ltdl.c.

References LT_EMALLOC, LT_EOS_CHAR, LT_PATHSEP_CHAR, and LT_STRLEN.

Referenced by foreach_dirinpath(), lt_dlpath_insertdir(), lt_dlsetsearchpath(), and try_dlopen().

static int file_not_found (  )  [static]

Definition at line 3429 of file ltdl.c.

References LT_DLMUTEX_GETERROR, and LT_DLSTRERROR.

Referenced by lt_dlopenext().

static FILE* find_file ( char *  search_path,
const char *  base_name,
char **  pdir 
) const [static]

Definition at line 2756 of file ltdl.c.

References find_file_callback(), and foreach_dirinpath().

Referenced by try_dlopen().

static int find_file_callback ( char *  filename,
lt_ptr  data1,
lt_ptr  data2 
) [static]

Definition at line 2727 of file ltdl.c.

References LT_DLFREE, LT_EOS_CHAR, lt_estrdup(), and LT_READTEXT_MODE.

Referenced by find_file().

static lt_dlhandle* find_handle ( char *  search_path,
const char *  base_name,
lt_dlhandle handle 
) const [static]

Definition at line 2792 of file ltdl.c.

References find_handle_callback(), and foreach_dirinpath().

Referenced by try_dlopen().

static int find_handle_callback ( char *  filename,
lt_ptr  data,
lt_ptr  ignored 
) [static]

Definition at line 2769 of file ltdl.c.

References tryall_dlopen().

Referenced by find_handle().

static int find_module ( lt_dlhandle handle,
const char *  dir,
const char *  libdir,
const char *  dlname,
const char *  old_name,
int  installed 
) [static]

Definition at line 2508 of file ltdl.c.

References tryall_dlopen(), and tryall_dlopen_module().

Referenced by try_dlopen().

static int foreach_dirinpath ( char *  search_path,
const char *  base_name,
foreach_callback_func *  func,
lt_ptr  data1,
lt_ptr  data2 
) const [static]

Definition at line 2652 of file ltdl.c.

References argzize_path(), canonicalize_path(), LT_DLFREE, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, LT_DLSTRERROR, LT_EMALLOC, and LT_STRLEN.

Referenced by find_file(), find_handle(), and lt_dlforeachfile().

static int foreachfile_callback ( char *  dirname,
lt_ptr  data1,
lt_ptr  data2 
) [static]

Definition at line 3686 of file ltdl.c.

References list_files_by_dir(), LT_DLFREE, and LT_PARAMS.

Referenced by lt_dlforeachfile().

static int free_vars ( char *  dlname,
char *  oldname,
char *  libdir,
char *  deplibs 
) [static]

Definition at line 3022 of file ltdl.c.

References LT_DLFREE.

Referenced by try_dlopen().

static int list_files_by_dir ( char *  dirnam,
char **  pargz,
size_t *  pargz_len 
) const [static]

Definition at line 3648 of file ltdl.c.

References lt_argz_insertdir(), and LT_STRLEN.

Referenced by foreachfile_callback().

static int load_deplibs ( lt_dlhandle  handle,
char *  deplibs 
) [static]

Definition at line 2808 of file ltdl.c.

References lt_dlhandle_struct::depcount, lt_dladdsearchdir(), LT_DLFREE, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, lt_dlopenext(), LT_EMALLOC, lt_estrdup(), LT_STRLEN, and user_search_path.

Referenced by try_dlopen().

static int lt_argz_insert ( char **  pargz,
size_t *  pargz_len,
char *  before,
const char *  entry 
) [static]

Definition at line 3532 of file ltdl.c.

References LT_DLMUTEX_SETERROR, and LT_DLSTRERROR.

Referenced by lt_argz_insertinorder(), and lt_dlpath_insertdir().

static int lt_argz_insertdir ( char **  pargz,
size_t *  pargz_len,
const char *  dirnam,
struct dirent *  dp 
) [static]

Definition at line 3582 of file ltdl.c.

References lt_argz_insertinorder(), LT_D_NAMLEN, LT_DLFREE, LT_EMALLOC, LT_EOS_CHAR, and LT_STRLEN.

Referenced by list_files_by_dir().

static int lt_argz_insertinorder ( char **  pargz,
size_t *  pargz_len,
const char *  entry 
) [static]

Definition at line 3558 of file ltdl.c.

References lt_argz_insert().

Referenced by lt_argz_insertdir().

int lt_dladderror ( char *  diagnostic  )  const

Definition at line 960 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, LT_EREALLOC, and LT_ERROR_MAX.

int lt_dladdsearchdir ( char *  search_dir  )  const

Definition at line 4014 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, lt_dlpath_insertdir(), and user_search_path.

Referenced by load_deplibs().

lt_ptr lt_dlcaller_get_data ( lt_dlcaller_id  key,
lt_dlhandle  handle 
)

Definition at line 4253 of file ltdl.c.

References lt_dlhandle_struct::caller_data, lt_caller_data::data, lt_caller_data::key, and LT_DLMUTEX_LOCK.

lt_dlcaller_id lt_dlcaller_register (  ) 

Definition at line 4185 of file ltdl.c.

References LT_DLMUTEX_LOCK, and LT_DLMUTEX_UNLOCK.

lt_ptr lt_dlcaller_set_data ( lt_dlcaller_id  key,
lt_dlhandle  handle,
lt_ptr  data 
)

Definition at line 4198 of file ltdl.c.

References lt_dlhandle_struct::caller_data, lt_caller_data::data, lt_caller_data::key, and LT_DLMUTEX_LOCK.

int lt_dlclose ( lt_dlhandle  handle  ) 

Definition at line 3769 of file ltdl.c.

References handles, lt_dlhandle_struct::loader, LT_DLFREE, LT_DLIS_RESIDENT, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, LT_DLSTRERROR, lt_dlloader::module_close, lt_dlhandle_struct::next, and unload_deplibs().

Referenced by lt_dlexit(), unload_deplibs(), and llvm::sys::DynamicLibrary::~DynamicLibrary().

const char* lt_dlerror (  ) 

Definition at line 3931 of file ltdl.c.

References LT_DLMUTEX_GETERROR, and LT_DLMUTEX_SETERROR.

Referenced by check_ltdl_initialization(), llvm::sys::DynamicLibrary::DynamicLibrary(), and llvm::sys::DynamicLibrary::LoadLibraryPermanently().

int lt_dlexit (  ) 

Definition at line 2288 of file ltdl.c.

References handles, loaders, lt_dlclose(), LT_DLIS_RESIDENT, LT_DLMEM_REASSIGN, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLSTRERROR, llvm::next(), and lt_dlhandle_struct::next.

int lt_dlforeach ( int *  func,
lt_ptr  data 
)

Definition at line 4157 of file ltdl.c.

References handles, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, and lt_dlhandle_struct::next.

int lt_dlforeachfile ( char *  search_path,
int *  func,
lt_ptr  data 
) const

Definition at line 3724 of file ltdl.c.

References foreach_dirinpath(), foreachfile_callback(), LTDL_SHLIBPATH_VAR, LTDL_SYSSEARCHPATH, and user_search_path.

const lt_dlinfo* lt_dlgetinfo ( lt_dlhandle  handle  ) 

Definition at line 4137 of file ltdl.c.

References LT_DLMUTEX_SETERROR, and LT_DLSTRERROR.

const char* lt_dlgetsearchpath (  ) 

Definition at line 4088 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, and user_search_path.

lt_dlhandle lt_dlhandle_next ( lt_dlhandle  place  ) 

Definition at line 4150 of file ltdl.c.

References handles, and lt_dlhandle_struct::next.

int lt_dlinit (  ) 

Definition at line 2202 of file ltdl.c.

References lt_user_dlloader::dlloader_data, handles, lt_dlloader_add(), lt_dlloader_next(), LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, LT_DLSTRERROR, presym, presym_init(), and sys_dl.

Referenced by check_ltdl_initialization().

int lt_dlinsertsearchdir ( char *  before,
const char *  search_dir 
) const

Definition at line 4031 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, lt_dlpath_insertdir(), LT_DLSTRERROR, LT_STRLEN, and user_search_path.

int lt_dlisresident ( lt_dlhandle  handle  ) 

Definition at line 4119 of file ltdl.c.

References LT_DLIS_RESIDENT, LT_DLMUTEX_SETERROR, and LT_DLSTRERROR.

int lt_dlloader_add ( lt_dlloader place,
const struct lt_user_dlloader dlloader,
const char *  loader_name 
)

Definition at line 4287 of file ltdl.c.

References lt_user_dlloader::dlloader_data, lt_dlloader::dlloader_data, lt_user_dlloader::dlloader_exit, lt_dlloader::dlloader_exit, lt_dlloader::find_sym, lt_user_dlloader::find_sym, lt_dlloader::loader_name, loaders, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLSTRERROR, LT_EMALLOC, lt_dlloader::module_close, lt_user_dlloader::module_close, lt_dlloader::module_open, lt_user_dlloader::module_open, lt_dlloader::next, lt_user_dlloader::sym_prefix, and lt_dlloader::sym_prefix.

Referenced by lt_dlinit().

lt_user_data* lt_dlloader_data ( lt_dlloader place  ) 

Definition at line 4462 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, and LT_DLSTRERROR.

lt_dlloader* lt_dlloader_find ( char *  loader_name  )  const

Definition at line 4482 of file ltdl.c.

References lt_dlloader::loader_name, loaders, LT_DLMUTEX_LOCK, and lt_dlloader::next.

Referenced by lt_dlloader_remove().

const char* lt_dlloader_name ( lt_dlloader place  ) 

Definition at line 4442 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, and LT_DLSTRERROR.

lt_dlloader* lt_dlloader_next ( lt_dlloader place  ) 

Definition at line 4429 of file ltdl.c.

References loaders, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, and llvm::next().

Referenced by lt_dlinit().

int lt_dlloader_remove ( char *  loader_name  )  const

Definition at line 4368 of file ltdl.c.

References handles, lt_dlhandle_struct::loader, lt_dlloader_find(), LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLSTRERROR, and lt_dlhandle_struct::next.

int lt_dlmakeresident ( lt_dlhandle  handle  ) 

Definition at line 4100 of file ltdl.c.

References LT_DLMUTEX_SETERROR, LT_DLRESIDENT_FLAG, LT_DLSET_FLAG, and LT_DLSTRERROR.

Referenced by llvm::sys::DynamicLibrary::LoadLibraryPermanently().

int lt_dlmutex_register ( lt_dlmutex_lock *  lock,
lt_dlmutex_unlock *  unlock,
lt_dlmutex_seterror *  seterror,
lt_dlmutex_geterror *  geterror 
)

Definition at line 915 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, and LT_DLSTRERROR.

lt_dlhandle lt_dlopen ( char *  filename  )  const

Definition at line 3413 of file ltdl.c.

References try_dlopen().

Referenced by llvm::sys::DynamicLibrary::DynamicLibrary(), llvm::sys::DynamicLibrary::LoadLibraryPermanently(), and lt_dlopenext().

lt_dlhandle lt_dlopenext ( char *  filename  )  const

Definition at line 3445 of file ltdl.c.

References file_not_found(), LT_DLFREE, LT_DLMUTEX_SETERROR, lt_dlopen(), LT_DLSTRERROR, LT_EMALLOC, LT_EOS_CHAR, LT_STRLEN, LTDL_SHLIB_EXT, and try_dlopen().

Referenced by llvm::sys::DynamicLibrary::DynamicLibrary(), load_deplibs(), and llvm::sys::DynamicLibrary::LoadLibraryPermanently().

static int lt_dlpath_insertdir ( char **  ppath,
char *  before,
const char *  dir 
) [static]

Definition at line 3942 of file ltdl.c.

References argzize_path(), canonicalize_path(), lt_argz_insert(), LT_DLFREE, LT_DLMEM_REASSIGN, lt_estrdup(), and LT_PATHSEP_CHAR.

Referenced by lt_dladdsearchdir(), and lt_dlinsertsearchdir().

int lt_dlpreload ( lt_dlsymlist preloaded  )  const

Definition at line 2253 of file ltdl.c.

References default_preloaded_symbols, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, presym_add_symlist(), and presym_free_symlists().

Referenced by presym_init().

int lt_dlpreload_default ( lt_dlsymlist preloaded  )  const

Definition at line 2278 of file ltdl.c.

References default_preloaded_symbols, LT_DLMUTEX_LOCK, and LT_DLMUTEX_UNLOCK.

int lt_dlseterror ( int  errindex  ) 

Definition at line 986 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, LT_DLSTRERROR, and LT_ERROR_MAX.

int lt_dlsetsearchpath ( char *  search_path  )  const

Definition at line 4065 of file ltdl.c.

References canonicalize_path(), LT_DLFREE, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, LT_STRLEN, and user_search_path.

lt_ptr lt_dlsym ( lt_dlhandle  handle,
const char *  symbol 
)

Definition at line 3837 of file ltdl.c.

References LT_DLFREE, LT_DLMUTEX_GETERROR, LT_DLMUTEX_SETERROR, LT_DLSTRERROR, LT_EMALLOC, LT_STRLEN, LT_SYMBOL_LENGTH, and LT_SYMBOL_OVERHEAD.

Referenced by llvm::sys::DynamicLibrary::GetAddressOfSymbol(), and llvm::sys::DynamicLibrary::SearchForAddressOfSymbol().

static lt_ptr lt_emalloc ( size_t  size  )  [static]

Definition at line 1016 of file ltdl.c.

References LT_DLMUTEX_SETERROR, and LT_DLSTRERROR.

static lt_ptr lt_erealloc ( lt_ptr  addr,
size_t  size 
) [static]

Definition at line 1026 of file ltdl.c.

References LT_DLMUTEX_SETERROR, and LT_DLSTRERROR.

static char* lt_estrdup ( char *  str  )  const [static]

Definition at line 1037 of file ltdl.c.

References LT_DLMUTEX_SETERROR, LT_DLSTRERROR, LT_STRLEN, and strdup.

Referenced by find_file_callback(), load_deplibs(), lt_dlpath_insertdir(), try_dlopen(), and tryall_dlopen().

static int file_not_found LT_PARAMS ( (void)   )  [static]

static int list_files_by_dir LT_PARAMS ( (const char *dirnam, char **pargz, size_t *pargz_len)   )  [static]

static int lt_dlpath_insertdir LT_PARAMS ( (char **ppath, char *before, const char *dir)   )  [static]

static int lt_argz_insertdir LT_PARAMS ( (char **pargz, size_t *pargz_len, const char *dirnam, struct dirent *dp)   )  [static]

static int lt_argz_insertinorder LT_PARAMS ( (char **pargz, size_t *pargz_len, const char *entry)   )  [static]

static int lt_argz_insert LT_PARAMS ( (char **pargz, size_t *pargz_len, char *before, const char *entry)   )  [static]

static int unload_deplibs LT_PARAMS ( (lt_dlhandle handle)   )  [static]

static int try_dlopen LT_PARAMS ( (lt_dlhandle *handle, const char *filename)   )  [static]

static int trim LT_PARAMS ( (char **dest, const char *str)   )  [static]

static int load_deplibs LT_PARAMS ( (lt_dlhandle handle, char *deplibs)   )  [static]

static int free_vars LT_PARAMS ( (char *dlname, char *oldname, char *libdir, char *deplibs)   )  [static]

static int find_module LT_PARAMS ( (lt_dlhandle *handle, const char *dir, const char *libdir, const char *dlname, const char *old_name, int installed)   )  [static]

static lt_dlhandle* find_handle LT_PARAMS ( (const char *search_path, const char *base_name, lt_dlhandle *handle)   )  [static]

static FILE* find_file LT_PARAMS ( (const char *search_path, const char *base_name, char **pdir)   )  [static]

static int argzize_path LT_PARAMS ( (const char *path, char **pargz, size_t *pargz_len)   )  [static]

static int canonicalize_path LT_PARAMS ( (const char *path, char **pcanonical)   )  [static]

static int foreachfile_callback LT_PARAMS ( (char *filename, lt_ptr data1, lt_ptr data2)   )  [static]

static int find_file_callback LT_PARAMS ( (char *filename, lt_ptr data, lt_ptr ignored)   )  [static]

static int foreach_dirinpath LT_PARAMS ( (const char *search_path, const char *base_name, foreach_callback_func *func, lt_ptr data1, lt_ptr data2)   )  [static]

LT_GLOBAL_DATA void lt_dlfree LT_PARAMS ( (lt_ptr ptr)   ) 

LT_GLOBAL_DATA lt_ptr lt_dlrealloc LT_PARAMS ( (lt_ptr ptr, size_t size  ) 

static lt_ptr lt_erealloc LT_PARAMS ( (lt_ptr addr, size_t size  )  [static]

static lt_ptr lt_emalloc LT_PARAMS ( (size_t size  )  [static]

static char* lt_estrdup LT_PARAMS ( (const char *str)   )  [static]

static int presym_add_symlist ( lt_dlsymlist preloaded  )  const [static]

Definition at line 1999 of file ltdl.c.

References LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, LT_EMALLOC, lt_dlsymlists_t::next, preloaded_symbols, and lt_dlsymlists_t::syms.

Referenced by lt_dlpreload().

static int presym_close ( lt_user_data  loader_data,
lt_module  module 
) [static]

Definition at line 2087 of file ltdl.c.

static int presym_exit ( lt_user_data  loader_data  )  [static]

Definition at line 1991 of file ltdl.c.

References presym_free_symlists().

static int presym_free_symlists (  )  [static]

Definition at line 1969 of file ltdl.c.

References LT_DLFREE, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, lt_dlsymlists_t::next, and preloaded_symbols.

Referenced by lt_dlpreload(), and presym_exit().

static int presym_init ( lt_user_data  loader_data  )  [static]

Definition at line 1950 of file ltdl.c.

References default_preloaded_symbols, LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK, lt_dlpreload(), and preloaded_symbols.

Referenced by lt_dlinit().

static lt_module presym_open ( lt_user_data  loader_data,
const char *  filename 
) [static]

Definition at line 2037 of file ltdl.c.

References lt_dlsymlist::address, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, LT_DLSTRERROR, lt_dlsymlist::name, lt_dlsymlists_t::next, preloaded_symbols, and lt_dlsymlists_t::syms.

static lt_ptr presym_sym ( lt_user_data  loader_data,
lt_module  module,
const char *  symbol 
) [static]

Definition at line 2097 of file ltdl.c.

References lt_dlsymlist::address, LT_DLMUTEX_SETERROR, LT_DLSTRERROR, lt_dlsymlist::name, and lt_dlsymlists_t::syms.

static char* strdup ( char *  str  )  const [static]

Definition at line 268 of file ltdl.c.

References LT_DLMALLOC.

static int sys_dl_close ( lt_user_data  loader_data,
lt_module  module 
) [static]

Definition at line 1121 of file ltdl.c.

References DLERROR, and LT_DLMUTEX_SETERROR.

static lt_module sys_dl_open ( lt_user_data  loader_data,
const char *  filename 
) [static]

Definition at line 1106 of file ltdl.c.

References DLERROR, LT_DLMUTEX_SETERROR, LT_GLOBAL, LT_LAZY_OR_NOW, and lt_dlhandle_struct::module.

static lt_ptr sys_dl_sym ( lt_user_data  loader_data,
lt_module  module,
const char *  symbol 
) [static]

Definition at line 1137 of file ltdl.c.

References DLERROR, and LT_DLMUTEX_SETERROR.

static int trim ( char **  dest,
const char *  str 
) [static]

Definition at line 2991 of file ltdl.c.

References LT_DLFREE, LT_EMALLOC, LT_EOS_CHAR, and LT_STRLEN.

Referenced by try_dlopen().

static int try_dlopen ( lt_dlhandle phandle,
const char *  filename 
) [static]

Definition at line 3037 of file ltdl.c.

References canonicalize_path(), find_file(), find_handle(), find_module(), free_vars(), handles, load_deplibs(), LT_DLFREE, LT_DLMEM_REASSIGN, LT_DLMUTEX_GETERROR, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, LT_DLREALLOC, LT_DLRESIDENT_FLAG, LT_DLSET_FLAG, LT_DLSTRERROR, LT_EMALLOC, LT_EOS_CHAR, lt_estrdup(), LT_FILENAME_MAX, LT_READTEXT_MODE, LT_STRLEN, LTDL_SEARCHPATH_VAR, LTDL_SHLIBPATH_VAR, LTDL_SYSSEARCHPATH, STR_DL_DEPLIBS, STR_DLNAME, STR_LIBDIR, STR_LIBRARY_NAMES, STR_OLD_LIBRARY, trim(), tryall_dlopen(), unload_deplibs(), and user_search_path.

Referenced by lt_dlopen(), and lt_dlopenext().

static int tryall_dlopen ( lt_dlhandle handle,
const char *  filename 
) [static]

Definition at line 2360 of file ltdl.c.

References lt_dlloader::dlloader_data, lt_dlinfo::filename, handles, lt_dlhandle_struct::info, lt_dlhandle_struct::loader, loaders, LT_DLFREE, LT_DLMUTEX_GETERROR, LT_DLMUTEX_LOCK, LT_DLMUTEX_SETERROR, LT_DLMUTEX_UNLOCK, lt_estrdup(), lt_dlhandle_struct::module, lt_dlloader::module_open, lt_dlloader::next, lt_dlhandle_struct::next, and lt_dlinfo::ref_count.

Referenced by find_handle_callback(), find_module(), try_dlopen(), and tryall_dlopen_module().

static int tryall_dlopen_module ( lt_dlhandle handle,
const char *  prefix,
const char *  dirname,
const char *  dlname 
) [static]

Definition at line 2457 of file ltdl.c.

References LT_DLFREE, LT_EMALLOC, LT_STRLEN, and tryall_dlopen().

Referenced by find_module().

static int unload_deplibs ( lt_dlhandle  handle  )  [static]

Definition at line 2970 of file ltdl.c.

References lt_dlclose(), and LT_DLIS_RESIDENT.

Referenced by lt_dlclose(), and try_dlopen().


Variable Documentation

const char archive_ext[] = LTDL_ARCHIVE_EXT [static]

Definition at line 867 of file ltdl.c.

const lt_dlsymlist* default_preloaded_symbols = 0 [static]

Definition at line 1946 of file ltdl.c.

Referenced by lt_dlpreload(), lt_dlpreload_default(), and presym_init().

int errorcount = LT_ERROR_MAX [static]

Definition at line 957 of file ltdl.c.

lt_dlhandle handles = 0 [static]

Definition at line 2197 of file ltdl.c.

Referenced by lt_dlclose(), lt_dlexit(), lt_dlforeach(), lt_dlhandle_next(), lt_dlinit(), lt_dlloader_remove(), try_dlopen(), and tryall_dlopen().

int initialized = 0 [static]

Definition at line 2198 of file ltdl.c.

lt_dlloader* loaders = 0 [static]

Definition at line 2196 of file ltdl.c.

Referenced by lt_dlexit(), lt_dlloader_add(), lt_dlloader_find(), lt_dlloader_next(), and tryall_dlopen().

const char* lt_dlerror_strings[] [static]

Initial value:

  {
#define LT_ERROR(name, diagnostic)  
    lt_dlerror_table


    0
  }

Definition at line 820 of file ltdl.c.

const char* lt_dllast_error = 0 [static]

Definition at line 907 of file ltdl.c.

lt_dlmutex_geterror* lt_dlmutex_geterror_func = 0 [static]

Definition at line 906 of file ltdl.c.

lt_dlmutex_lock* lt_dlmutex_lock_func = 0 [static]

Definition at line 903 of file ltdl.c.

lt_dlmutex_seterror* lt_dlmutex_seterror_func = 0 [static]

Definition at line 905 of file ltdl.c.

lt_dlmutex_unlock* lt_dlmutex_unlock_func = 0 [static]

Definition at line 904 of file ltdl.c.

const char objdir[] = LTDL_OBJDIR [static]

Definition at line 866 of file ltdl.c.

lt_dlsymlists_t* preloaded_symbols = 0 [static]

Definition at line 1947 of file ltdl.c.

Referenced by presym_add_symlist(), presym_free_symlists(), presym_init(), and presym_open().

struct lt_user_dlloader presym [static]

Initial value:

Definition at line 2120 of file ltdl.c.

Referenced by lt_dlinit().

const char shlib_ext[] = LTDL_SHLIB_EXT [static]

Definition at line 869 of file ltdl.c.

struct lt_user_dlloader sys_dl [static]

Initial value:

Definition at line 1152 of file ltdl.c.

Referenced by lt_dlinit().

const char sys_search_path[] = LTDL_SYSSEARCHPATH [static]

Definition at line 872 of file ltdl.c.

const char** user_error_strings = 0 [static]

Definition at line 956 of file ltdl.c.

char* user_search_path = 0 [static]

Definition at line 2195 of file ltdl.c.

Referenced by load_deplibs(), lt_dladdsearchdir(), lt_dlforeachfile(), lt_dlgetsearchpath(), lt_dlinsertsearchdir(), lt_dlsetsearchpath(), and try_dlopen().