about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-28 21:58:14 +0000
committerRoland McGrath <roland@gnu.org>2002-09-28 21:58:14 +0000
commit3865b57f91a9bb5ffa252f38837f69944b47e85b (patch)
tree6d9d152517aa58249828b13fe52c774d3794ac41
parentec1434fc89b159fe506ce92b181b70df00bb2dee (diff)
downloadglibc-3865b57f91a9bb5ffa252f38837f69944b47e85b.tar.gz
glibc-3865b57f91a9bb5ffa252f38837f69944b47e85b.tar.xz
glibc-3865b57f91a9bb5ffa252f38837f69944b47e85b.zip
* pthread.c (__pthread_reset_main_thread) [FLOATING_STACKS]:
	Don't call setrlimit, since we did no prior bogon we need to undo.
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/pthread.c19
2 files changed, 18 insertions, 6 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index d9a653bc87..dc6cf2330a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-28  Roland McGrath  <roland@redhat.com>
+
+	* pthread.c (__pthread_reset_main_thread) [FLOATING_STACKS]:
+	Don't call setrlimit, since we did no prior bogon we need to undo.
+
 2002-09-27  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/x86_64/tls.h [__ASSEMBLER__]: Don't include <pt-machine.h>.
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 69f7634396..9281a414c9 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -1044,7 +1044,6 @@ static void pthread_handle_sigdebug(int sig)
 void __pthread_reset_main_thread(void)
 {
   pthread_descr self = thread_self();
-  struct rlimit limit;
 
   if (__pthread_manager_request != -1) {
     /* Free the thread manager stack */
@@ -1069,11 +1068,19 @@ void __pthread_reset_main_thread(void)
   THREAD_SETMEM(self, p_resp, &_res);
 #endif
 
-  if (getrlimit (RLIMIT_STACK, &limit) == 0
-      && limit.rlim_cur != limit.rlim_max) {
-    limit.rlim_cur = limit.rlim_max;
-    setrlimit(RLIMIT_STACK, &limit);
-  }
+#ifndef FLOATING_STACKS
+  /* This is to undo the setrlimit call in __pthread_init_max_stacksize.
+     XXX This can be wrong if the user set the limit during the run.  */
+ {
+   struct rlimit limit;
+   if (getrlimit (RLIMIT_STACK, &limit) == 0
+       && limit.rlim_cur != limit.rlim_max)
+     {
+       limit.rlim_cur = limit.rlim_max;
+       setrlimit(RLIMIT_STACK, &limit);
+     }
+ }
+#endif
 }
 
 /* Process-wide exec() request */