summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Kostecki <conikost@gentoo.org>2021-07-26 22:04:15 +0200
committerConrad Kostecki <conikost@gentoo.org>2021-07-26 22:04:15 +0200
commite847dd35728834c0dc61729774119782d83b0899 (patch)
tree011727dfb071085b1c4808511c6c645cd0775610 /app-benchmarks
parentgames-simulation/openrct2: bump to version 0.3.4.1 (diff)
downloadgentoo-e847dd35728834c0dc61729774119782d83b0899.tar.gz
gentoo-e847dd35728834c0dc61729774119782d83b0899.tar.bz2
gentoo-e847dd35728834c0dc61729774119782d83b0899.zip
app-benchmarks/stress-ng: fix compilation with glibc-2.34
Closes: https://bugs.gentoo.org/803941 Package-Manager: Portage-3.0.20, Repoman-3.0.3 Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
Diffstat (limited to 'app-benchmarks')
-rw-r--r--app-benchmarks/stress-ng/files/stress-ng-0.12.12-glibc-2.34.patch101
-rw-r--r--app-benchmarks/stress-ng/stress-ng-0.12.12.ebuild2
2 files changed, 103 insertions, 0 deletions
diff --git a/app-benchmarks/stress-ng/files/stress-ng-0.12.12-glibc-2.34.patch b/app-benchmarks/stress-ng/files/stress-ng-0.12.12-glibc-2.34.patch
new file mode 100644
index 000000000000..b2f93f21cba6
--- /dev/null
+++ b/app-benchmarks/stress-ng/files/stress-ng-0.12.12-glibc-2.34.patch
@@ -0,0 +1,101 @@
+From f839de283c44ffe46a2d14bfdf854c145abd8ed6 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Mon, 19 Jul 2021 20:49:34 +0100
+Subject: [PATCH] Detemine minimal stack size via sysconf, then
+ PTHREAD_STACK_MIN then guess
+
+Don't rely on PTHREAD_STACK_MIN being defined, use sysconf, then
+PTHREAD_STACK_MIN if it is defined, then 8K default.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+ core-helper.c | 31 +++++++++++++++++++++++++++++++
+ stress-ng.h | 1 +
+ stress-pthread.c | 13 ++-----------
+ 3 files changed, 34 insertions(+), 11 deletions(-)
+
+diff --git a/core-helper.c b/core-helper.c
+index 508627f2..97a3b869 100644
+--- a/core-helper.c
++++ b/core-helper.c
+@@ -2494,6 +2494,37 @@ size_t stress_min_sig_stack_size(void)
+ return (size_t)sz;
+ }
+
++size_t stress_min_pthread_stack_size(void)
++{
++ static long sz = -1, min;
++
++ /* return cached copy */
++ if (sz > 0)
++ return sz;
++
++ min = stress_min_aux_sig_stack_size();
++#if defined(__SC_THREAD_STACK_MIN_VALUE)
++ sz = sysconf(__SC_THREAD_STACK_MIN_VALUE);
++ if (sz > min)
++ min = sz;
++#endif
++#if defined(_SC_THREAD_STACK_MIN_VALUE)
++ sz = sysconf(_SC_THREAD_STACK_MIN_VALUE);
++ if (sz > min)
++ min = sz;
++#endif
++#if defined(PTHREAD_STACK_MIN)
++ if (PTHREAD_STACK_MIN > min)
++ min = PTHREAD_STACK_MIN;
++#endif
++ if (8192 > min)
++ min = 8192;
++
++ sz = min;
++
++ return (size_t)sz;
++}
++
+ /*
+ * stress_sig_handler_exit()
+ * signal handler that exits a process via _exit(0) for
+diff --git a/stress-ng.h b/stress-ng.h
+index 8a8b17ae..cd744756 100644
+--- a/stress-ng.h
++++ b/stress-ng.h
+@@ -4056,6 +4056,7 @@ extern WARN_UNUSED int32_t stress_get_opt_ionice_class(const char *const str);
+ /* Misc helper funcs */
+ extern WARN_UNUSED size_t stress_sig_stack_size(void);
+ extern WARN_UNUSED size_t stress_min_sig_stack_size(void);
++extern WARN_UNUSED size_t stress_min_pthread_stack_size(void);
+
+ #define STRESS_SIGSTKSZ (stress_sig_stack_size())
+ #define STRESS_MINSIGSTKSZ (stress_min_sig_stack_size())
+diff --git a/stress-pthread.c b/stress-pthread.c
+index 0da3aeec..27777af8 100644
+--- a/stress-pthread.c
++++ b/stress-pthread.c
+@@ -69,12 +69,7 @@ static const stress_opt_set_func_t opt_set_funcs[] = {
+
+ #if defined(HAVE_LIB_PTHREAD)
+
+-/* Some systems such as GNU/HURD don't define PTHREAD_STACK_MIN */
+-#if !defined(PTHREAD_STACK_MIN)
+-#define PTHREAD_STACK_MIN (16 * KB)
+-#endif
+-
+-#define DEFAULT_STACK_MIN (16 * KB)
++#define DEFAULT_STACK_MIN (8 * KB)
+
+ #if defined(HAVE_GET_ROBUST_LIST) && \
+ defined(HAVE_LINUX_FUTEX_H)
+@@ -404,11 +399,7 @@ static int stress_pthread(const stress_args_t *args)
+ stress_pthread_args_t pargs = { args, NULL, 0 };
+ sigset_t set;
+ #if defined(HAVE_PTHREAD_ATTR_SETSTACK)
+-#if DEFAULT_STACK_MIN == PTHREAD_STACK_MIN
+- const size_t stack_size = PTHREAD_STACK_MIN;
+-#else
+- const size_t stack_size = STRESS_MAXIMUM(DEFAULT_STACK_MIN, PTHREAD_STACK_MIN);
+-#endif
++ const size_t stack_size = STRESS_MAXIMUM(DEFAULT_STACK_MIN, stress_min_pthread_stack_size());
+ #endif
+
+ keep_running_flag = true;
diff --git a/app-benchmarks/stress-ng/stress-ng-0.12.12.ebuild b/app-benchmarks/stress-ng/stress-ng-0.12.12.ebuild
index 309cd350a1c7..4269478b747b 100644
--- a/app-benchmarks/stress-ng/stress-ng-0.12.12.ebuild
+++ b/app-benchmarks/stress-ng/stress-ng-0.12.12.ebuild
@@ -28,6 +28,8 @@ RDEPEND="${DEPEND}"
DOCS=( "README" "README.Android" "TODO" "syscalls.txt" )
+PATCHES=( "${FILESDIR}/${PN}-0.12.12-glibc-2.34.patch" )
+
src_compile() {
export MAN_COMPRESS=0
export VERBOSE=1