From 5adfe740c027fb8dc9931053f55f7eae222e6bb4 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:09:02 -0700
Subject: [PATCH] ada: libgnarl: remove use of glibc-specific
 pthread_rwlockattr_setkind_np

musl's thread library does not implement it

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
 gcc/ada/libgnarl/s-osinte__linux.ads | 10 ----------
 gcc/ada/libgnarl/s-taprop__linux.adb |  7 -------
 2 files changed, 17 deletions(-)

diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
index 7aeb15da523..5551b701e5a 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -402,16 +402,6 @@ package System.OS_Interface is
      (attr : access pthread_rwlockattr_t) return int;
    pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
 
-   PTHREAD_RWLOCK_PREFER_READER_NP              : constant := 0;
-   PTHREAD_RWLOCK_PREFER_WRITER_NP              : constant := 1;
-   PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
-
-   function pthread_rwlockattr_setkind_np
-     (attr : access pthread_rwlockattr_t;
-      pref : int) return int;
-   pragma Import
-     (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
-
    function pthread_rwlock_init
      (mutex : access pthread_rwlock_t;
       attr  : access pthread_rwlockattr_t) return int;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index 8f4c835baa7..6df36c7d8f4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is
             Result      : C.int;
 
          begin
-            --  Set the rwlock to prefer writer to avoid writers starvation
-
             Result := pthread_rwlockattr_init (RWlock_Attr'Access);
             pragma Assert (Result = 0);
 
-            Result := pthread_rwlockattr_setkind_np
-              (RWlock_Attr'Access,
-               PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
-            pragma Assert (Result = 0);
-
             Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
 
             pragma Assert (Result in 0 | ENOMEM);
-- 
2.50.1

