Adjust use of lll_futex_* macros.
authordrepper <drepper>
Fri, 8 Jun 2007 02:47:49 +0000 (02:47 +0000)
committerdrepper <drepper>
Fri, 8 Jun 2007 02:47:49 +0000 (02:47 +0000)
38 files changed:
nptl/allocatestack.c
nptl/init.c
nptl/lowlevellock.h
nptl/pthread_barrier_wait.c
nptl/pthread_cond_broadcast.c
nptl/pthread_cond_destroy.c
nptl/pthread_cond_signal.c
nptl/pthread_cond_timedwait.c
nptl/pthread_cond_wait.c
nptl/pthread_create.c
nptl/pthread_mutex_lock.c
nptl/pthread_mutex_setprioceiling.c
nptl/pthread_mutex_timedlock.c
nptl/pthread_mutex_unlock.c
nptl/pthread_rwlock_timedrdlock.c
nptl/pthread_rwlock_timedwrlock.c
nptl/pthread_rwlock_unlock.c
nptl/sysdeps/alpha/tls.h
nptl/sysdeps/i386/tls.h
nptl/sysdeps/ia64/tls.h
nptl/sysdeps/powerpc/tls.h
nptl/sysdeps/pthread/aio_misc.h
nptl/sysdeps/pthread/gai_misc.h
nptl/sysdeps/s390/tls.h
nptl/sysdeps/sh/tls.h
nptl/sysdeps/sparc/tls.h
nptl/sysdeps/unix/sysv/linux/fork.c
nptl/sysdeps/unix/sysv/linux/lowlevellock.c
nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
nptl/sysdeps/unix/sysv/linux/sem_post.c
nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
nptl/sysdeps/unix/sysv/linux/sem_wait.c
nptl/sysdeps/unix/sysv/linux/sparc/pthread_once.c
nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c
nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
nptl/sysdeps/x86_64/tls.h

index c31ca80..76d75fe 100644 (file)
@@ -949,7 +949,7 @@ __nptl_setxid (struct xid_command *cmdp)
   int cur = cmdp->cntr;
   while (cur != 0)
     {
-      lll_futex_wait (&cmdp->cntr, cur);
+      lll_private_futex_wait (&cmdp->cntr, cur);
       cur = cmdp->cntr;
     }
 
@@ -1035,7 +1035,7 @@ __wait_lookup_done (void)
        continue;
 
       do
-       lll_futex_wait (gscope_flagp, THREAD_GSCOPE_FLAG_WAIT);
+       lll_private_futex_wait (gscope_flagp, THREAD_GSCOPE_FLAG_WAIT);
       while (*gscope_flagp == THREAD_GSCOPE_FLAG_WAIT);
     }
 
@@ -1057,7 +1057,7 @@ __wait_lookup_done (void)
        continue;
 
       do
-       lll_futex_wait (gscope_flagp, THREAD_GSCOPE_FLAG_WAIT);
+       lll_private_futex_wait (gscope_flagp, THREAD_GSCOPE_FLAG_WAIT);
       while (*gscope_flagp == THREAD_GSCOPE_FLAG_WAIT);
     }
 
index 82adeae..be8359e 100644 (file)
@@ -216,7 +216,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
                        __xidcmd->id[1], __xidcmd->id[2]);
 
   if (atomic_decrement_val (&__xidcmd->cntr) == 0)
-    lll_futex_wake (&__xidcmd->cntr, 1);
+    lll_private_futex_wake (&__xidcmd->cntr, 1);
 
   /* Reset the SETXID flag.  */
   struct pthread *self = THREAD_SELF;
@@ -225,7 +225,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
 
   /* And release the futex.  */
   self->setxid_futex = 1;
-  lll_futex_wake (&self->setxid_futex, 1);
+  lll_private_futex_wake (&self->setxid_futex, 1);
 }
 
 
