patches/glibc/ports-2.6.1/120-lll_lock_t.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
parent 748 61cd4eb6034d
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
     1 Propagate the patch from base glibc that changes lll_lock_t into a plain int,
     2 without using a typedef, as glibc-2.7 now does.
     3 
     4 diff -durN glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
     5 --- glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h	2006-08-04 20:56:15.000000000 +0200
     6 +++ glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h	2008-07-28 23:49:29.000000000 +0200
     7 @@ -260,9 +260,6 @@
     8  /* Our internal lock implementation is identical to the binary-compatible
     9     mutex implementation. */
    10  
    11 -/* Type for lock object.  */
    12 -typedef int lll_lock_t;
    13 -
    14  /* Initializers for lock.  */
    15  #define LLL_LOCK_INITIALIZER		(0)
    16  #define LLL_LOCK_INITIALIZER_LOCKED	(1)
    17 diff -durN glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c
    18 --- glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c	2006-07-14 15:51:24.000000000 +0200
    19 +++ glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c	2008-07-28 23:49:56.000000000 +0200
    20 @@ -25,7 +25,7 @@
    21  
    22  
    23  void
    24 -__lll_lock_wait (lll_lock_t *futex)
    25 +__lll_lock_wait (int *futex)
    26  {
    27    do
    28      {
    29 @@ -38,7 +38,7 @@
    30  
    31  
    32  int
    33 -__lll_timedlock_wait (lll_lock_t *futex, const struct timespec *abstime)
    34 +__lll_timedlock_wait (int *futex, const struct timespec *abstime)
    35  {
    36    /* Reject invalid timeouts.  */
    37    if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
    38 @@ -78,7 +78,7 @@
    39  /* These don't get included in libc.so  */
    40  #ifdef IS_IN_libpthread
    41  int
    42 -lll_unlock_wake_cb (lll_lock_t *futex)
    43 +lll_unlock_wake_cb (int *futex)
    44  {
    45    int val = atomic_exchange_rel (futex, 0);
    46  
    47 diff -durN glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
    48 --- glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h	2006-09-07 18:34:43.000000000 +0200
    49 +++ glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h	2008-07-28 23:50:54.000000000 +0200
    50 @@ -43,11 +43,6 @@
    51  /* Initialize locks to zero.  */
    52  #define LLL_MUTEX_LOCK_INITIALIZER (0)
    53  
    54 -
    55 -/* Type for lock object.  */
    56 -typedef int lll_lock_t;
    57 -
    58 -
    59  #define lll_futex_wait(futexp, val) \
    60    ({									      \
    61      INTERNAL_SYSCALL_DECL (__err);					      \
    62 @@ -108,7 +103,7 @@
    63    })
    64  
    65  static inline int __attribute__((always_inline))
    66 -__lll_mutex_trylock(lll_lock_t *futex)
    67 +__lll_mutex_trylock(int *futex)
    68  {
    69    return atomic_compare_and_exchange_val_acq (futex, 1, 0) != 0;
    70  }
    71 @@ -124,17 +119,17 @@
    72  
    73  
    74  static inline int __attribute__((always_inline))
    75 -__lll_mutex_cond_trylock(lll_lock_t *futex)
    76 +__lll_mutex_cond_trylock(int *futex)
    77  {
    78    return atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0;
    79  }
    80  #define lll_mutex_cond_trylock(lock)	__lll_mutex_cond_trylock (&(lock))
    81  
    82  
    83 -extern void __lll_lock_wait (lll_lock_t *futex) attribute_hidden;
    84 +extern void __lll_lock_wait (int *futex) attribute_hidden;
    85  
    86  static inline void __attribute__((always_inline))
    87 -__lll_mutex_lock(lll_lock_t *futex)
    88 +__lll_mutex_lock(int *futex)
    89  {
    90    if (atomic_compare_and_exchange_bool_acq (futex, 1, 0) != 0)
    91      __lll_lock_wait (futex);
    92 @@ -155,7 +150,7 @@
    93    __lll_robust_mutex_lock (&(futex), id)
    94  
    95  static inline void __attribute__ ((always_inline))
    96 -__lll_mutex_cond_lock (lll_lock_t *futex)
    97 +__lll_mutex_cond_lock (int *futex)
    98  {
    99    if (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0)
   100      __lll_lock_wait (futex);
   101 @@ -167,13 +162,13 @@
   102    __lll_robust_mutex_lock (&(futex), (id) | FUTEX_WAITERS)
   103  
   104  
   105 -extern int __lll_timedlock_wait (lll_lock_t *futex, const struct timespec *)
   106 +extern int __lll_timedlock_wait (int *futex, const struct timespec *)
   107  	attribute_hidden;
   108  extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *)
   109  	attribute_hidden;
   110  
   111  static inline int __attribute__ ((always_inline))
   112 -__lll_mutex_timedlock (lll_lock_t *futex, const struct timespec *abstime)
   113 +__lll_mutex_timedlock (int *futex, const struct timespec *abstime)
   114  {
   115    int result = 0;
   116    if (atomic_compare_and_exchange_bool_acq (futex, 1, 0) != 0)
   117 @@ -197,7 +192,7 @@
   118  
   119  
   120  static inline void __attribute__ ((always_inline))
   121 -__lll_mutex_unlock (lll_lock_t *futex)
   122 +__lll_mutex_unlock (int *futex)
   123  {
   124    int val = atomic_exchange_rel (futex, 0);
   125    if (__builtin_expect (val > 1, 0))
   126 @@ -218,7 +213,7 @@
   127  
   128  
   129  static inline void __attribute__ ((always_inline))
   130 -__lll_mutex_unlock_force (lll_lock_t *futex)
   131 +__lll_mutex_unlock_force (int *futex)
   132  {
   133    (void) atomic_exchange_rel (futex, 0);
   134    lll_futex_wake (futex, 1);
   135 @@ -239,7 +234,7 @@
   136  #define THREAD_INIT_LOCK(PD, LOCK) \
   137    (PD)->LOCK = LLL_LOCK_INITIALIZER
   138  
   139 -extern int lll_unlock_wake_cb (lll_lock_t *__futex) attribute_hidden;
   140 +extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
   141  
   142  /* The states of a lock are:
   143      0  -  untaken
   144 diff -durN glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
   145 --- glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h	2006-08-04 20:54:56.000000000 +0200
   146 +++ glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h	2008-07-28 23:51:14.000000000 +0200
   147 @@ -227,9 +227,6 @@
   148  /* Our internal lock implementation is identical to the binary-compatible
   149     mutex implementation. */
   150  
   151 -/* Type for lock object.  */
   152 -typedef int lll_lock_t;
   153 -
   154  /* Initializers for lock.  */
   155  #define LLL_LOCK_INITIALIZER		(0)
   156  #define LLL_LOCK_INITIALIZER_LOCKED	(1)