From 5d98a7dae955bafa6740c26eaba9c86060ae0344 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 21 Jun 2021 12:42:56 -0700 Subject: Define PTHREAD_STACK_MIN to sysconf(_SC_THREAD_STACK_MIN) The constant PTHREAD_STACK_MIN may be too small for some processors. Rename _SC_SIGSTKSZ_SOURCE to _DYNAMIC_STACK_SIZE_SOURCE. When _DYNAMIC_STACK_SIZE_SOURCE or _GNU_SOURCE are defined, define PTHREAD_STACK_MIN to sysconf(_SC_THREAD_STACK_MIN) which is changed to MIN (PTHREAD_STACK_MIN, sysconf(_SC_MINSIGSTKSZ)). Consolidate with to provide a constant target specific PTHREAD_STACK_MIN value. Reviewed-by: Carlos O'Donell --- include/bits/local_lim.h | 7 +++++++ include/features.h | 18 +++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 include/bits/local_lim.h (limited to 'include') diff --git a/include/bits/local_lim.h b/include/bits/local_lim.h new file mode 100644 index 0000000..46d82dc --- /dev/null +++ b/include/bits/local_lim.h @@ -0,0 +1,7 @@ +/* Don't define PTHREAD_STACK_MIN to sysconf (_SC_THREAD_STACK_MIN) for + glibc build. */ +#if !defined _ISOMAC +# undef __USE_DYNAMIC_STACK_SIZE +#endif + +#include_next diff --git a/include/features.h b/include/features.h index 039bcb1..51c8a98 100644 --- a/include/features.h +++ b/include/features.h @@ -50,8 +50,8 @@ _LARGEFILE64_SOURCE Additional functionality from LFS for large files. _FILE_OFFSET_BITS=N Select default filesystem interface. _ATFILE_SOURCE Additional *at interfaces. - _SC_SIGSTKSZ_SOURCE Select correct (but non compile-time constant) - MINSIGSTKSZ and SIGSTKSZ. + _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant) + MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN. _GNU_SOURCE All of the above, plus GNU extensions. _DEFAULT_SOURCE The default set of features (taking precedence over __STRICT_ANSI__). @@ -98,8 +98,8 @@ __USE_FILE_OFFSET64 Define 64bit interface as default. __USE_MISC Define things from 4.3BSD or System V Unix. __USE_ATFILE Define *at interfaces and AT_* constants for them. - __USE_SC_SIGSTKSZ Define correct (but non compile-time constant) - MINSIGSTKSZ and SIGSTKSZ. + __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant) + MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN. __USE_GNU Define GNU extensions. __USE_FORTIFY_LEVEL Additional security measures used, according to level. @@ -143,7 +143,7 @@ #undef __USE_FILE_OFFSET64 #undef __USE_MISC #undef __USE_ATFILE -#undef __USE_SC_SIGSTKSZ +#undef __USE_DYNAMIC_STACK_SIZE #undef __USE_GNU #undef __USE_FORTIFY_LEVEL #undef __KERNEL_STRICT_NAMES @@ -220,8 +220,8 @@ # define _DEFAULT_SOURCE 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 -# undef _SC_SIGSTKSZ_SOURCE -# define _SC_SIGSTKSZ_SOURCE 1 +# undef _DYNAMIC_STACK_SIZE_SOURCE +# define _DYNAMIC_STACK_SIZE_SOURCE 1 #endif /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, @@ -399,8 +399,8 @@ # define __USE_ATFILE 1 #endif -#ifdef _SC_SIGSTKSZ_SOURCE -# define __USE_SC_SIGSTKSZ 1 +#ifdef _DYNAMIC_STACK_SIZE_SOURCE +# define __USE_DYNAMIC_STACK_SIZE 1 #endif #ifdef _GNU_SOURCE -- cgit v1.1