index 338da39..0600e17 100644 (file)
@@ -1,5 +1,5 @@
 /* Low level locking macros used in NPTL implementation.  Stub version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
 #include <atomic.h>
 
 
-/* Implement generic mutex.  Basic futex syscall support is required:
-
-     lll_futex_wait(futex, value) - call sys_futex with FUTEX_WAIT
-                                   and third parameter VALUE
-
-     lll_futex_wake(futex, value) - call sys_futex with FUTEX_WAKE
-                                   and third parameter VALUE
-*/
-
-
 /* Mutex lock counter:
    bit 31 clear means unlocked;
    bit 31 set means locked.
@@ -66,7 +56,9 @@ __generic_mutex_lock (int *mutex)
       if (v >= 0)
        continue;
 
-      lll_futex_wait (mutex, v);
+      lll_futex_wait (mutex, v,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
     }
 }
 
@@ -82,7 +74,9 @@ __generic_mutex_unlock (int *mutex)
 
   /* There are other threads waiting for this mutex, wake one of them
      up.  */
-  lll_futex_wake (mutex, 1);
+  lll_futex_wake (mutex, 1,
+                 // XYZ check mutex flag
+                 LLL_SHARED);
 }
 
 
index c6b563f..e96a3e5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -45,7 +45,9 @@ pthread_barrier_wait (barrier)
       ++ibarrier->curr_event;
 
       /* Wake up everybody.  */
-      lll_futex_wake (&ibarrier->curr_event, INT_MAX);
+      lll_futex_wake (&ibarrier->curr_event, INT_MAX,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
 
       /* This is the thread which finished the serialization.  */
       result = PTHREAD_BARRIER_SERIAL_THREAD;
@@ -61,7 +63,9 @@ pthread_barrier_wait (barrier)
 
       /* Wait for the event counter of the barrier to change.  */
       do
-       lll_futex_wait (&ibarrier->curr_event, event);
+       lll_futex_wait (&ibarrier->curr_event, event,
+                       // XYZ check mutex flag
+                       LLL_SHARED);
       while (event == ibarrier->curr_event);
     }
 
index 2b8b546..aec33f3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -69,7 +69,9 @@ __pthread_cond_broadcast (cond)
        {
          /* The requeue functionality is not available.  */
        wake_all:
-         lll_futex_wake (&cond->__data.__futex, INT_MAX);
+         lll_futex_wake (&cond->__data.__futex, INT_MAX,
+                         // XYZ check mutex flag
+                         LLL_SHARED);
        }
 
       /* That's all.  */
index 0b8d411..8574b61 100644 (file)
@@ -59,14 +59,18 @@ __pthread_cond_destroy (cond)
          && cond->__data.__mutex != (void *) ~0l)
        {
          pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
-         lll_futex_wake (&mut->__data.__lock, INT_MAX);
+         lll_futex_wake (&mut->__data.__lock, INT_MAX,
+                         // XYZ check mutex flag
+                         LLL_SHARED);
        }
 
       do
        {
          lll_mutex_unlock (cond->__data.__lock);
 
-         lll_futex_wait (&cond->__data.__nwaiters, nwaiters);
+         lll_futex_wait (&cond->__data.__nwaiters, nwaiters,
+                         // XYZ check mutex flag
+                         LLL_SHARED);
 
          lll_mutex_lock (cond->__data.__lock);
 
index 5a9bbca..a4faf41 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -44,11 +44,15 @@ __pthread_cond_signal (cond)
 
       /* Wake one.  */
       if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex, 1,
-                                                    1, &cond->__data.__lock),
+                                                    1, &cond->__data.__lock,
+                                                    // XYZ check mutex flag
+                                                    LLL_SHARED),
                                                     0))
        return 0;
 
-      lll_futex_wake (&cond->__data.__futex, 1);
+      lll_futex_wake (&cond->__data.__futex, 1,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
     }
 
   /* We are done.  */
index 261b448..d1c29d2 100644 (file)
@@ -153,7 +153,9 @@ __pthread_cond_timedwait (cond, mutex, abstime)
 
       /* Wait until woken by signal or broadcast.  */
       err = lll_futex_timed_wait (&cond->__data.__futex,
-                                 futex_val, &rt);
+                                 futex_val, &rt,
+                                 // XYZ check mutex flag
+                                 LLL_SHARED);
 
       /* Disable asynchronous cancellation.  */
       __pthread_disable_asynccancel (cbuffer.oldtype);
