0001-stress-pthread-fix-non-NPTL-build.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 73d1f5ed2167fca8a1cbfb85f4da123f00e524a1 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd@kuhls.net>
  3. Date: Sun, 30 Nov 2025 11:36:10 +0100
  4. Subject: [PATCH] stress-pthread: fix non-NPTL build
  5. https://github.com/ColinIanKing/stress-ng/commit/15b26e33daaf36acd5eeceaaf6fc954f46792a8b
  6. added the usage of attr without using HAVE_PTHREAD_ATTR_SETSTACK for
  7. toolchains without NPTL support.
  8. This patch fixes build errors detected by buildroot autobuilders:
  9. https://autobuild.buildroot.net/results/d4f/d4fadef213455b1776d93e30e51ffe09fb1879c5/build-end.log
  10. stress-pthread.c: In function 'stress_pthread':
  11. stress-pthread.c:567:81: error: 'attr' undeclared (first use in this function)
  12. 567 | pthreads[i].ret = pthread_create(&pthreads[i].pthread, &attr,
  13. Upstream: https://github.com/ColinIanKing/stress-ng/pull/593
  14. Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
  15. ---
  16. stress-pthread.c | 4 ++++
  17. 1 file changed, 4 insertions(+)
  18. diff --git a/stress-pthread.c b/stress-pthread.c
  19. index aafcf0f0a..8605b7a1d 100644
  20. --- a/stress-pthread.c
  21. +++ b/stress-pthread.c
  22. @@ -564,7 +564,11 @@ static int stress_pthread(stress_args_t *args)
  23. pthreads[i].t_create = stress_time_now();
  24. pthreads[i].t_run = pthreads[i].t_create;
  25. +#if defined(HAVE_PTHREAD_ATTR_SETSTACK)
  26. pthreads[i].ret = pthread_create(&pthreads[i].pthread, &attr,
  27. +#else
  28. + pthreads[i].ret = pthread_create(&pthreads[i].pthread, NULL,
  29. +#endif
  30. stress_pthread_func, (void *)&pargs);
  31. if (UNLIKELY(pthreads[i].ret)) {
  32. /* Out of resources, don't try any more */
  33. --
  34. 2.47.3