From f9b9794d934ebf5246c46ac457a72c02bf2ec390 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Tue, 4 Jun 2024 07:25:26 -0700 Subject: [PATCH] nix: make boehmgc patch respect HAVE_PTHREAD_ATTR_GET_NP Fixes build on FreeBSD. --- .../nix/patches/boehmgc-coroutine-sp-fallback.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/package-management/nix/patches/boehmgc-coroutine-sp-fallback.patch b/pkgs/tools/package-management/nix/patches/boehmgc-coroutine-sp-fallback.patch index 578bd325d56bd3..a53b7f1f52f492 100644 --- a/pkgs/tools/package-management/nix/patches/boehmgc-coroutine-sp-fallback.patch +++ b/pkgs/tools/package-management/nix/patches/boehmgc-coroutine-sp-fallback.patch @@ -11,14 +11,23 @@ index 2b45489..0e6d8ef 100644 GC_bool found_me = FALSE; size_t nthreads = 0; int i; -@@ -868,6 +870,31 @@ GC_INNER void GC_push_all_stacks(void) +@@ -868,6 +870,40 @@ GC_INNER void GC_push_all_stacks(void) hi = p->altstack + p->altstack_size; # endif /* FIXME: Need to scan the normal stack too, but how ? */ + } else { ++ #ifdef HAVE_PTHREAD_ATTR_GET_NP ++ if (pthread_attr_init(&pattr) != 0) { ++ ABORT("GC_push_all_stacks: pthread_attr_init failed!"); ++ } ++ if (pthread_attr_get_np(p->id, &pattr) != 0) { ++ ABORT("GC_push_all_stacks: pthread_attr_get_np failed!"); ++ } ++ #else + if (pthread_getattr_np(p->id, &pattr)) { + ABORT("GC_push_all_stacks: pthread_getattr_np failed!"); + } ++ #endif + if (pthread_attr_getstacksize(&pattr, &stack_limit)) { + ABORT("GC_push_all_stacks: pthread_attr_getstacksize failed!"); + }