@@ -196,7 +198,9 @@ __pthread_cond_timedwait (cond, mutex, abstime)
      and it can be successfully destroyed.  */
   if (cond->__data.__total_seq == -1ULL
       && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-    lll_futex_wake (&cond->__data.__nwaiters, 1);
+    lll_futex_wake (&cond->__data.__nwaiters, 1,
+                   // XYZ check mutex flag
+                   LLL_SHARED);
 
   /* We are done with the condvar.  */
   lll_mutex_unlock (cond->__data.__lock);
index 6e00a28..e524aa6 100644 (file)
@@ -71,7 +71,9 @@ __condvar_cleanup (void *arg)
   if (cbuffer->cond->__data.__total_seq == -1ULL
       && cbuffer->cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
     {
-      lll_futex_wake (&cbuffer->cond->__data.__nwaiters, 1);
+      lll_futex_wake (&cbuffer->cond->__data.__nwaiters, 1,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
       destroying = 1;
     }
 
@@ -80,7 +82,9 @@ __condvar_cleanup (void *arg)
 
   /* Wake everybody to make sure no condvar signal gets lost.  */
   if (! destroying)
-    lll_futex_wake (&cbuffer->cond->__data.__futex, INT_MAX);
+    lll_futex_wake (&cbuffer->cond->__data.__futex, INT_MAX,
+                   // XYZ check mutex flag
+                   LLL_SHARED);
 
   /* Get the mutex before returning unless asynchronous cancellation
      is in effect.  */
@@ -146,7 +150,9 @@ __pthread_cond_wait (cond, mutex)
       cbuffer.oldtype = __pthread_enable_asynccancel ();
 
       /* Wait until woken by signal or broadcast.  */
-      lll_futex_wait (&cond->__data.__futex, futex_val);
+      lll_futex_wait (&cond->__data.__futex, futex_val,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
 
       /* Disable asynchronous cancellation.  */
       __pthread_disable_asynccancel (cbuffer.oldtype);
@@ -175,7 +181,9 @@ __pthread_cond_wait (cond, mutex)
      and it can be successfully destroyed.  */
   if (cond->__data.__total_seq == -1ULL
       && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-    lll_futex_wake (&cond->__data.__nwaiters, 1);
+    lll_futex_wake (&cond->__data.__nwaiters, 1,
+                   // XYZ check mutex flag
+                   LLL_SHARED);
 
   /* We are done with the condvar.  */
   lll_mutex_unlock (cond->__data.__lock);
index 79729ce..b1f852d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -385,7 +385,7 @@ 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
-       lll_futex_wait (&pd->setxid_futex, 0);
+       lll_private_futex_wait (&pd->setxid_futex, 0);
       while (pd->cancelhandling & SETXID_BITMASK);
 
       /* Reset the value so that the stack can be reused.  */
index 1c3ee4f..a17013b 100644 (file)
@@ -408,7 +408,9 @@ __pthread_mutex_lock (mutex)
                  break;
 
                if (oldval != ceilval)
-                 lll_futex_wait (&mutex->__data.__lock, ceilval | 2);
+                 lll_futex_wait (&mutex->__data.__lock, ceilval | 2,
+                                 // XYZ check mutex flag
+                                 LLL_SHARED);
              }
            while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
                                                        ceilval | 2, ceilval)
index cd13d1c..301fb63 100644 (file)
@@ -1,5 +1,5 @@
 /* Set current priority ceiling of pthread_mutex_t.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
 
@@ -80,7 +80,9 @@ pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling)
              break;
 
            if (oldval != ceilval)
-             lll_futex_wait (&mutex->__data.__lock, ceilval | 2);
+             lll_futex_wait (&mutex->__data.__lock, ceilval | 2,
+                             // XYZ check mutex flag
+                             LLL_SHARED);
          }
        while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
                                                    ceilval | 2, ceilval)
@@ -110,7 +112,9 @@ pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling)
                         | (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT);
   atomic_full_barrier ();
 
-  lll_futex_wake (&mutex->__data.__lock, INT_MAX);
+  lll_futex_wake (&mutex->__data.__lock, INT_MAX,
+                 // XYZ check mutex flag
+                 LLL_SHARED);
 
   return 0;
 }
index 8fd681c..74504e4 100644 (file)
@@ -441,7 +441,9 @@ pthread_mutex_timedlock (mutex, abstime)
                      }
 
                    lll_futex_timed_wait (&mutex->__data.__lock,
-                                         ceilval | 2, &rt);
+                                         ceilval | 2, &rt,
+                                         // XYZ check mutex flag
+                                         LLL_SHARED);
                  }
              }
            while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
index 33919d6..1e6b276 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -240,7 +240,9 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
                                                   newval, oldval));
 
       if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)
-       lll_futex_wake (&mutex->__data.__lock, 1);
+       lll_futex_wake (&mutex->__data.__lock, 1,
+                       // XYZ check mutex flag
+                       LLL_SHARED);
 
       int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
       return __pthread_tpp_change_priority (oldprio, -1);
index caff589..654d628 100644 (file)
@@ -114,7 +114,9 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
 
       /* Wait for the writer to finish.  */
       err = lll_futex_timed_wait (&rwlock->__data.__readers_wakeup,
-                                 waitval, &rt);
+                                 waitval, &rt,
+                                 // XYZ check mutex flag
+                                 LLL_SHARED);
 
       /* Get the lock.  */
       lll_mutex_lock (rwlock->__data.__lock);
index 97c0598..354beb0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -104,7 +104,9 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
 
       /* Wait for the writer or reader(s) to finish.  */
       err = lll_futex_timed_wait (&rwlock->__data.__writer_wakeup,
-                                 waitval, &rt);
+                                 waitval, &rt,
+                                 // XYZ check mutex flag
+                                 LLL_SHARED);
 
       /* Get the lock.  */
       lll_mutex_lock (rwlock->__data.__lock);
index 9cae8b6..87a77a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -38,14 +38,18 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
        {
          ++rwlock->__data.__writer_wakeup;
          lll_mutex_unlock (rwlock->__data.__lock);
-         lll_futex_wake (&rwlock->__data.__writer_wakeup, 1);
+         lll_futex_wake (&rwlock->__data.__writer_wakeup, 1,
+                         // XYZ check mutex flag
+                         LLL_SHARED);
          return 0;
        }
       else if (rwlock->__data.__nr_readers_queued)
        {
          ++rwlock->__data.__readers_wakeup;
          lll_mutex_unlock (rwlock->__data.__lock);
-         lll_futex_wake (&rwlock->__data.__readers_wakeup, INT_MAX);
+         lll_futex_wake (&rwlock->__data.__readers_wakeup, INT_MAX,
+                         // XYZ check mutex flag
+                         LLL_SHARED);
          return 0;
        }
     }
