[git commit ldso-future] ldso: use syscalls only in ld.so

Peter S. Mazinger ps.m at gmx.net
Wed Mar 30 11:53:36 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=77405c689e9c6a569ad934080181ff6c90035fff
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 ldso/include/dl-syscall.h |   29 +++++++++++++++++++++++++++--
 ldso/include/ldso.h       |    2 --
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index d68d8a8..6247f1f 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -8,11 +8,16 @@
 #ifndef _DL_SYSCALL_H
 #define _DL_SYSCALL_H
 
+#ifdef IS_IN_rtld
+
 #include <features.h>
 
 #include <sys/syscall.h>
 #include <sys/mman.h>	/* MAP_ANONYMOUS -- differs between platforms */
 
+#define _FCNTL_H
+#include <bits/fcntl.h>
+
 /* Pull in whatever this particular arch's kernel thinks the kernel version of
  * struct stat should look like.  It turns out that each arch has a different
  * opinion on the subject, and different kernel revs use different names... */
@@ -124,8 +129,6 @@ static __always_inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv,
 #endif
 
 #define MAP_FAILED ((void *) -1)
-#define _dl_mmap_check_error(X) (((void *)X) == MAP_FAILED)
-
 static __always_inline
 void *_dl_mmap(void *addr, unsigned long size, int prot,
                int flags, int fd, unsigned long offset)
@@ -160,4 +163,26 @@ void *_dl_mmap(void *addr, unsigned long size, int prot,
 #endif
 }
 
+#else /* IS_IN_rtld */
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#define _dl_exit _exit
+#define _dl_close close
+#define _dl_open open
+#define _dl_write write
+#define _dl_read read
+#define _dl_mprotect mprotect
+#define _dl_stat stat
+#define _dl_fstat fstat
+#define _dl_munmap munmap
+#define _dl_mmap mmap
+
+#endif /* IS_IN_rtld */
+
+#define _dl_mmap_check_error(X) (((void *)X) == MAP_FAILED)
+
 #endif /* _DL_SYSCALL_H */
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index 5dcf845..7063f96 100644
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -23,8 +23,6 @@
 #include <dl-defs.h>
 
 #ifndef __ARCH_HAS_NO_SHARED__
-#define _FCNTL_H
-#include <bits/fcntl.h>
 #include <dlfcn.h>
 
 #include <dl-string.h>
-- 
1.7.3.4



More information about the uClibc-cvs mailing list