about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-06-21 12:42:56 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-07-09 15:10:35 -0700
commit5d98a7dae955bafa6740c26eaba9c86060ae0344 (patch)
tree51ab0a095a5406ec5f1b65eafb1f5808a98e9f63 /include
parent7c241325d67af9e24ff03d4c6f6280c17ea181f8 (diff)
downloadglibc-5d98a7dae955bafa6740c26eaba9c86060ae0344.tar.gz
glibc-5d98a7dae955bafa6740c26eaba9c86060ae0344.tar.xz
glibc-5d98a7dae955bafa6740c26eaba9c86060ae0344.zip
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 <bits/local_lim.h> with <bits/pthread_stack_min.h> to
provide a constant target specific PTHREAD_STACK_MIN value.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/bits/local_lim.h7
-rw-r--r--include/features.h18
2 files changed, 16 insertions, 9 deletions
diff --git a/include/bits/local_lim.h b/include/bits/local_lim.h
new file mode 100644
index 0000000000..46d82dc729
--- /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 <bits/local_lim.h>
diff --git a/include/features.h b/include/features.h
index 039bcb112b..51c8a98fb0 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