index 64ddcd5..388a399 100644 (file)
@@ -131,7 +131,7 @@ typedef struct
        = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,             \
                               THREAD_GSCOPE_FLAG_UNUSED);                   \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                 \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);        \
     }                                                                       \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index 7d3c5f9..1ffd4cf 100644 (file)
@@ -449,7 +449,7 @@ union user_desc_init
                    : "i" (offsetof (struct pthread, header.gscope_flag)),    \
                      "0" (THREAD_GSCOPE_FLAG_UNUSED));                       \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                  \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                 \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);         \
     }                                                                        \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index a144c28..a5b7b76 100644 (file)
@@ -173,7 +173,7 @@ register struct pthread *__thread_self __asm__("r13");
        = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,             \
                               THREAD_GSCOPE_FLAG_UNUSED);                   \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                 \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);        \
     }                                                                       \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index bd9c99e..06c60e8 100644 (file)
@@ -190,7 +190,7 @@ register void *__thread_register __asm__ ("r13");
        = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,             \
                               THREAD_GSCOPE_FLAG_UNUSED);                   \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                 \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);        \
     }                                                                       \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index c5a11f4..25ab74e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@
 #define AIO_MISC_NOTIFY(waitlist) \
   do {                                                                       \
     if (*waitlist->counterp > 0 && --*waitlist->counterp == 0)               \
-      lll_futex_wake (waitlist->counterp, 1);                                \
+      lll_private_futex_wake (waitlist->counterp, 1);                        \
   } while (0)
 
 #define AIO_MISC_WAIT(result, futex, timeout, cancel)                        \
