[PATCH v2 23/25] nptl: Add __ prefix to the futex-internal.h functions

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Nov 10 15:10:07 GMT 2026


The upcoming <sys/futex.h> interface exports futex_wait and futex_wake
symbols, which might clash with the internal inline functions.  The
internal futex_wait and futex_wake become __futex_wait_internal and
__futex_wake_internal, which leaves the __futex_wait and __futex_wake
names free.

No functional change.
---
 nptl/futex-internal.c                        |  4 +--
 nptl/lowlevellock.c                          |  4 +--
 nptl/nptl_setxid.c                           | 12 ++++-----
 nptl/pthread_barrier_destroy.c               |  2 +-
 nptl/pthread_barrier_wait.c                  |  8 +++---
 nptl/pthread_clockjoin.c                     |  2 +-
 nptl/pthread_cond_broadcast.c                |  4 +--
 nptl/pthread_cond_common.c                   |  4 +--
 nptl/pthread_cond_destroy.c                  |  2 +-
 nptl/pthread_cond_signal.c                   |  2 +-
 nptl/pthread_cond_wait.c                     |  6 ++---
 nptl/pthread_create.c                        |  8 +++---
 nptl/pthread_join_common.c                   |  2 +-
 nptl/pthread_mutex_init.c                    |  2 +-
 nptl/pthread_mutex_lock.c                    |  9 ++++---
 nptl/pthread_mutex_setprioceiling.c          |  7 ++---
 nptl/pthread_mutex_timedlock.c               |  7 ++---
 nptl/pthread_mutex_trylock.c                 |  7 ++---
 nptl/pthread_mutex_unlock.c                  |  6 ++---
 nptl/pthread_once.c                          |  8 +++---
 nptl/pthread_rwlock_common.c                 | 27 +++++++++++---------
 nptl/pthread_rwlock_tryrdlock.c              |  2 +-
 nptl/sem_clockwait.c                         |  2 +-
 nptl/sem_post.c                              |  7 ++---
 nptl/sem_waitcommon.c                        |  2 +-
 sysdeps/nptl/aio_misc.h                      |  3 ++-
 sysdeps/nptl/dl-thread_gscope_wait.c         |  4 +--
 sysdeps/nptl/futex-internal.h                | 26 ++++++++++---------
 sysdeps/nptl/gai_misc.h                      |  3 ++-
 sysdeps/nptl/libc_start_call_main.h          |  2 +-
 sysdeps/pthread/tst-rwlock-tryrdlock-stall.c |  2 +-
 31 files changed, 100 insertions(+), 86 deletions(-)

diff --git a/nptl/futex-internal.c b/nptl/futex-internal.c
index 59aef5daf6f..beea65b8c59 100644
--- a/nptl/futex-internal.c
+++ b/nptl/futex-internal.c
@@ -116,7 +116,7 @@ __futex_abstimed_wait_common (unsigned int* futex_word,
     case -ENOSYS: /* Must have been caused by a glibc bug.  */
     /* No other errors are documented at this time.  */
     default:
-      futex_fatal_error ();
+      __futex_fatal_error ();
     }
 }
 
@@ -205,6 +205,6 @@ __futex_lock_pi64 (int *futex_word, clockid_t clockid,
     case -ENOSYS: /* Must have been caused by a glibc bug.  */
     /* No other errors are documented at this time.  */
     default:
-      futex_fatal_error ();
+      __futex_fatal_error ();
     }
 }
diff --git a/nptl/lowlevellock.c b/nptl/lowlevellock.c
index 94c557338b1..cb1f9108e4a 100644
--- a/nptl/lowlevellock.c
+++ b/nptl/lowlevellock.c
@@ -31,7 +31,7 @@ __lll_lock_wait_private (int *futex)
     {
     futex:
       LIBC_PROBE (lll_lock_wait_private, 1, futex);
-      futex_wait ((unsigned int *) futex, 2, LLL_PRIVATE); /* Wait if *futex == 2.  */
+      __futex_wait_internal ((unsigned int *) futex, 2, LLL_PRIVATE); /* Wait if *futex == 2.  */
     }
 }
 libc_hidden_def (__lll_lock_wait_private)
@@ -46,7 +46,7 @@ __lll_lock_wait (int *futex, int private)
     {
     futex:
       LIBC_PROBE (lll_lock_wait, 1, futex);
-      futex_wait ((unsigned int *) futex, 2, private); /* Wait if *futex == 2.  */
+      __futex_wait_internal ((unsigned int *) futex, 2, private); /* Wait if *futex == 2.  */
     }
 }
 libc_hidden_def (__lll_lock_wait)
diff --git a/nptl/nptl_setxid.c b/nptl/nptl_setxid.c
index 843eab230fe..fd033ddc9ea 100644
--- a/nptl/nptl_setxid.c
+++ b/nptl/nptl_setxid.c
@@ -86,10 +86,10 @@ __nptl_setxid_sighandler (int sig, siginfo_t *si, void *ctx)
 
   /* And release the futex.  */
   self->setxid_futex = 1;
-  futex_wake (&self->setxid_futex, 1, FUTEX_PRIVATE);
+  __futex_wake_internal (&self->setxid_futex, 1, FUTEX_PRIVATE);
 
   if (atomic_fetch_add_relaxed (&xidcmd->cntr, -1) == 1)
