summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads.old
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-18 07:03:24 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-18 07:03:24 +0000
commit010301e968b4aa9a37dfd437f89c054016b2de0f (patch)
treebf1116a74701db706ca4d4bedb48c4bd04c33dfd /libpthread/linuxthreads.old
parentaa5490a851eed8100e9959f35bb1a20fc0353dba (diff)
tweak the idea between having a MMU and actually using it
Diffstat (limited to 'libpthread/linuxthreads.old')
-rw-r--r--libpthread/linuxthreads.old/internals.h10
-rw-r--r--libpthread/linuxthreads.old/manager.c14
-rw-r--r--libpthread/linuxthreads.old/ptfork.c2
-rw-r--r--libpthread/linuxthreads.old/pthread.c10
4 files changed, 18 insertions, 18 deletions
diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h
index 1c4856bc9..17b724e64 100644
--- a/libpthread/linuxthreads.old/internals.h
+++ b/libpthread/linuxthreads.old/internals.h
@@ -258,7 +258,7 @@ extern pthread_descr __pthread_main_thread;
* the bounds a-priori. -StS */
extern char *__pthread_initial_thread_bos;
-#ifndef __ARCH_HAS_MMU__
+#ifndef __ARCH_USE_MMU__
extern char *__pthread_initial_thread_tos;
#define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) \
if ((tos)>=__pthread_initial_thread_bos \
@@ -266,7 +266,7 @@ extern char *__pthread_initial_thread_tos;
__pthread_initial_thread_bos = (tos)+1
#else
#define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) /* empty */
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
/* Indicate whether at least one thread has a user-defined stack (if 1),
@@ -330,7 +330,7 @@ extern size_t __pagesize;
THREAD_SELF implementation is used, this must be a power of two and
a multiple of PAGE_SIZE. */
#ifndef STACK_SIZE
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
#define STACK_SIZE (2 * 1024 * 1024)
#else
#define STACK_SIZE (4 * __pagesize)
@@ -387,7 +387,7 @@ static inline pthread_descr thread_self (void)
return THREAD_SELF;
#else
char *sp = CURRENT_STACK_FRAME;
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
if (sp >= __pthread_initial_thread_bos)
return &__pthread_initial_thread;
else if (sp >= __pthread_manager_thread_bos
@@ -420,7 +420,7 @@ static inline pthread_descr thread_self (void)
else {
return __pthread_find_self();
}
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
#endif
}
diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
index 637a578d5..df26344e7 100644
--- a/libpthread/linuxthreads.old/manager.c
+++ b/libpthread/linuxthreads.old/manager.c
@@ -360,7 +360,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
}
else
{
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
stacksize = STACK_SIZE - pagesize;
if (attr != NULL)
stacksize = MIN (stacksize, roundup(attr->__stacksize, pagesize));
@@ -450,7 +450,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
/* on non-MMU systems we always have non-standard stack frames */
__pthread_nonstandard_stacks = 1;
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
}
/* Clear the thread data structure. */
@@ -495,7 +495,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
&new_thread, &new_thread_bottom,
&guardaddr, &guardsize) == 0)
break;
-#ifndef __ARCH_HAS_MMU__
+#ifndef __ARCH_USE_MMU__
else
/* When there is MMU, mmap () is used to allocate the stack. If one
* segment is already mapped, we should continue to see if we can
@@ -632,14 +632,14 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
/* Free the stack if we allocated it */
if (attr == NULL || !attr->__stackaddr_set)
{
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
if (new_thread->p_guardsize != 0)
munmap(new_thread->p_guardaddr, new_thread->p_guardsize);
munmap((caddr_t)((char *)(new_thread+1) - INITIAL_STACK_SIZE),
INITIAL_STACK_SIZE);
#else
free(new_thread_bottom);
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
}
__pthread_handles[sseg].h_descr = NULL;
__pthread_handles[sseg].h_bottom = NULL;
@@ -716,7 +716,7 @@ static void pthread_free(pthread_descr th)
/* If initial thread, nothing to free */
if (th == &__pthread_initial_thread) return;
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
if (!th->p_userstack)
{
/* Free the stack and thread descriptor area */
@@ -729,7 +729,7 @@ static void pthread_free(pthread_descr th)
if (!th->p_userstack) {
free(h_bottom_save);
}
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
}
/* Handle threads that have exited */
diff --git a/libpthread/linuxthreads.old/ptfork.c b/libpthread/linuxthreads.old/ptfork.c
index 2ecab8884..184508a3d 100644
--- a/libpthread/linuxthreads.old/ptfork.c
+++ b/libpthread/linuxthreads.old/ptfork.c
@@ -18,7 +18,7 @@
#include <errno.h>
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
#include <stddef.h>
#include <stdlib.h>
diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c
index f66073efc..4adf66cd6 100644
--- a/libpthread/linuxthreads.old/pthread.c
+++ b/libpthread/linuxthreads.old/pthread.c
@@ -172,9 +172,9 @@ char *__pthread_initial_thread_bos = NULL;
* This is adapted when other stacks are malloc'ed since we don't know
* the bounds a-priori. -StS */
-#ifndef __ARCH_HAS_MMU__
+#ifndef __ARCH_USE_MMU__
char *__pthread_initial_thread_tos = NULL;
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
/* File descriptor for sending requests to the thread manager. */
/* Initially -1, meaning that the thread manager is not running. */
@@ -363,7 +363,7 @@ static void pthread_initialize(void)
{
struct sigaction sa;
sigset_t mask;
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
struct rlimit limit;
rlim_t max_stack;
#endif
@@ -410,7 +410,7 @@ static void pthread_initialize(void)
beyond STACK_SIZE minus two pages (one page for the thread descriptor
immediately beyond, and one page to act as a guard page). */
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
/* We cannot allocate a huge chunk of memory to mmap all thread stacks later
* on a non-MMU system. Thus, we don't need the rlimit either. -StS */
getrlimit(RLIMIT_STACK, &limit);
@@ -429,7 +429,7 @@ static void pthread_initialize(void)
__pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */
PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n",
__pthread_initial_thread_bos, __pthread_initial_thread_tos);
-#endif /* __ARCH_HAS_MMU__ */
+#endif /* __ARCH_USE_MMU__ */
/* Setup signal handlers for the initial thread.
Since signal handlers are shared between threads, these settings