@@ -49,7 +49,8 @@
        int status;                                                           \
        do                                                                    \
          {                                                                   \
-           status = lll_futex_timed_wait (futexaddr, oldval, timeout);       \
+           status = lll_private_futex_timed_wait (futexaddr, oldval,         \
+                                                  timeout);                  \
            if (status != -EWOULDBLOCK)                                       \
              break;                                                          \
                                                                              \
index 9f6a73d..5f69900 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@
 #define GAI_MISC_NOTIFY(waitlist) \
   do {                                                                       \
     if (*waitlist->counterp > 0 && --*waitlist->counterp == 0)               \
-      lll_futex_wake (waitlist->counterp, 1);                                \
+      lll_private_futex_wake (waitlist->counterp, 1);                        \
   } while (0)
 
 #define GAI_MISC_WAIT(result, futex, timeout, cancel) \
@@ -50,7 +50,8 @@
        int status;                                                           \
        do                                                                    \
          {                                                                   \
-           status = lll_futex_timed_wait (futexaddr, oldval, timeout);       \
+           status = lll_private_futex_timed_wait (futexaddr, oldval,         \
+                                                  timeout);                  \
            if (status != -EWOULDBLOCK)                                       \
              break;                                                          \
                                                                              \
index de8a81b..f10db8f 100644 (file)
@@ -183,7 +183,7 @@ typedef struct
        = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,             \
                               THREAD_GSCOPE_FLAG_UNUSED);                   \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                 \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);        \
     }                                                                       \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index 6d6eff6..07bab4f 100644 (file)
@@ -160,7 +160,7 @@ typedef struct
        = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,             \
                               THREAD_GSCOPE_FLAG_UNUSED);                   \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                 \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);        \
     }                                                                       \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index 60e52fd..788c974 100644 (file)
@@ -151,7 +151,7 @@ register struct pthread *__thread_self __asm__("%g7");
        = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,             \
                               THREAD_GSCOPE_FLAG_UNUSED);                   \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                 \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);        \
     }                                                                       \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \
index 98bb237..c6dadb5 100644 (file)
@@ -203,7 +203,7 @@ __libc_fork (void)
 
          if (atomic_decrement_and_test (&allp->handler->refcntr)
              && allp->handler->need_signal)
-           lll_futex_wake (allp->handler->refcntr, 1);
+           lll_private_futex_wake (allp->handler->refcntr, 1);
 
          allp = allp->next;
        }
index 38d7888..ab7f605 100644 (file)
@@ -31,7 +31,9 @@ __lll_lock_wait (int *futex)
     {
       int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
       if (oldval != 0)
-       lll_futex_wait (futex, 2);
+       lll_futex_wait (futex, 2,
+                       // XYZ check mutex flag
+                       LLL_SHARED);
     }
   while (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0);
 }
@@ -68,7 +70,9 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime)
       /* Wait.  */
       int oldval = atomic_compare_and_exchange_val_acq (futex, 2, 1);
       if (oldval != 0)
-       lll_futex_timed_wait (futex, 2, &rt);
+       lll_futex_timed_wait (futex, 2, &rt,
+                             // XYZ check mutex flag
+                             LLL_SHARED);
     }
   while (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0);
 
@@ -108,8 +112,9 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime)
       if (rt.tv_sec < 0)
        return ETIMEDOUT;
 
-      /* Wait until thread terminates.  */
-      if (lll_futex_timed_wait (tidp, tid, &rt) == -ETIMEDOUT)
+      /* Wait until thread terminates.  The kernel so far does not use
+        the private futex operations for this.  */
+      if (lll_futex_timed_wait (tidp, tid, &rt, LLL_SHARED) == -ETIMEDOUT)
        return ETIMEDOUT;
     }
 
index 30ef991..54cee08 100644 (file)
@@ -44,7 +44,9 @@ __lll_robust_lock_wait (int *futex)
          && atomic_compare_and_exchange_bool_acq (futex, newval, oldval))
        continue;
 
-      lll_futex_wait (futex, newval);
+      lll_futex_wait (futex, newval,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
 
     try:
       ;
@@ -100,7 +102,9 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime)
          && atomic_compare_and_exchange_bool_acq (futex, newval, oldval))
        continue;
 
