public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] support: Fix support_set_small_thread_stack_size to build on Hurd
@ 2019-11-13 13:10 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2019-11-13 13:10 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=02132c0f4c78f77d4a8cdbdea8f02956347e29ab

commit 02132c0f4c78f77d4a8cdbdea8f02956347e29ab
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Nov 12 20:04:36 2019 +0100

    support: Fix support_set_small_thread_stack_size to build on Hurd
    
    PTHREAD_STACK_MIN comes from <limits.h>, so include it explicitly.
    However, it is not defined on Hurd, so compensate for that as well.
    
    Built on x86_64-linux-gnu, i686-linux-gnu, i686-gnu.
    
    Change-Id: Ifacc888ef86731c2639721b0932ae59583bd6b3e
    Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>

Diff:
---
 support/support_set_small_thread_stack_size.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/support/support_set_small_thread_stack_size.c b/support/support_set_small_thread_stack_size.c
index 23189fd..32954ec 100644
--- a/support/support_set_small_thread_stack_size.c
+++ b/support/support_set_small_thread_stack_size.c
@@ -16,9 +16,9 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <limits.h>
 #include <pthread.h>
 #include <support/xthread.h>
-#include <sys/param.h>
 
 void
 support_set_small_thread_stack_size (pthread_attr_t *attr)
@@ -26,5 +26,10 @@ support_set_small_thread_stack_size (pthread_attr_t *attr)
   /* Some architectures have too small values for PTHREAD_STACK_MIN
      which cannot be used for creating threads.  Ensure that the stack
      size is at least 256 KiB.  */
-  xpthread_attr_setstacksize (attr, MAX (256 * 1024, PTHREAD_STACK_MIN));
+  size_t stack_size = 256 * 1024;
+#ifdef PTHREAD_STACK_MIN
+  if (stack_size < PTHREAD_STACK_MIN)
+    stack_size = PTHREAD_STACK_MIN;
+#endif
+  xpthread_attr_setstacksize (attr, stack_size);
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-13 13:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 13:10 [glibc] support: Fix support_set_small_thread_stack_size to build on Hurd Florian Weimer

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).