unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [review] support: Fix support_set_small_thread_stack_size to build on Hurd
@ 2019-11-12 19:05 Florian Weimer (Code Review)
  2019-11-13 13:08 ` Christian Brauner (Code Review)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Florian Weimer (Code Review) @ 2019-11-12 19:05 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/620
......................................................................

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
---
M support/support_set_small_thread_stack_size.c
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 @@
   /* 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);
 }

-- 
Gerrit-Project: glibc
Gerrit-Branch: master
Gerrit-Change-Id: Ifacc888ef86731c2639721b0932ae59583bd6b3e
Gerrit-Change-Number: 620
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-MessageType: newchange

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

end of thread, other threads:[~2019-11-13 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 19:05 [review] support: Fix support_set_small_thread_stack_size to build on Hurd Florian Weimer (Code Review)
2019-11-13 13:08 ` Christian Brauner (Code Review)
2019-11-13 13:09 ` [review v2] " Florian Weimer (Code Review)
2019-11-13 13:11 ` Christian Brauner (Code Review)
2019-11-13 13:20 ` [pushed] " Sourceware to Gerrit sync (Code Review)

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