-      lll_futex_timed_wait (futex, newval, &rt);
+      lll_futex_timed_wait (futex, newval, &rt,
+                           // XYZ check mutex flag
+                           LLL_SHARED);
 
     try:
       ;
index 6b3d368..e805b63 100644 (file)
@@ -1,5 +1,5 @@
 /* Defintions for lowlevel handling in ld.so.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -76,7 +76,7 @@ typedef int __rtld_mrlock_t;
            atomic_or (&(lock), __RTLD_MRLOCK_RWAIT);                         \
            oldval |= __RTLD_MRLOCK_RWAIT;                                    \
          }                                                                   \
-       lll_futex_wait (lock, oldval);                                        \
+       lll_private_futex_wait (lock, oldval);                                \
       }                                                                              \
   out:;                                                                              \
   } while (0)
@@ -90,7 +90,7 @@ typedef int __rtld_mrlock_t;
                          == (__RTLD_MRLOCK_INC | __RTLD_MRLOCK_WWAIT), 0))   \
       /* We have to wake all threads since there might be some queued        \
         readers already.  */                                                 \
-      lll_futex_wake (&(lock), 0x7fffffff);                                  \
+      lll_private_futex_wake (&(lock), 0x7fffffff);                          \
   } while (0)
 
 
@@ -119,7 +119,7 @@ typedef int __rtld_mrlock_t;
          }                                                                   \
        atomic_or (&(lock), __RTLD_MRLOCK_WWAIT);                             \
        oldval |= __RTLD_MRLOCK_WWAIT;                                        \
-       lll_futex_wait (lock, oldval);                                        \
+       lll_private_futex_wait (lock, oldval);                                \
       }                                                                              \
   out:;                                                                              \
   } while (0)
@@ -129,7 +129,7 @@ typedef int __rtld_mrlock_t;
   do {                          \
     int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_WRITER);    \
     if (__builtin_expect ((oldval & __RTLD_MRLOCK_RWAIT) != 0, 0))           \
-      lll_futex_wake (&(lock), 0x7fffffff);                                  \
+      lll_private_futex_wake (&(lock), 0x7fffffff);                          \
   } while (0)
 
 
@@ -142,12 +142,12 @@ typedef int __rtld_mrlock_t;
        int val = word;                                                       \
        if (val == 0)                                                         \
          break;                                                              \
-       lll_futex_wait (&(word), val);                                        \
+       lll_private_futex_wait (&(word), val);                                \
       }                                                                              \
   } while (0)
 
 
 #define __rtld_notify(word) \
-  lll_futex_wake (&(word), 1)
+  lll_private_futex_wake (&(word), 1)
 
 #endif