-    futex_wake ((unsigned int *) &xidcmd->cntr, 1, FUTEX_PRIVATE);
+    __futex_wake_internal ((unsigned int *) &xidcmd->cntr, 1, FUTEX_PRIVATE);
 }
 libc_hidden_def (__nptl_setxid_sighandler)
 
@@ -102,7 +102,7 @@ setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
   if (t->setxid_futex == -1
       && ! atomic_compare_and_exchange_bool_acq (&t->setxid_futex, -2, -1))
     do
-      futex_wait_simple (&t->setxid_futex, -2, FUTEX_PRIVATE);
+      __futex_wait_simple (&t->setxid_futex, -2, FUTEX_PRIVATE);
     while (t->setxid_futex == -2);
 
   /* Don't let the thread exit before the setxid handler runs.  */
@@ -120,7 +120,7 @@ setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
           if ((ch & SETXID_BITMASK) == 0)
             {
               t->setxid_futex = 1;
-              futex_wake (&t->setxid_futex, 1, FUTEX_PRIVATE);
+              __futex_wake_internal (&t->setxid_futex, 1, FUTEX_PRIVATE);
             }
           return;
         }
@@ -146,7 +146,7 @@ setxid_unmark_thread (struct xid_command *cmdp, struct pthread *t)
 
   /* Release the futex just in case.  */
   t->setxid_futex = 1;
-  futex_wake (&t->setxid_futex, 1, FUTEX_PRIVATE);
+  __futex_wake_internal (&t->setxid_futex, 1, FUTEX_PRIVATE);
 }
 
 
@@ -302,7 +302,7 @@ __nptl_setxid (struct xid_command *cmdp)
       int cur = cmdp->cntr;
       while (cur != 0)
         {
-          futex_wait_simple ((unsigned int *) &cmdp->cntr, cur,
+          __futex_wait_simple ((unsigned int *) &cmdp->cntr, cur,
                              FUTEX_PRIVATE);
           cur = cmdp->cntr;
         }
diff --git a/nptl/pthread_barrier_destroy.c b/nptl/pthread_barrier_destroy.c
index eef809eaa54..debd9a85e6f 100644
--- a/nptl/pthread_barrier_destroy.c
+++ b/nptl/pthread_barrier_destroy.c
@@ -47,7 +47,7 @@ __pthread_barrier_destroy (pthread_barrier_t *barrier)
 	 thread will perform a reset.  Wait until that has happened.  */
       while (in != 0)
 	{
-	  futex_wait_simple (&bar->in, in, bar->shared);
+	  __futex_wait_simple (&bar->in, in, bar->shared);
 	  in = atomic_load_relaxed (&bar->in);
 	}
     }
diff --git a/nptl/pthread_barrier_wait.c b/nptl/pthread_barrier_wait.c
index 20722c343b9..a7392a2faf8 100644
--- a/nptl/pthread_barrier_wait.c
+++ b/nptl/pthread_barrier_wait.c
@@ -123,7 +123,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
 	 concurrently with a reset.  */
       while (i > max_in_before_reset)
 	{
-	  futex_wait_simple (&bar->in, i, bar->shared);
+	  __futex_wait_simple (&bar->in, i, bar->shared);
 	  /* Relaxed MO is fine here because we just need an indication for
 	     when we should retry to enter (which will use acquire MO, see
 	     above).  */
@@ -164,7 +164,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
 	     use of barriers.
 	     Note that we can still access SHARED because we haven't yet
 	     confirmed to have left the barrier.  */
-	  futex_wake (&bar->current_round, INT_MAX, bar->shared);
+	  __futex_wake_internal (&bar->current_round, INT_MAX, bar->shared);
 	  /* We did as much as we could based on our position.  If we advanced
 	     the current round to a round sufficient for us, do not wait for
 	     that to happen and skip the acquire fence (we already
@@ -181,7 +181,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
   while (i > cr)
     {
       /* Wait for the current round to finish.  */
-      futex_wait_simple (&bar->current_round, cr, bar->shared);
+      __futex_wait_simple (&bar->current_round, cr, bar->shared);
       /* See the fence below.  */
       cr = atomic_load_relaxed (&bar->current_round);
     }
@@ -213,7 +213,7 @@ ___pthread_barrier_wait (pthread_barrier_t *barrier)
 	 destroyed.  */
       int shared = bar->shared;
       atomic_store_release (&bar->in, 0);
-      futex_wake (&bar->in, INT_MAX, shared);
+      __futex_wake_internal (&bar->in, INT_MAX, shared);
 
     }
 
diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c
index 3c906b795a1..a4ccbe97e72 100644
--- a/nptl/pthread_clockjoin.c
+++ b/nptl/pthread_clockjoin.c
@@ -26,7 +26,7 @@ ___pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
 			   clockid_t clockid,
 			   const struct __timespec64 *abstime)
 {
-  if (!futex_abstimed_supported_clockid (clockid))
+  if (!__futex_abstimed_supported_clockid (clockid))
     return EINVAL;
 
   return __pthread_clockjoin_ex (threadid, thread_return,
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index f51d514829e..1f69e7787eb 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -64,7 +64,7 @@ ___pthread_cond_broadcast (pthread_cond_t *cond)
       /* TODO Only set it if there are indeed futex waiters.  We could
 	 also try to move this out of the critical section in cases when
 	 G2 is empty (and we don't need to quiesce).  */
-      futex_wake (cond->__data.__g_signals + g1, INT_MAX, private);
+      __futex_wake_internal (cond->__data.__g_signals + g1, INT_MAX, private);
     }
 
   /* G1 is complete.  Step (2) is next unless there are no waiters in G2, in
@@ -82,7 +82,7 @@ ___pthread_cond_broadcast (pthread_cond_t *cond)
   __condvar_release_lock (cond, private);
 
   if (do_futex_wake)
-    futex_wake (cond->__data.__g_signals + g1, INT_MAX, private);
+    __futex_wake_internal (cond->__data.__g_signals + g1, INT_MAX, private);
 
   return 0;
 }
diff --git a/nptl/pthread_cond_common.c b/nptl/pthread_cond_common.c
index ae5257e6063..bea3dba88e7 100644
--- a/nptl/pthread_cond_common.c
+++ b/nptl/pthread_cond_common.c
@@ -137,7 +137,7 @@ __condvar_acquire_lock (pthread_cond_t *cond, int private)
 	    }
 	  /* TODO Back off.  */
 	}
-      futex_wait_simple (&cond->__data.__g1_orig_size,
+      __futex_wait_simple (&cond->__data.__g1_orig_size,
 	  (s & ~(unsigned int) 3) | 2, private);
       /* Reload so we see a recent value.  */
       s = atomic_load_relaxed (&cond->__data.__g1_orig_size);
@@ -151,7 +151,7 @@ __condvar_release_lock (pthread_cond_t *cond, int private)
   if ((atomic_fetch_and_release (&cond->__data.__g1_orig_size,
 				 ~(unsigned int) 3) & 3)
       == 2)
-    futex_wake (&cond->__data.__g1_orig_size, 1, private);
+    __futex_wake_internal (&cond->__data.__g1_orig_size, 1, private);
 }
 
 /* Only use this when having acquired the lock.  */
diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
index 73d42dcefd8..cae89571966 100644
--- a/nptl/pthread_cond_destroy.c
+++ b/nptl/pthread_cond_destroy.c
@@ -50,7 +50,7 @@ __pthread_cond_destroy (pthread_cond_t *cond)
   int private = __condvar_get_private (wrefs);
   while (wrefs >> 3 != 0)
     {
-      futex_wait_simple (&cond->__data.__wrefs, wrefs, private);
+      __futex_wait_simple (&cond->__data.__wrefs, wrefs, private);
       /* See above.  */
       wrefs = atomic_load_acquire (&cond->__data.__wrefs);
     }
diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
index 3f6ae04a7b6..d19a6707966 100644
--- a/nptl/pthread_cond_signal.c
+++ b/nptl/pthread_cond_signal.c
@@ -89,7 +89,7 @@ ___pthread_cond_signal (pthread_cond_t *cond)
   __condvar_release_lock (cond, private);
 
   if (do_futex_wake)
-    futex_wake (cond->__data.__g_signals + g1, 1, private);
+    __futex_wake_internal (cond->__data.__g_signals + g1, 1, private);
 
   return 0;
 }
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index cd27a2bed51..990525ebe9b 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -51,7 +51,7 @@ __condvar_confirm_wakeup (pthread_cond_t *cond, int private)
      threads waiting in pthread_cond_destroy.  Release MO to synchronize with
      these threads.  Don't bother clearing the wake-up request flag.  */
   if ((atomic_fetch_add_release (&cond->__data.__wrefs, -8) >> 2) == 3)
-    futex_wake (&cond->__data.__wrefs, INT_MAX, private);
+    __futex_wake_internal (&cond->__data.__wrefs, INT_MAX, private);
 }
 
 
@@ -161,7 +161,7 @@ __condvar_cleanup_waiting (void *arg)
      causing another waiter in the same group to not wake up.  To work around
      this issue until we have fixed cancellation, just add a futex wake-up
      conservatively.  */
-  futex_wake (cond->__data.__g_signals + g, 1, cbuffer->private);
+  __futex_wake_internal (cond->__data.__g_signals + g, 1, cbuffer->private);
 
   __condvar_confirm_wakeup (cond, cbuffer->private);
 
