diff options
author | kib <kib@FreeBSD.org> | 2014-10-15 13:36:01 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-10-15 13:36:01 +0000 |
commit | 6dfd0e1c9321594b248d82cc055104cade3a5092 (patch) | |
tree | 164a84a5d8d2210ee3c1009fc3b3c08544731076 /lib/libthr/thread | |
parent | 3c28f63ca3fc9787507b4ddf3684c0bc9dd99b92 (diff) | |
download | FreeBSD-src-6dfd0e1c9321594b248d82cc055104cade3a5092.zip FreeBSD-src-6dfd0e1c9321594b248d82cc055104cade3a5092.tar.gz |
MFC r272069:
Switch the defaults to not split the RLIMIT_STACK-sized initial thread
stack into the stacks of the created threads. Add knob
LIBPTHREAD_SPLITSTACK_MAIN to restore the older behaviour.
Diffstat (limited to 'lib/libthr/thread')
-rw-r--r-- | lib/libthr/thread/thr_init.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 9bf0e29..6d6a532 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -445,7 +445,7 @@ init_private(void) struct rlimit rlim; size_t len; int mib[2]; - char *env; + char *env, *env_bigstack, *env_splitstack; _thr_umutex_init(&_mutex_static_lock); _thr_umutex_init(&_cond_static_lock); @@ -473,8 +473,9 @@ init_private(void) len = sizeof (_usrstack); if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) PANIC("Cannot get kern.usrstack from sysctl"); - env = getenv("LIBPTHREAD_BIGSTACK_MAIN"); - if (env != NULL) { + env_bigstack = getenv("LIBPTHREAD_BIGSTACK_MAIN"); + env_splitstack = getenv("LIBPTHREAD_SPLITSTACK_MAIN"); + if (env_bigstack != NULL || env_splitstack == NULL) { if (getrlimit(RLIMIT_STACK, &rlim) == -1) PANIC("Cannot get stack rlimit"); _thr_stack_initial = rlim.rlim_cur; |