aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lwan/fix-pthread-stack-min.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-02-01 01:01:20 +0100
committerJakub Jirutka <jakub@jirutka.cz>2018-02-01 01:01:58 +0100
commitc061c56629b5eabefc0b25f4882d698cc3ab7a03 (patch)
tree762bd78ddb42794aa773cd34c2d121edba277897 /testing/lwan/fix-pthread-stack-min.patch
parent7b00fdeabdd1d415841c0f3b2f09d1d1ac158c75 (diff)
downloadaports-c061c56629b5eabefc0b25f4882d698cc3ab7a03.tar.bz2
aports-c061c56629b5eabefc0b25f4882d698cc3ab7a03.tar.xz
testing/lwan: new aport
https://lwan.ws Experimental, scalable, high performance HTTP server
Diffstat (limited to 'testing/lwan/fix-pthread-stack-min.patch')
-rw-r--r--testing/lwan/fix-pthread-stack-min.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/testing/lwan/fix-pthread-stack-min.patch b/testing/lwan/fix-pthread-stack-min.patch
new file mode 100644
index 0000000000..e552ff9665
--- /dev/null
+++ b/testing/lwan/fix-pthread-stack-min.patch
@@ -0,0 +1,33 @@
+From 3721cbececa18b369eb80176cb8aebe4beb99f1c Mon Sep 17 00:00:00 2001
+From: Leandro Pereira <leandro@hardinfo.org>
+Date: Mon, 22 Jan 2018 20:09:54 -0800
+Subject: [PATCH] Pthread stack size should never be smaller than 16KiB
+
+Tis is a nasty hack to support Musl libc, which defines
+PTHREAD_STACK_MIN to 2048 bytes.
+
+A better approach might be asking pthread to give the
+actual stack size, and store this information somewhere
+that the coroutine library will have access to; maybe
+in the switcher struct.
+
+Patch-Source: https://github.com/lpereira/lwan/commit/3721cbececa18b369eb80176cb8aebe4beb99f1c,
+ https://github.com/lpereira/lwan/commit/c5f5222a7c39d50c25348037b3d26716fbd6888b
+
+diff --git a/src/lib/lwan-coro.c b/src/lib/lwan-coro.c
+index 30be461..b3dfa54 100644
+--- a/src/lib/lwan-coro.c
++++ b/src/lib/lwan-coro.c
+@@ -34,7 +34,11 @@
+ #include <valgrind/valgrind.h>
+ #endif
+
+-#define CORO_STACK_MIN ((3 * (PTHREAD_STACK_MIN)) / 2)
++#if PTHREAD_STACK_MIN <= 16384
++# undef PTHREAD_STACK_MIN
++# define PTHREAD_STACK_MIN 16384
++#endif
++#define CORO_STACK_MIN ((3 * (PTHREAD_STACK_MIN)) / 2)
+
+ static_assert(DEFAULT_BUFFER_SIZE < (CORO_STACK_MIN + PTHREAD_STACK_MIN),
+ "Request buffer fits inside coroutine stack");