@@ -511,7 +511,7 @@ ___pthread_cond_clockwait64 (pthread_cond_t *cond, pthread_mutex_t *mutex,
   if (! valid_nanoseconds (abstime->tv_nsec))
     return EINVAL;
 
-  if (!futex_abstimed_supported_clockid (clockid))
+  if (!__futex_abstimed_supported_clockid (clockid))
     return EINVAL;
 
   return __pthread_cond_wait_common (cond, mutex, clockid, abstime);
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index fcb06c68c71..49082e6d2a4 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -428,7 +428,7 @@ start_thread (void *arg)
 
   /* Allow setxid from now onwards.  */
   if (__glibc_unlikely (atomic_exchange_acquire (&pd->setxid_futex, 0) == -2))
-    futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
+    __futex_wake_internal (&pd->setxid_futex, 1, FUTEX_PRIVATE);
 
   if (__glibc_likely (! not_first_call))
     {
@@ -562,7 +562,7 @@ start_thread (void *arg)
 	  this->__list.__next = NULL;
 
 	  atomic_fetch_or_acquire (&this->__lock, FUTEX_OWNER_DIED);
-	  futex_wake ((unsigned int *) &this->__lock, 1,
+	  __futex_wake_internal ((unsigned int *) &this->__lock, 1,
 		      /* XYZ */ FUTEX_SHARED);
 	}
       while (robust != (void *) &pd->robust_head);
@@ -582,11 +582,11 @@ start_thread (void *arg)
       /* Some other thread might call any of the setXid functions and expect
 	 us to reply.  In this case wait until we did that.  */
       do
-	/* XXX This differs from the typical futex_wait_simple pattern in that
+	/* XXX This differs from the typical __futex_wait_simple pattern in that
 	   the futex_wait condition (setxid_futex) is different from the
 	   condition used in the surrounding loop (cancelhandling).  We need
 	   to check and document why this is correct.  */
-	futex_wait_simple (&pd->setxid_futex, 0, FUTEX_PRIVATE);
+	__futex_wait_simple (&pd->setxid_futex, 0, FUTEX_PRIVATE);
       while (pd->cancelhandling & SETXID_BITMASK);
 
       /* Reset the value so that the stack can be reused.  */
diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c
index 452f1ee54bf..a4647c66546 100644
--- a/nptl/pthread_join_common.c
+++ b/nptl/pthread_join_common.c
@@ -35,7 +35,7 @@ __pthread_clockjoin_ex (pthread_t threadid, void **thread_return,
 
   /* Make sure the clock and time specified are valid.  */
   if (abstime
-      && __glibc_unlikely (!futex_abstimed_supported_clockid (clockid)
+      && __glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)
 			   || ! valid_nanoseconds (abstime->tv_nsec)))
     return EINVAL;
 
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index 8a5450bcb08..1019a96afef 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -41,7 +41,7 @@ prio_inherit_missing (void)
   static int tpi_supported;
   if (__glibc_unlikely (atomic_load_relaxed (&tpi_supported) == 0))
     {
-      int e = futex_unlock_pi (&(unsigned int){0}, 0);
+      int e = __futex_unlock_pi (&(unsigned int){0}, 0);
       atomic_store_relaxed (&tpi_supported, e == ENOSYS ? -1 : 1);
     }
   return __glibc_unlikely (tpi_supported < 0);
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index e93bd883147..c1d2be57dc0 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -308,7 +308,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
 	  assume_other_futex_waiters |= FUTEX_WAITERS;
 
 	  /* Block using the futex and reload current lock value.  */
-	  futex_wait ((unsigned int *) &mutex->__data.__lock, oldval,
+	  __futex_wait_internal ((unsigned int *) &mutex->__data.__lock, oldval,
 		      PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 	  oldval = mutex->__data.__lock;
 	}
@@ -325,7 +325,8 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
 	     is negative.  */
 	  if ((atomic_exchange_release (&mutex->__data.__lock, 0)
 	       & FUTEX_WAITERS) != 0)
-	    futex_wake ((unsigned int *) &mutex->__data.__lock, 1, private);
+	    __futex_wake_internal ((unsigned int *) &mutex->__data.__lock, 1,
+				   private);
 	  /* FIXME This violates the mutex destruction requirements.  See
 	     __pthread_mutex_unlock_full.  */
 	  THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
@@ -484,7 +485,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
 	    /* This mutex is now not recoverable.  */
 	    mutex->__data.__count = 0;
 
-	    futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+	    __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
 			     PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 
 	    /* To the kernel, this will be visible after the kernel has
@@ -580,7 +581,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
 		  break;
 
 		if (oldval != ceilval)
-		  futex_wait ((unsigned int * ) &mutex->__data.__lock,
+		  __futex_wait_internal ((unsigned int * ) &mutex->__data.__lock,
 			      ceilval | 2,
 			      PTHREAD_MUTEX_PSHARED (mutex));
 	      }
diff --git a/nptl/pthread_mutex_setprioceiling.c b/nptl/pthread_mutex_setprioceiling.c
index a951ecc646c..0f45d83ed16 100644
--- a/nptl/pthread_mutex_setprioceiling.c
+++ b/nptl/pthread_mutex_setprioceiling.c
@@ -84,8 +84,9 @@ __pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling,
 	      break;
 
 	    if (oldval != ceilval)
-	      futex_wait ((unsigned int *) &mutex->__data.__lock, ceilval | 2,
-			  PTHREAD_MUTEX_PSHARED (mutex));
+	      __futex_wait_internal ((unsigned int *) &mutex->__data.__lock,
+				     ceilval | 2,
+				     PTHREAD_MUTEX_PSHARED (mutex));
 	  }
 	while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
 						    ceilval | 2, ceilval)
@@ -115,7 +116,7 @@ __pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling,
 			 | (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT);
   atomic_full_barrier ();
 
-  futex_wake ((unsigned int *)&mutex->__data.__lock, INT_MAX,
+  __futex_wake_internal ((unsigned int *)&mutex->__data.__lock, INT_MAX,
 	      PTHREAD_MUTEX_PSHARED (mutex));
 
   return 0;
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 03c21d4c51c..d4000503c36 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -261,7 +261,8 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
 	     here.  */
 	  if ((atomic_exchange_release (&mutex->__data.__lock, 0)
 	       & FUTEX_WAITERS) != 0)
-	    futex_wake ((unsigned int *) &mutex->__data.__lock, 1, private);
+	    __futex_wake_internal ((unsigned int *) &mutex->__data.__lock, 1,
+				   private);
 	  /* FIXME This violates the mutex destruction requirements.  See
 	     __pthread_mutex_unlock_full.  */
 	  return __pthread_mutex_robust_error (ENOTRECOVERABLE);
@@ -409,7 +410,7 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
 	    /* This mutex is now not recoverable.  */
 	    mutex->__data.__count = 0;
 
-	    futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+	    __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
 			     PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 
 	    /* To the kernel, this will be visible after the kernel has
@@ -547,7 +548,7 @@ ___pthread_mutex_clocklock64 (pthread_mutex_t *mutex,
 			      clockid_t clockid,
 			      const struct __timespec64 *abstime)
 {
-  if (__glibc_unlikely (!futex_abstimed_supported_clockid (clockid)))
+  if (__glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)))
     return EINVAL;
 
   LIBC_PROBE (mutex_clocklock_entry, 3, mutex, clockid, abstime);
diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index 1a61e141517..f5d501db97d 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -175,8 +175,9 @@ ___pthread_mutex_trylock (pthread_mutex_t *mutex)
 	      if (oldval == 0
 		  && (atomic_exchange_release (&mutex->__data.__lock, 0)
 		      & FUTEX_WAITERS) != 0)
-		futex_wake ((unsigned int *) &mutex->__data.__lock, 1,
-			    PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
+		__futex_wake_internal ((unsigned int *)
+				       &mutex->__data.__lock, 1,
+				       PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 	      /* FIXME This violates the mutex destruction requirements.  See
 		 __pthread_mutex_unlock_full.  */
 	      THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
@@ -334,7 +335,7 @@ ___pthread_mutex_trylock (pthread_mutex_t *mutex)
 	    /* This mutex is now not recoverable.  */
 	    mutex->__data.__count = 0;
 
-	    futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+	    __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
 			     PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 
 	    /* To the kernel, this will be visible after the kernel has
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index fc1c9512754..ca62fd2bd7d 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -163,7 +163,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
       private = PTHREAD_ROBUST_MUTEX_PSHARED (mutex);
       if (__glibc_unlikely ((atomic_exchange_release (&mutex->__data.__lock, 0)
 			     & FUTEX_WAITERS) != 0))
-	futex_wake ((unsigned int *) &mutex->__data.__lock, 1, private);
+	__futex_wake_internal ((unsigned int *) &mutex->__data.__lock, 1, private);
 
       /* We must clear op_pending after we release the mutex.
 	 FIXME However, this violates the mutex destruction requirements
@@ -279,7 +279,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
 	  if (((l & FUTEX_WAITERS) != 0)
 	      || (l != THREAD_GETMEM (THREAD_SELF, tid)))
 	    {
-	      futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
+	      __futex_unlock_pi ((unsigned int *) &mutex->__data.__lock,
 			       private);
 	      break;
 	    }
@@ -333,7 +333,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
 						    &oldval, newval));
 
       if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)
-	futex_wake ((unsigned int *)&mutex->__data.__lock, 1,
+	__futex_wake_internal ((unsigned int *)&mutex->__data.__lock, 1,
 		    PTHREAD_MUTEX_PSHARED (mutex));
 
       int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
diff --git a/nptl/pthread_once.c b/nptl/pthread_once.c
index 8d2081f2591..570c879fafa 100644
--- a/nptl/pthread_once.c
+++ b/nptl/pthread_once.c
@@ -35,7 +35,8 @@ clear_once_control (void *arg)
      get interrupted (see __pthread_once), so all we need to relay to other
      threads is the state being reset again.  */
   atomic_store_relaxed (once_control, 0);
-  futex_wake ((unsigned int *) once_control, INT_MAX, FUTEX_PRIVATE);
+  __futex_wake_internal ((unsigned int *) once_control, INT_MAX,
+			 FUTEX_PRIVATE);
 }
 
 
@@ -102,7 +103,7 @@ __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
 	    {
 	      /* Same generation, some other thread was faster.  Wait and
 		 retry.  */
-	      futex_wait_simple ((unsigned int *) once_control,
+	      __futex_wait_simple ((unsigned int *) once_control,
 				 (unsigned int) newval, FUTEX_PRIVATE);
 	      continue;
 	    }
@@ -124,7 +125,8 @@ __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
       atomic_store_release (once_control, __PTHREAD_ONCE_DONE);
 
       /* Wake up all other threads.  */
-      futex_wake ((unsigned int *) once_control, INT_MAX, FUTEX_PRIVATE);
+      __futex_wake_internal ((unsigned int *) once_control, INT_MAX,
+			     FUTEX_PRIVATE);
       break;
     }
 
diff --git a/nptl/pthread_rwlock_common.c b/nptl/pthread_rwlock_common.c
index 9b0b5282987..2d576af73c2 100644
--- a/nptl/pthread_rwlock_common.c
+++ b/nptl/pthread_rwlock_common.c
@@ -263,11 +263,11 @@ __pthread_rwlock_rdunlock (pthread_rwlock_t *rwlock)
       atomic_thread_fence_acquire ();
       if ((atomic_exchange_relaxed (&rwlock->__data.__wrphase_futex, 1)
 	   & PTHREAD_RWLOCK_FUTEX_USED) != 0)
-	futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+	__futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
     }
   /* Also wake up waiting readers if we did reset the RWAITING flag.  */
   if ((r & PTHREAD_RWLOCK_RWAITING) != (rnew & PTHREAD_RWLOCK_RWAITING))
-    futex_wake (&rwlock->__data.__readers, INT_MAX, private);
+    __futex_wake_internal (&rwlock->__data.__readers, INT_MAX, private);
 }
 
 
