Retry on EINVAL from pthread_attr_setstacksize()

Enforce that the stack size is > RED_ZONE + PTHREAD_STACK_MIN.  If the
call to pthread_attr_setstacksize() subsequently fails with EINVAL, it
means that the platform requires the stack size to be a multiple of the
page size.  In that case, round up to the nearest page and retry.

Fixes #11694.
This commit is contained in:
Ben Noordhuis 2014-01-28 13:21:31 +01:00
parent 464b2e2364
commit b02b5cdcf4
2 changed files with 45 additions and 6 deletions

View file

@ -24,7 +24,7 @@
//! detection is not guaranteed to continue in the future. Usage of this module
//! is discouraged unless absolutely necessary.
static RED_ZONE: uint = 20 * 1024;
pub static RED_ZONE: uint = 20 * 1024;
/// This function is invoked from rust's current __morestack function. Segmented
/// stacks are currently not enabled as segmented stacks, but rather one giant