about summary refs log tree commit diff
path: root/dlfcn/dlfcn.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-15 23:16:22 +0000
committerRoland McGrath <roland@gnu.org>2003-03-15 23:16:22 +0000
commit45e4762c2c7d04cd51213735c2b440c94cdcf28a (patch)
tree5b2c7f008ae7f0a787bf6798bbb7a8663bc7b0ed /dlfcn/dlfcn.h
parent124dcac84b992d26cfe992f9017f49e92c37add2 (diff)
downloadglibc-45e4762c2c7d04cd51213735c2b440c94cdcf28a.tar.gz
glibc-45e4762c2c7d04cd51213735c2b440c94cdcf28a.tar.xz
glibc-45e4762c2c7d04cd51213735c2b440c94cdcf28a.zip
* 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.
Diffstat (limited to 'dlfcn/dlfcn.h')
-rw-r--r--dlfcn/dlfcn.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h
index 6c8e4abcc4..9d8ee0d6d1 100644
--- a/dlfcn/dlfcn.h
+++ b/dlfcn/dlfcn.h
@@ -21,6 +21,8 @@
 #define	_DLFCN_H 1
 
 #include <features.h>
+#define __need_size_t
+#include <stddef.h>
 
 /* Collect various system dependent definitions and declarations.  */
 #include <bits/dlfcn.h>
@@ -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