summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libdl/dlopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/libdl/dlopen.c')
-rw-r--r--mdk-stage1/dietlibc/libdl/dlopen.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mdk-stage1/dietlibc/libdl/dlopen.c b/mdk-stage1/dietlibc/libdl/dlopen.c
new file mode 100644
index 000000000..1693d889f
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/dlopen.c
@@ -0,0 +1,21 @@
+#include <fcntl.h>
+#include <dlfcn.h>
+#include <limits.h>
+
+int _dl_search(char*buf, int bufsize, const char*filename);
+void *_dl_open(const char*pathname, int fd, int flag);
+
+void *dlopen (const char *filename, int flag)
+{
+ int fd;
+ char buf[PATH_MAX];
+ const char *p;
+ if (*filename=='/')
+ fd=open(p=filename,O_RDONLY);
+ else {
+ p=buf;
+ fd=_dl_search(buf,sizeof(buf),filename);
+ }
+
+ return _dl_open(p,fd,flag);
+}