From 0f5eafa1d58eca5719eee78fd28ba15387e1ca24 Mon Sep 17 00:00:00 2001 From: drahn <> Date: Wed, 11 Aug 2004 19:14:56 +0000 Subject: [PATCH] add dladdr() support and add some 'standard' dlsym() support. ok millert miod pval, grumble deraadt --- src/include/dlfcn.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/include/dlfcn.h b/src/include/dlfcn.h index 41da0bbd..3a87daee 100644 --- a/src/include/dlfcn.h +++ b/src/include/dlfcn.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.h,v 1.8 2003/09/02 15:14:54 drahn Exp $ */ +/* $OpenBSD: dlfcn.h,v 1.9 2004/08/11 19:14:56 drahn Exp $ */ /* $NetBSD: dlfcn.h,v 1.2 1995/06/05 19:38:00 pk Exp $ */ /* @@ -36,6 +36,16 @@ #include +/* + * Structure filled in by dladdr(). + */ +typedef struct dl_info { + const char *dli_fname; /* Pathname of shared object. */ + void *dli_fbase; /* Base address of shared object. */ + const char *dli_sname; /* Name of nearest symbol. */ + void *dli_saddr; /* Address of nearest symbol. */ +} Dl_info; + /* * User interface to the run-time linker. */ @@ -45,6 +55,7 @@ extern int dlclose(void *); extern void *dlsym(void *, const char *); extern int dlctl(void *, int, void *); extern const char *dlerror(void); +extern int dladdr(const void *, Dl_info *); __END_DECLS /* Values for dlopen `mode'. */ @@ -54,6 +65,13 @@ __END_DECLS #define RTLD_LOCAL 0x000 #define DL_LAZY RTLD_LAZY /* Compat */ +/* + * Special handle arguments for dlsym(). + */ +#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */ +#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */ +#define RTLD_SELF ((void *) -3) /* Search the caller itself. */ + /* * dlctl() commands */