diff options
| author | Rich Felker <dalias@aerifal.cx> | 2013-06-29 12:46:46 -0400 | 
|---|---|---|
| committer | Rich Felker <dalias@aerifal.cx> | 2013-06-29 12:46:46 -0400 | 
| commit | 780cbbe63ad9e60ef30dbcb2d74271e899dae245 (patch) | |
| tree | 3bf8cf88f80325893848c6f460bdb4478c76b60d | |
| parent | 2b0af609ef3d90fe6433270f2e2f62fc77ec7441 (diff) | |
| download | musl-780cbbe63ad9e60ef30dbcb2d74271e899dae245.tar.gz | |
implement minimal dlinfo function
| -rw-r--r-- | include/dlfcn.h | 3 | ||||
| -rw-r--r-- | src/ldso/dlinfo.c | 8 | ||||
| -rw-r--r-- | src/ldso/dynlink.c | 12 | 
3 files changed, 23 insertions, 0 deletions
| diff --git a/include/dlfcn.h b/include/dlfcn.h index e2f57b53..db26194b 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -17,6 +17,8 @@ extern "C" {  #define RTLD_NEXT    ((void *)-1)  #define RTLD_DEFAULT ((void *)0) +#define RTLD_DI_LINKMAP 2 +  int    dlclose(void *);  char  *dlerror(void);  void  *dlopen(const char *, int); @@ -30,6 +32,7 @@ typedef struct {  	void *dli_saddr;  } Dl_info;  int dladdr(void *, Dl_info *); +int dlinfo(void *, int, void *);  #endif  #ifdef __cplusplus diff --git a/src/ldso/dlinfo.c b/src/ldso/dlinfo.c new file mode 100644 index 00000000..4748eaf8 --- /dev/null +++ b/src/ldso/dlinfo.c @@ -0,0 +1,8 @@ +#include <dlfcn.h> + +int __dlinfo(void *, int, void *); + +int dlinfo(void *dso, int req, void *res) +{ +	return __dlinfo(dso, req, res); +} diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index ac4b669f..7031d03a 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -1273,6 +1273,18 @@ int __dladdr (void *addr, Dl_info *info)  }  #endif +int __dlinfo(void *dso, int req, void *res) +{ +	if (invalid_dso_handle(dso)) return -1; +	if (req != RTLD_DI_LINKMAP) { +		snprintf(errbuf, sizeof errbuf, "Unsupported request %d", req); +		errflag = 1; +		return -1; +	} +	*(struct link_map **)res = dso; +	return 0; +} +  char *dlerror()  {  	if (!errflag) return 0; | 