@@ -283,8 +283,9 @@ __pthread_rwlock_rdlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
      requires that "the validity of the abstime parameter need not be checked
      if the lock can be immediately acquired" (i.e., we need not but may check
      it).  */
-  if (abstime && __glibc_unlikely (!futex_abstimed_supported_clockid (clockid)
-      || ! valid_nanoseconds (abstime->tv_nsec)))
+  if (abstime
+      && __glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)
+			   || ! valid_nanoseconds (abstime->tv_nsec)))
     return EINVAL;
 
   /* Make sure we are not holding the rwlock as a writer.  This is a deadlock
@@ -408,7 +409,8 @@ __pthread_rwlock_rdlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
 	       & PTHREAD_RWLOCK_FUTEX_USED) != 0)
 	    {
 	      int private = __pthread_rwlock_get_private (rwlock);
-	      futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+	      __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX,
+				     private);
 	    }
 	  return 0;
 	}
@@ -568,13 +570,13 @@ __pthread_rwlock_wrunlock (pthread_rwlock_t *rwlock)
 	 established through __readers.  */
       if ((atomic_exchange_relaxed (&rwlock->__data.__wrphase_futex, 0)
 	   & PTHREAD_RWLOCK_FUTEX_USED) != 0)
-	futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+	__futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
     }
 
  done:
   /* We released WRLOCKED in some way, so wake a writer.  */
   if (wake_writers)
