Back to index

glibc  2.9
Classes | Functions
dlmopen.c File Reference
#include <dlfcn.h>
#include <errno.h>
#include <libintl.h>
#include <stddef.h>
#include <unistd.h>
#include <ldsodefs.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  dlmopen_args


static void dlmopen_doit (void *a)
void * __dlmopen (Lmid_t nsid, const char *file, int mode DL_CALLER_DECL)

Class Documentation

struct dlmopen_args

Definition at line 38 of file dlmopen.c.

Collaboration diagram for dlmopen_args:
Class Members
const void * caller
const char * file
const char * fname
struct link_map * map
int mode
void * new
Lmid_t nsid

Function Documentation

void* __dlmopen ( Lmid_t  nsid,
const char *  file,
int mode  DL_CALLER_DECL 

Definition at line 80 of file dlmopen.c.

# ifdef SHARED
  if (__builtin_expect (_dlfcn_hook != NULL, 0))
    return _dlfcn_hook->dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
# endif

  struct dlmopen_args args;
  args.nsid = nsid;
  args.file = file;
  args.mode = mode;
  args.caller = DL_CALLER;

# ifdef SHARED
  return _dlerror_run (dlmopen_doit, &args) ? NULL :;
# else
  if (_dlerror_run (dlmopen_doit, &args))
    return NULL;

  __libc_register_dl_open_hook ((struct link_map *);
  __libc_register_dlfcn_hook ((struct link_map *);

# endif

Here is the call graph for this function:

static void dlmopen_doit ( void *  a) [static]

Definition at line 52 of file dlmopen.c.

  struct dlmopen_args *args = (struct dlmopen_args *) a;

  /* Non-shared code has no support for multiple namespaces.  */
  if (args->nsid != LM_ID_BASE)
# ifdef SHARED
      /* If trying to open the link map for the main executable the namespace
        must be the main one.  */
      if (args->file == NULL)
# endif
       GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid namespace"));

      /* It makes no sense to use RTLD_GLOBAL when loading a DSO into
        a namespace other than the base namespace.  */
      if (__builtin_expect (args->mode & RTLD_GLOBAL, 0))
       GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid mode"));

  args->new = GLRO(dl_open) (args->file ?: "", args->mode | __RTLD_DLOPEN,
                          args->nsid, __dlfcn_argc, __dlfcn_argv,

Here is the caller graph for this function: