提交 780cbbe6 编写于 作者: R Rich Felker

implement minimal dlinfo function

上级 2b0af609
...@@ -17,6 +17,8 @@ extern "C" { ...@@ -17,6 +17,8 @@ extern "C" {
#define RTLD_NEXT ((void *)-1) #define RTLD_NEXT ((void *)-1)
#define RTLD_DEFAULT ((void *)0) #define RTLD_DEFAULT ((void *)0)
#define RTLD_DI_LINKMAP 2
int dlclose(void *); int dlclose(void *);
char *dlerror(void); char *dlerror(void);
void *dlopen(const char *, int); void *dlopen(const char *, int);
...@@ -30,6 +32,7 @@ typedef struct { ...@@ -30,6 +32,7 @@ typedef struct {
void *dli_saddr; void *dli_saddr;
} Dl_info; } Dl_info;
int dladdr(void *, Dl_info *); int dladdr(void *, Dl_info *);
int dlinfo(void *, int, void *);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
#include <dlfcn.h>
int __dlinfo(void *, int, void *);
int dlinfo(void *dso, int req, void *res)
{
return __dlinfo(dso, req, res);
}
...@@ -1273,6 +1273,18 @@ int __dladdr (void *addr, Dl_info *info) ...@@ -1273,6 +1273,18 @@ int __dladdr (void *addr, Dl_info *info)
} }
#endif #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() char *dlerror()
{ {
if (!errflag) return 0; if (!errflag) return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册