-    futex_wake (&rwlock->__data.__writers_futex, 1, private);
+    __futex_wake_internal (&rwlock->__data.__writers_futex, 1, private);
 }
 
 
@@ -588,8 +590,9 @@ __pthread_rwlock_wrlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
      requires that "the validity of the abstime parameter need not be checked
      if the lock can be immediately acquired" (i.e., we need not but may check
      it).  */
-  if (abstime && __glibc_unlikely (!futex_abstimed_supported_clockid (clockid)
-      || ! valid_nanoseconds (abstime->tv_nsec)))
+  if (abstime
+      && __glibc_unlikely (!__futex_abstimed_supported_clockid (clockid)
+			   || ! valid_nanoseconds (abstime->tv_nsec)))
     return EINVAL;
 
   /* Make sure we are not holding the rwlock as a writer.  This is a deadlock
@@ -853,7 +856,7 @@ __pthread_rwlock_wrlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
 			    {
 			      /* Wake other writers.  */
 			      if ((wf & PTHREAD_RWLOCK_FUTEX_USED) != 0)
-				futex_wake (&rwlock->__data.__writers_futex,
+				__futex_wake_internal (&rwlock->__data.__writers_futex,
 					    1, private);
 			      return err;
 			    }
@@ -895,11 +898,11 @@ __pthread_rwlock_wrlock_full64 (pthread_rwlock_t *rwlock, clockid_t clockid,
 			{
 			  /* Wake other writers.  */
 			  if ((wf & PTHREAD_RWLOCK_FUTEX_USED) != 0)
-			    futex_wake (&rwlock->__data.__writers_futex,
+			    __futex_wake_internal (&rwlock->__data.__writers_futex,
 					1, private);
 			  /* Wake waiting readers.  */
 			  if ((r & PTHREAD_RWLOCK_RWAITING) != 0)
-			    futex_wake (&rwlock->__data.__readers,
+			    __futex_wake_internal (&rwlock->__data.__readers,
 					INT_MAX, private);
 			  return ETIMEDOUT;
 			}
diff --git a/nptl/pthread_rwlock_tryrdlock.c b/nptl/pthread_rwlock_tryrdlock.c
index 25b4137ada9..b7aec8b71a0 100644
--- a/nptl/pthread_rwlock_tryrdlock.c
+++ b/nptl/pthread_rwlock_tryrdlock.c
@@ -107,7 +107,7 @@ ___pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
 	  & PTHREAD_RWLOCK_FUTEX_USED) != 0)
 	{
 	  int private = __pthread_rwlock_get_private (rwlock);
-	  futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+	  __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
 	}
     }
 
