From 45e4762c2c7d04cd51213735c2b440c94cdcf28a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 15 Mar 2003 23:16:22 +0000 Subject: * dlfcn/tst-dlinfo.c: New file. * dlfcn/Makefile (tests): Add tst-dlinfo. ($(objpfx)tst-dlinfo): New target. * dlfcn/dlinfo.c: New file. * dlfcn/Makefile (libdl-routines): Add it. * dlfcn/Versions (libdl: GLIBC_2.3.3): Add dlinfo. * dlfcn/dlfcn.h [__USE_GNU]: Declare dlinfo. [__USE_GNU] (RTLD_DI_*): New enum constants. [__USE_GNU] (Dl_serpath, Dl_serinfo): New types. * elf/dl-load.c (cache_rpath): New inline function. (_dl_map_object): Use it. (_dl_rtld_di_serinfo): New function. * sysdeps/generic/ldsodefs.h: Declare it. * elf/Versions (ld: GLIBC_PRIVATE): Add it. --- dlfcn/dlfcn.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'dlfcn/dlfcn.h') diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h index 6c8e4ab..9d8ee0d 100644 --- a/dlfcn/dlfcn.h +++ b/dlfcn/dlfcn.h @@ -21,6 +21,8 @@ #define _DLFCN_H 1 #include +#define __need_size_t +#include /* Collect various system dependent definitions and declarations. */ #include @@ -100,7 +102,57 @@ enum RTLD_DL_LINKMAP = 2 }; -#endif + +/* Get information about the shared object HANDLE refers to. + REQUEST is from among the values below, and determines the use of ARG. + + On success, returns zero. On failure, returns -1 and records an error + message to be fetched with `dlerror'. */ +extern int dlinfo (void *__restrict __handle, + int __request, void *__restrict __arg); + +/* These are the possible values for the REQUEST argument to `dlinfo'. */ +enum + { + /* Treat ARG as `struct link_map **'; + store the `struct link_map *' for HANDLE there. */ + RTLD_DI_LINKMAP = 2, + + /* Treat ARG as `Dl_serinfo *' (see below), and fill in to describe the + directories that will be searched for dependencies of this object. + RTLD_DI_SERINFOSIZE fills in just the `dls_cnt' and `dls_size' + entries to indicate the size of the buffer that must be passed to + RTLD_DI_SERINFO to fill in the full information. */ + RTLD_DI_SERINFO = 4, + RTLD_DI_SERINFOSIZE = 5, + + /* Treat ARG as `char *', and store there the directory name used to + expand $ORIGIN in this shared object's dependency file names. */ + RTLD_DI_ORIGIN = 6, + + RTLD_DI_LMID = 1, /* Unsupported, defined by Solaris. */ + RTLD_DI_CONFIGADDR = 3 /* Unsupported, defined by Solaris. */ + }; + + +/* This is the type of elements in `Dl_serinfo', below. + The `dls_name' member points to space in the buffer passed to `dlinfo'. */ +typedef struct +{ + char *dls_name; /* Name of library search path directory. */ + unsigned int dls_flags; /* Indicates where this directory came from. */ +} Dl_serpath; + +/* This is the structure that must be passed (by reference) to `dlinfo' for + the RTLD_DI_SERINFO and RTLD_DI_SERINFOSIZE requests. */ +typedef struct +{ + size_t dls_size; /* Size in bytes of the whole buffer. */ + unsigned int dls_cnt; /* Number of elements in `dls_serpath'. */ + Dl_serpath dls_serpath[1]; /* Actually longer, dls_cnt elements. */ +} Dl_serinfo; +#endif /* __USE_GNU */ + __END_DECLS -- cgit v1.1