summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-08-16 19:21:45 +0000
committerEric Andersen <andersen@codepoet.org>2004-08-16 19:21:45 +0000
commita4541d42ff420e9e9ece6aaa1d70c29162d869c8 (patch)
treee5d9fb7f2da96a590d5ba6649551ba41329ce472
parentaa1a5f5c1a6cf2ff1d8cf9611133c5872165c47e (diff)
The variable used to store pagesize is not the same as the
_dl_pagesize variable in ldso, so avoid aliasing. -Erik
-rw-r--r--libc/misc/internals/__uClibc_main.c8
-rw-r--r--libc/stdlib/malloc/malloc.h3
-rw-r--r--libc/sysdeps/linux/common/getpagesize.c6
-rw-r--r--libpthread/linuxthreads/internals.h8
4 files changed, 12 insertions, 13 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 6b5463f58..68fd460a1 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -48,9 +48,7 @@ extern void weak_function __pthread_initialize_minimal(void);
*/
extern int _dl_secure;
-extern size_t _dl_pagesize;
-size_t __dl_pagesize = 0;
-weak_alias(__dl_pagesize, _dl_pagesize);
+size_t __pagesize = 0;
char **__environ = 0;
const char *__progname = 0;
@@ -140,9 +138,9 @@ __uClibc_start_main(int argc, char **argv, char **envp,
}
aux_dat += 2;
}
- _dl_pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
+ __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
#else
- _dl_pagesize = PAGE_SIZE;
+ __pagesize = PAGE_SIZE;
#endif
/* If we are dynamically linked the shared lib loader already
diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h
index ef95994a6..08ebfdf5b 100644
--- a/libc/stdlib/malloc/malloc.h
+++ b/libc/stdlib/malloc/malloc.h
@@ -15,7 +15,8 @@
#define MALLOC_ALIGNMENT (sizeof (double))
/* The system pagesize... */
-#define MALLOC_PAGE_SIZE _dl_pagesize
+extern size_t __pagesize;
+#define MALLOC_PAGE_SIZE __pagesize
/* The minimum size of block we request from the the system to extend the
heap for small allocations (we may request a bigger block if necessary to
diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c
index 72da95bbc..0844d5b79 100644
--- a/libc/sysdeps/linux/common/getpagesize.c
+++ b/libc/sysdeps/linux/common/getpagesize.c
@@ -19,13 +19,13 @@
#include <unistd.h>
#include <features.h>
#include <sys/param.h>
-extern size_t _dl_pagesize;
+extern size_t __pagesize;
/* Return the system page size. */
int __getpagesize(void)
{
- if (_dl_pagesize != 0)
- return _dl_pagesize;
+ if (__pagesize != 0)
+ return __pagesize;
#ifdef EXEC_PAGESIZE
return EXEC_PAGESIZE;
diff --git a/libpthread/linuxthreads/internals.h b/libpthread/linuxthreads/internals.h
index b82a0365a..623a0e891 100644
--- a/libpthread/linuxthreads/internals.h
+++ b/libpthread/linuxthreads/internals.h
@@ -316,7 +316,7 @@ static inline int invalid_handle(pthread_handle h, pthread_t id)
/* The page size we can get from the system. This should likely not be
changed by the machine file but, you never know. */
-extern size_t _dl_pagesize;
+extern size_t __pagesize;
#include <bits/uClibc_page.h>
#ifndef PAGE_SIZE
#define PAGE_SIZE (sysconf (_SC_PAGESIZE))
@@ -329,19 +329,19 @@ extern size_t _dl_pagesize;
#ifdef __ARCH_HAS_MMU__
#define STACK_SIZE (2 * 1024 * 1024)
#else
-#define STACK_SIZE (4 * _dl_pagesize)
+#define STACK_SIZE (4 * __pagesize)
#endif
#endif
/* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */
#ifndef INITIAL_STACK_SIZE
-#define INITIAL_STACK_SIZE (4 * _dl_pagesize)
+#define INITIAL_STACK_SIZE (4 * __pagesize)
#endif
/* Size of the thread manager stack. The "- 32" avoids wasting space
with some malloc() implementations. */
#ifndef THREAD_MANAGER_STACK_SIZE
-#define THREAD_MANAGER_STACK_SIZE (2 * _dl_pagesize - 32)
+#define THREAD_MANAGER_STACK_SIZE (2 * __pagesize - 32)
#endif
/* The base of the "array" of thread stacks. The array will grow down from