diff --git a/nptl/sem_clockwait.c b/nptl/sem_clockwait.c
index cecd06e1cf6..5c077ba80e8 100644
--- a/nptl/sem_clockwait.c
+++ b/nptl/sem_clockwait.c
@@ -28,7 +28,7 @@ ___sem_clockwait64 (sem_t *sem, clockid_t clockid,
 {
   /* Check that supplied clockid is one we support, even if we don't end up
      waiting.  */
-  if (!futex_abstimed_supported_clockid (clockid))
+  if (!__futex_abstimed_supported_clockid (clockid))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/nptl/sem_post.c b/nptl/sem_post.c
index ac34b9d0656..26be218ecb1 100644
--- a/nptl/sem_post.c
+++ b/nptl/sem_post.c
@@ -53,7 +53,8 @@ __new_sem_post (sem_t *sem)
 
   /* If there is any potentially blocked waiter, wake one of them.  */
   if ((d >> SEM_NWAITERS_SHIFT) > 0)
-    futex_wake (((unsigned int *) &isem->data) + SEM_VALUE_OFFSET, 1, private);
+    __futex_wake_internal (((unsigned int *) &isem->data) + SEM_VALUE_OFFSET,
+			   1, private);
 #else
   /* Add a token to the semaphore.  Similar to 64b version.  */
   unsigned int v = atomic_load_relaxed (&isem->value);
@@ -70,7 +71,7 @@ __new_sem_post (sem_t *sem)
 
   /* If there is any potentially blocked waiter, wake one of them.  */
   if ((v & SEM_NWAITERS_MASK) != 0)
-    futex_wake (&isem->value, 1, private);
+    __futex_wake_internal (&isem->value, 1, private);
 #endif
 
   return 0;
@@ -93,7 +94,7 @@ __old_sem_post (sem_t *sem)
   atomic_write_barrier ();
   atomic_fetch_add_release (futex, 1);
   /* We always have to assume it is a shared semaphore.  */
-  futex_wake (futex, 1, LLL_SHARED);
+  __futex_wake_internal (futex, 1, LLL_SHARED);
   return 0;
 }
 compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
diff --git a/nptl/sem_waitcommon.c b/nptl/sem_waitcommon.c
index 82c686f0201..add8b0098dd 100644
--- a/nptl/sem_waitcommon.c
+++ b/nptl/sem_waitcommon.c
@@ -352,7 +352,7 @@ __sem_wait_32_finish (struct new_sem *sem)
          due to us having set the nwaiters bit again.  */
       v >>= SEM_VALUE_SHIFT;
       if (v > 0)
-	futex_wake (&sem->value, v, sem->private);
+	__futex_wake_internal (&sem->value, v, sem->private);
     }
 }
 #endif
diff --git a/sysdeps/nptl/aio_misc.h b/sysdeps/nptl/aio_misc.h
index 0f8fd45d056..e31878b7db7 100644
--- a/sysdeps/nptl/aio_misc.h
+++ b/sysdeps/nptl/aio_misc.h
@@ -29,7 +29,8 @@
 #define AIO_MISC_NOTIFY(waitlist) \
   do {									      \
     if (*waitlist->counterp > 0 && --*waitlist->counterp == 0)		      \
-      futex_wake ((unsigned int *) waitlist->counterp, 1, FUTEX_PRIVATE);     \
+      __futex_wake_internal ((unsigned int *) waitlist->counterp, 1,	      \
+			     FUTEX_PRIVATE);				      \
   } while (0)
 
 #define AIO_MISC_WAIT(result, futex, timeout, cancel)			      \
diff --git a/sysdeps/nptl/dl-thread_gscope_wait.c b/sysdeps/nptl/dl-thread_gscope_wait.c
index fdf84de3928..61823128cc1 100644
--- a/sysdeps/nptl/dl-thread_gscope_wait.c
+++ b/sysdeps/nptl/dl-thread_gscope_wait.c
@@ -48,7 +48,7 @@ __thread_gscope_wait (void)
         continue;
 
       do
-        futex_wait_simple ((unsigned int *) gscope_flagp,
+        __futex_wait_simple ((unsigned int *) gscope_flagp,
                            THREAD_GSCOPE_FLAG_WAIT, FUTEX_PRIVATE);
       while (*gscope_flagp == THREAD_GSCOPE_FLAG_WAIT);
     }
@@ -71,7 +71,7 @@ __thread_gscope_wait (void)
         continue;
 
       do
-        futex_wait_simple ((unsigned int *) gscope_flagp,
+        __futex_wait_simple ((unsigned int *) gscope_flagp,
                            THREAD_GSCOPE_FLAG_WAIT, FUTEX_PRIVATE);
       while (*gscope_flagp == THREAD_GSCOPE_FLAG_WAIT);
     }
diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index 502f89476a2..ebc49899e74 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -76,7 +76,7 @@
 /* Calls __libc_fatal with an error message.  Convenience function for
    concrete implementations of the futex interface.  */
 static __always_inline __attribute__ ((__noreturn__)) void
-futex_fatal_error (void)
+__futex_fatal_error (void)
 {
   __libc_fatal ("The futex facility returned an unexpected error code.\n");
 }
@@ -121,7 +121,8 @@ futex_fatal_error (void)
    a futex_wait call when synchronizing similar to Dekker synchronization.
    However, we make no such guarantee here.  */
 static __always_inline int
-futex_wait (unsigned int *futex_word, unsigned int expected, int private)
+__futex_wait_internal (unsigned int *futex_word, unsigned int expected,
+		       int private)
 {
   int err = lll_futex_timed_wait (futex_word, expected, NULL, private);
   switch (err)
@@ -139,7 +140,7 @@ futex_wait (unsigned int *futex_word, unsigned int expected, int private)
     case -ENOSYS: /* Must have been caused by a glibc bug.  */
     /* No other errors are documented at this time.  */
     default:
-      futex_fatal_error ();
+      __futex_fatal_error ();
     }
 }
 
@@ -148,19 +149,19 @@ futex_wait (unsigned int *futex_word, unsigned int expected, int private)
    determine whether you need to continue waiting, and you cannot detect
    whether the waiting was interrupted by a signal.  Example use:
      while (atomic_load_relaxed (&futex_word) == 23)
-       futex_wait_simple (&futex_word, 23, FUTEX_PRIVATE);
+       __futex_wait_simple (&futex_word, 23, FUTEX_PRIVATE);
    This is common enough to make providing this wrapper worthwhile.  */
 static __always_inline void
