diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-12-22 22:43:39 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-12-22 22:43:39 -0500 |
commit | 2c1094bd700e63a8d7f547b3f5495bedb55c0a08 (patch) | |
tree | bf579617e656820ae621652a6fa5219cdfc897d3 /nptl | |
parent | 3b8dfc621bfd320c924a3cd597086d3473da1cf4 (diff) | |
download | glibc-2c1094bd700e63a8d7f547b3f5495bedb55c0a08.zip glibc-2c1094bd700e63a8d7f547b3f5495bedb55c0a08.tar.gz glibc-2c1094bd700e63a8d7f547b3f5495bedb55c0a08.tar.bz2 |
Create internal threads with sufficient stack size
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 11 | ||||
-rw-r--r-- | nptl/Versions | 2 | ||||
-rw-r--r-- | nptl/nptl-init.c | 12 | ||||
-rw-r--r-- | nptl/pthreadP.h | 1 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/timer_routines.c | 4 |
5 files changed, 26 insertions, 4 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 31177bf..3d697da 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,14 @@ +2011-12-22 Ulrich Drepper <drepper@gmail.com> + + [BZ #13088] + * sysdeps/unix/sysv/linux/timer_routines.c: Get minimum stack size + through __pthread_get_minstack. + * nptl-init.c (__pthread_initialize_minimal_internal): Get page size + directly from _rtld_global_ro. + (__pthread_get_minstack): New function. + * pthreadP.h: Declare __pthread_get_minstack. + * Versions (libpthread) [GLIBC_PRIVATE]: Add __pthread_get_minstack. + 2011-12-21 Ulrich Drepper <drepper@gmail.com> [BZ #13515] diff --git a/nptl/Versions b/nptl/Versions index 5a88420..6a10375 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -255,6 +255,6 @@ libpthread { GLIBC_PRIVATE { __pthread_initialize_minimal; __pthread_clock_gettime; __pthread_clock_settime; - __pthread_unwind; + __pthread_unwind; __pthread_get_minstack; } } diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index db45cab..4349224 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -427,7 +427,7 @@ __pthread_initialize_minimal_internal (void) /* Make sure it meets the minimum size that allocate_stack (allocatestack.c) will demand, which depends on the page size. */ - const uintptr_t pagesz = __sysconf (_SC_PAGESIZE); + const uintptr_t pagesz = GLRO(dl_pagesize); const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK; if (limit.rlim_cur < minstack) limit.rlim_cur = minstack; @@ -469,3 +469,13 @@ __pthread_initialize_minimal_internal (void) } strong_alias (__pthread_initialize_minimal_internal, __pthread_initialize_minimal) + + +size_t +__pthread_get_minstack (const pthread_attr_t *attr) +{ + struct pthread_attr *iattr = (struct pthread_attr *) attr; + + return (GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN + + iattr->guardsize); +} diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index df4f4d7..845434e 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -397,6 +397,7 @@ weak_function; extern void __pthread_init_static_tls (struct link_map *) attribute_hidden; +extern size_t __pthread_get_minstack (const pthread_attr_t *attr); /* Namespace save aliases. */ extern int __pthread_getschedparam (pthread_t thread_id, int *policy, diff --git a/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/nptl/sysdeps/unix/sysv/linux/timer_routines.c index b159316..44da856 100644 --- a/nptl/sysdeps/unix/sysv/linux/timer_routines.c +++ b/nptl/sysdeps/unix/sysv/linux/timer_routines.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2003-2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -165,7 +165,7 @@ __start_helper_thread (void) and should go away automatically when canceled. */ pthread_attr_t attr; (void) pthread_attr_init (&attr); - (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); + (void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr)); /* Block all signals in the helper thread but SIGSETXID. To do this thoroughly we temporarily have to block all signals here. The |