Back to index

glibc  2.9
Classes | Functions
dlinfo.c File Reference
#include <dlfcn.h>
#include <link.h>
#include <ldsodefs.h>
#include <libintl.h>
#include <dl-tls.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dlinfo_args

Functions

static void dlinfo_doit (void *argsblock)
int __dlinfo (void *handle, int request, void *arg DL_CALLER_DECL)

Class Documentation

struct dlinfo_args

Definition at line 37 of file dlinfo.c.


Function Documentation

int __dlinfo ( void *  handle,
int  request,
void *arg  DL_CALLER_DECL 
)

Definition at line 112 of file dlinfo.c.

{
# ifdef SHARED
  if (__builtin_expect (_dlfcn_hook != NULL, 0))
    return _dlfcn_hook->dlinfo (handle, request, arg,
                            DL_CALLER);
# endif

  struct dlinfo_args args = { (ElfW(Addr)) DL_CALLER,
                           handle, request, arg };
  return _dlerror_run (&dlinfo_doit, &args) ? -1 : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlinfo_doit ( void *  argsblock) [static]

Definition at line 46 of file dlinfo.c.

{
  struct dlinfo_args *const args = argsblock;
  struct link_map *l = args->handle;

# if 0
  if (args->handle == RTLD_SELF)
    {
      Lmid_t nsid;

      /* Find the highest-addressed object that CALLER is not below.  */
      for (nsid = 0; nsid < DL_NNS; ++nsid)
       for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
         if (caller >= l->l_map_start && caller < l->l_map_end
             && (l->l_contiguous || _dl_addr_inside_object (l, caller)))
           break;

      if (l == NULL)
       GLRO(dl_signal_error) (0, NULL, NULL, N_("\
RTLD_SELF used in code not dynamically loaded"));
    }
# endif

  switch (args->request)
    {
    case RTLD_DI_CONFIGADDR:
    default:
      GLRO(dl_signal_error) (0, NULL, NULL, N_("unsupported dlinfo request"));
      break;

    case RTLD_DI_LMID:
      *(Lmid_t *) args->arg = l->l_ns;
      break;

    case RTLD_DI_LINKMAP:
      *(struct link_map **) args->arg = l;
      break;

    case RTLD_DI_SERINFO:
      _dl_rtld_di_serinfo (l, args->arg, false);
      break;
    case RTLD_DI_SERINFOSIZE:
      _dl_rtld_di_serinfo (l, args->arg, true);
      break;

    case RTLD_DI_ORIGIN:
      strcpy (args->arg, l->l_origin);
      break;

    case RTLD_DI_TLS_MODID:
      *(size_t *) args->arg = 0;
      *(size_t *) args->arg = l->l_tls_modid;
      break;

    case RTLD_DI_TLS_DATA:
      {
       void *data = NULL;
       if (l->l_tls_modid != 0)
         data = GLRO(dl_tls_get_addr_soft) (l);
       *(void **) args->arg = data;
       break;
      }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: