unix: guard use of PTHREAD_STACK_MIN

PTHREAD_STACK_MIN is an optional part of the POSIX spec and
NetBSD deliberately does not implement it as it's a variable
value in runtime.

PR-URL: https://github.com/libuv/libuv/pull/2252
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Kamil Rytarowski 2019-04-11 00:19:22 +02:00 committed by cjihrig
parent 89a027d862
commit 38bb0f5f5f
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -219,8 +219,10 @@ int uv_thread_create_ex(uv_thread_t* tid,
pagesize = (size_t)getpagesize();
/* Round up to the nearest page boundary. */
stack_size = (stack_size + pagesize - 1) &~ (pagesize - 1);
#ifdef PTHREAD_STACK_MIN
if (stack_size < PTHREAD_STACK_MIN)
stack_size = PTHREAD_STACK_MIN;
#endif
}
if (stack_size > 0) {