index f8bc695..7f90325 100644 (file)
@@ -35,7 +35,9 @@ __new_sem_post (sem_t *sem)
   atomic_full_barrier ();
   if (isem->nwaiters > 0)
     {
-      int err = lll_futex_wake (&isem->value, 1);
+      int err = lll_futex_wake (&isem->value, 1,
+                               // XYZ check mutex flag
+                               LLL_SHARED);
       if (__builtin_expect (err, 0) < 0)
        {
          __set_errno (-err);
@@ -55,7 +57,8 @@ __old_sem_post (sem_t *sem)
   int *futex = (int *) sem;
 
   int nr = atomic_increment_val (futex);
-  int err = lll_futex_wake (futex, 1);
+  /* We always have to assume it is a shared semaphore.  */
+  int err = lll_futex_wake (futex, 1, LLL_SHARED);
   if (__builtin_expect (err, 0) < 0)
     {
       __set_errno (-err);
index 4c8acd0..8f92d78 100644 (file)
@@ -84,7 +84,9 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
       /* Enable asynchronous cancellation.  Required by the standard.  */
       int oldtype = __pthread_enable_asynccancel ();
 
-      err = lll_futex_timed_wait (&isem->value, 0, &rt);
+      err = lll_futex_timed_wait (&isem->value, 0, &rt,
+                                 // XYZ check mutex flag
+                                 LLL_SHARED);
 
       /* Disable asynchronous cancellation.  */
       __pthread_disable_asynccancel (oldtype);
index 05114c9..12f3f16 100644 (file)
@@ -56,7 +56,9 @@ __new_sem_wait (sem_t *sem)
       /* Enable asynchronous cancellation.  Required by the standard.  */
       int oldtype = __pthread_enable_asynccancel ();
 
-      err = lll_futex_wait (&isem->value, 0);
+      err = lll_futex_wait (&isem->value, 0,
+                           // XYZ check mutex flag
+                           LLL_SHARED);
 
       /* Disable asynchronous cancellation.  */
       __pthread_disable_asynccancel (oldtype);
@@ -100,7 +102,8 @@ __old_sem_wait (sem_t *sem)
       /* Enable asynchronous cancellation.  Required by the standard.  */
       int oldtype = __pthread_enable_asynccancel ();
 
-      err = lll_futex_wait (futex, 0);
+      /* Always assume the semaphore is shared.  */
+      err = lll_futex_wait (futex, 0, LLL_SHARED);
 
       /* Disable asynchronous cancellation.  */
       __pthread_disable_asynccancel (oldtype);
index 3b07cc1..83fedef 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -30,7 +30,7 @@ clear_once_control (void *arg)
   pthread_once_t *once_control = (pthread_once_t *) arg;
 
   *once_control = 0;
-  lll_futex_wake (once_control, INT_MAX);
+  lll_private_futex_wake (once_control, INT_MAX);
 }
 
 
@@ -84,7 +84,7 @@ __pthread_once (once_control, init_routine)
       atomic_increment (once_control);
 
       /* Wake up all other threads.  */
-      lll_futex_wake (once_control, INT_MAX);
+      lll_private_futex_wake (once_control, INT_MAX);
       break;
     }
 
index 4dfd11d..868e0d2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -52,7 +52,9 @@ pthread_barrier_wait (barrier)
       ++ibarrier->b.curr_event;
 
       /* Wake up everybody.  */
-      lll_futex_wake (&ibarrier->b.curr_event, INT_MAX);
+      lll_futex_wake (&ibarrier->b.curr_event, INT_MAX,
+                     // XYZ check mutex flag
+                     LLL_SHARED);
 
       /* This is the thread which finished the serialization.  */
       result = PTHREAD_BARRIER_SERIAL_THREAD;
@@ -68,7 +70,9 @@ pthread_barrier_wait (barrier)
 
       /* Wait for the event counter of the barrier to change.  */
       do
-       lll_futex_wait (&ibarrier->b.curr_event, event);
+       lll_futex_wait (&ibarrier->b.curr_event, event,
+                       // XYZ check mutex flag
+                       LLL_SHARED);
       while (event == ibarrier->b.curr_event);
     }
 
index be1cc60..527aedf 100644 (file)
@@ -1,5 +1,5 @@
 /* sem_post -- post to a POSIX semaphore.  SPARC version.
-   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -39,7 +39,9 @@ __new_sem_post (sem_t *sem)
       nr = ++*futex;
       __sparc32_atomic_do_unlock24 (futex + 1);
     }
-  int err = lll_futex_wake (futex, nr);
+  int err = lll_futex_wake (futex, nr,
+                           // XYZ check mutex flag
+                           LLL_SHARED);
   if (__builtin_expect (err, 0) < 0)
     {
       __set_errno (-err);
index 964f5b7..240ce59 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -104,7 +104,7 @@ __unregister_atfork (dso_handle)
       atomic_decrement (&deleted->handler->refcntr);
       unsigned int val;
       while ((val = deleted->handler->refcntr) != 0)
-       lll_futex_wait (&deleted->handler->refcntr, val);
+       lll_private_futex_wait (&deleted->handler->refcntr, val);
 
       deleted = deleted->next;
     }
index f353252..029848a 100644 (file)
@@ -355,7 +355,7 @@ typedef struct
                    : "i" (offsetof (struct pthread, header.gscope_flag)),    \
                      "0" (THREAD_GSCOPE_FLAG_UNUSED));                       \
       if (__res == THREAD_GSCOPE_FLAG_WAIT)                                  \
-       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1);                 \
+       lll_private_futex_wake (&THREAD_SELF->header.gscope_flag, 1);         \
     }                                                                        \
   while (0)
 #define THREAD_GSCOPE_SET_FLAG() \