public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Solution to my linuxthreads problem
@ 1999-12-20  9:34 Andreas Jaeger
  1999-12-20 23:32 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Jaeger @ 1999-12-20  9:34 UTC (permalink / raw)
  To: libc-hacker

Yesterday I reported a problem with the current glibc when using
headers from 2.3.33 on a Linux 2.2.13 system.  Together with Andreas
Schwab we've fixed this with the appended patch.  The problem is that
ugetrlimit doesn't exist and therefore errno is set - but errno is not
initialized yet.  The solution is to move the getrlimit call after
errno has been set.

Andreas

1999-12-20  Andreas Jaeger  <aj@suse.de>

	* pthread.c (pthread_initialize): Move getrlimit call after
	setting of errno.
	

===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/pthread.c,v
retrieving revision 1.17.2.6
diff -u -c -r1.17.2.6 pthread.c
cvs server: conflicting specifications of output style
*** pthread.c	1999/11/22 20:41:55	1.17.2.6
--- pthread.c	1999/12/20 17:28:28
***************
*** 289,303 ****
       STACK_SIZE boundary. */
    __pthread_initial_thread_bos =
      (char *)(((long)CURRENT_STACK_FRAME - 2 * STACK_SIZE) & ~(STACK_SIZE - 1));
-   /* Play with the stack size limit to make sure that no stack ever grows
-      beyond STACK_SIZE minus two pages (one page for the thread descriptor
-      immediately beyond, and one page to act as a guard page). */
-   getrlimit(RLIMIT_STACK, &limit);
-   max_stack = STACK_SIZE - 2 * __getpagesize();
-   if (limit.rlim_cur > max_stack) {
-     limit.rlim_cur = max_stack;
-     setrlimit(RLIMIT_STACK, &limit);
-   }
    /* Update the descriptor for the initial thread. */
    __pthread_initial_thread.p_pid = __getpid();
    /* If we have special thread_self processing, initialize that for the
--- 289,294 ----
***************
*** 308,313 ****
--- 299,314 ----
    /* The errno/h_errno variable of the main thread are the global ones.  */
    __pthread_initial_thread.p_errnop = &_errno;
    __pthread_initial_thread.p_h_errnop = &_h_errno;
+   /* Play with the stack size limit to make sure that no stack ever grows
+      beyond STACK_SIZE minus two pages (one page for the thread descriptor
+      immediately beyond, and one page to act as a guard page). */
+   /* errno must be set for system calls.  */
+   getrlimit(RLIMIT_STACK, &limit);
+   max_stack = STACK_SIZE - 2 * __getpagesize();
+   if (limit.rlim_cur > max_stack) {
+     limit.rlim_cur = max_stack;
+     setrlimit(RLIMIT_STACK, &limit);
+   }
  #ifdef __SIGRTMIN
    /* Initialize real-time signals. */
    init_rtsigs ();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Solution to my linuxthreads problem
  1999-12-20  9:34 Solution to my linuxthreads problem Andreas Jaeger
@ 1999-12-20 23:32 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 1999-12-20 23:32 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: libc-hacker

Andreas Jaeger <aj@suse.de> writes:

> Yesterday I reported a problem with the current glibc when using
> headers from 2.3.33 on a Linux 2.2.13 system.  Together with Andreas
> Schwab we've fixed this with the appended patch.  The problem is that
> ugetrlimit doesn't exist and therefore errno is set - but errno is not
> initialized yet.  The solution is to move the getrlimit call after
> errno has been set.

Thanks, I've applied the patch.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-12-20 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-20  9:34 Solution to my linuxthreads problem Andreas Jaeger
1999-12-20 23:32 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).