This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[review v2] support: Fix support_set_small_thread_stack_size to build on Hurd
- From: "Florian Weimer (Code Review)" <gerrit at gnutoolchain-gerrit dot osci dot io>
- To: Florian Weimer <fweimer at redhat dot com>, Christian Brauner <christian dot brauner at ubuntu dot com>, libc-alpha at sourceware dot org
- Date: Wed, 13 Nov 2019 08:09:49 -0500
- Subject: [review v2] support: Fix support_set_small_thread_stack_size to build on Hurd
- Auto-submitted: auto-generated
- References: <gerrit.1573585503000.Ifacc888ef86731c2639721b0932ae59583bd6b3e@gnutoolchain-gerrit.osci.io>
- Reply-to: fweimer at redhat dot com, fweimer at redhat dot com, libc-alpha at sourceware dot org, christian dot brauner at ubuntu dot com
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
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
---
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: 2
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-Reviewer: Christian Brauner <christian.brauner@ubuntu.com>
Gerrit-MessageType: newpatchset