-futex_wait_simple (unsigned int *futex_word, unsigned int expected,
+__futex_wait_simple (unsigned int *futex_word, unsigned int expected,
 		   int private)
 {
-  ignore_value (futex_wait (futex_word, expected, private));
+  ignore_value (__futex_wait_internal (futex_word, expected, private));
 }
 
 /* Check whether the specified clockid is supported by
    futex_abstimed_wait and futex_abstimed_wait_cancelable.  */
 static __always_inline int
-futex_abstimed_supported_clockid (clockid_t clockid)
+__futex_abstimed_supported_clockid (clockid_t clockid)
 {
   return lll_futex_supported_clockid (clockid);
 }
@@ -174,7 +175,8 @@ futex_abstimed_supported_clockid (clockid_t clockid)
      for (res = 0; PROCESSES_TO_WAKE > 0; PROCESSES_TO_WAKE--, res++) {
        if (<no process blocked on futex>) break;
        wf = <get wait_flag of a process blocked on futex> (FUTEX_WORD);
-       // No happens-before guarantee with woken futex_wait (see above)
+       // No happens-before guarantee with woken __futex_wait_internal
+       // (see above)
        atomic_store_relaxed (wf, 0);
      }
      return res;
@@ -184,7 +186,7 @@ futex_abstimed_supported_clockid (clockid_t clockid)
    object destruction (see above); therefore, we must not report or abort
    on most errors.  */
 static __always_inline void
-futex_wake (unsigned int* futex_word, int processes_to_wake, int private)
+__futex_wake_internal (unsigned int* futex_word, int processes_to_wake, int private)
 {
   int res = lll_futex_wake (futex_word, processes_to_wake, private);
   /* No error.  Ignore the number of woken processes.  */
@@ -202,7 +204,7 @@ futex_wake (unsigned int* futex_word, int processes_to_wake, int private)
     case -ENOSYS: /* Must have been caused by a glibc bug.  */
     /* No other errors are documented at this time.  */
     default:
-      futex_fatal_error ();
+      __futex_fatal_error ();
     }
 }
 
@@ -240,7 +242,7 @@ int __futex_lock_pi64 (int *futex_word, clockid_t clockid,
    additionally, returns EPERM when the caller is not allowed to attach
    itself to the futex.  */
 static __always_inline int
-futex_unlock_pi (unsigned int *futex_word, int private)
+__futex_unlock_pi (unsigned int *futex_word, int private)
 {
   int err = lll_futex_timed_unlock_pi (futex_word, private);
   switch (err)
@@ -263,7 +265,7 @@ futex_unlock_pi (unsigned int *futex_word, int private)
     case -EFAULT: /* Must have been caused by a glibc or application bug.  */
     /* No other errors are documented at this time.  */
     default:
-      futex_fatal_error ();
+      __futex_fatal_error ();
     }
 }
 
diff --git a/sysdeps/nptl/gai_misc.h b/sysdeps/nptl/gai_misc.h
index 8461fa88bff..28a0254316d 100644
--- a/sysdeps/nptl/gai_misc.h
+++ b/sysdeps/nptl/gai_misc.h
@@ -30,7 +30,8 @@
 #define GAI_MISC_NOTIFY(waitlist) \
   do {									      \
     if (*waitlist->counterp > 0 && --*waitlist->counterp == 0)		      \
-      futex_wake ((unsigned int *) waitlist->counterp, 1, FUTEX_PRIVATE);     \
+      __futex_wake_internal ((unsigned int *) waitlist->counterp, 1,	      \
+			     FUTEX_PRIVATE);				      \
   } while (0)
 
 #define GAI_MISC_WAIT(result, futex, timeout, cancel) \
diff --git a/sysdeps/nptl/libc_start_call_main.h b/sysdeps/nptl/libc_start_call_main.h
index 4cbcfc3ffeb..79f9968b6f9 100644
--- a/sysdeps/nptl/libc_start_call_main.h
+++ b/sysdeps/nptl/libc_start_call_main.h
@@ -72,7 +72,7 @@ __libc_start_call_main (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
       internal_signal_block_all (&set);
       struct pthread *self = THREAD_SELF;
       atomic_store_release (&self->joinstate, THREAD_STATE_EXITED);
-      futex_wake (&self->joinstate, 1, FUTEX_SHARED);
+      __futex_wake_internal (&self->joinstate, 1, FUTEX_SHARED);
 
       if (atomic_fetch_add_relaxed (&__nptl_nthreads, -1) != 1)
         /* Not much left to do but to exit the thread, not the process.  */
diff --git a/sysdeps/pthread/tst-rwlock-tryrdlock-stall.c b/sysdeps/pthread/tst-rwlock-tryrdlock-stall.c
index 36eb05cf2a5..7313a479608 100644
--- a/sysdeps/pthread/tst-rwlock-tryrdlock-stall.c
+++ b/sysdeps/pthread/tst-rwlock-tryrdlock-stall.c
@@ -98,7 +98,7 @@
    ...
    563       if ((atomic_exchange_relaxed (&rwlock->__data.__wrphase_futex, 0)
    564            & PTHREAD_RWLOCK_FUTEX_USED) != 0)
-   565         futex_wake (&rwlock->__data.__wrphase_futex, INT_MAX, private);
+   565         __futex_wake_internal (&rwlock->__data.__wrphase_futex, INT_MAX, private);
    566     }
 
    We note that PTHREAD_RWLOCK_FUTEX_USED is non-zero
-- 
2.53.0



More information about the Libc-alpha mailing list