diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2003-09-22 21:30:25 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2003-09-22 21:30:25 +0000 |
| commit | 39358e8b2bbf78b3ee50027abcd12837473b5f9f (patch) | |
| tree | c579eb3fe367bd09bf4c07e9dfa6060c1f3bb79c | |
| parent | c0df57e1ce270466be342d9998f72633764b22dc (diff) | |
| download | glibc-39358e8b2bbf78b3ee50027abcd12837473b5f9f.tar.xz glibc-39358e8b2bbf78b3ee50027abcd12837473b5f9f.zip | |
Update.
2003-09-22 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/lowlevellock.c (__lll_timedlock_wait): Use
lll_futex_timed_wait instead of lll_futex_wait.
* sysdeps/unix/sysv/linux/s390/lowlevellock.c: Removed.
* sysdeps/unix/sysv/linux/s390/lowlevelmutex.c: Removed.
* sysdeps/unix/sysv/linux/s390/libc-lowlevellock.c: Removed.
* sysdeps/unix/sysv/linux/s390/libc-lowlevelmutex.c: Removed.
* sysdeps/unix/sysv/linux/s390/sem_trywait.c: Removed.
* sysdeps/unix/sysv/linux/s390/sem_wait.c: Removed.
* sysdeps/unix/sysv/linux/s390/sem_post.c: Removed.
* sysdeps/unix/sysv/linux/s390/sem_timedwait.c: Removed.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Include atomic.h.
Completely revamp the locking macros. No distinction between
normal and mutex locking anymore.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (__lll_lock_wait,
__lll_lock_timedwait): Fix prototypes.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (__lll_lock_wait,
__lll_lock_timedwait): Likewise.
(lll_mutex_lock, lll_mutex_cond_lock): Use _val instead of _bool
macros, add __builtin_expect.
(lll_mutex_timedlock): Likewise. Fix return value.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/i386/i586/libc-lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/i386/i586/lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/i386/i686/libc-lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/i386/i686/lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/lowlevelmutex.c: Removed.
* sysdeps/unix/sysv/linux/libc-lowlevelmutex.c: Removed.
24 files changed, 86 insertions, 737 deletions
diff --git a/include/atomic.h b/include/atomic.h index 299f196e25..092b6e00a3 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -71,8 +71,8 @@ #ifndef atomic_compare_and_exchange_val_rel -# define atomic_compare_and_exchange_val_rel(mem, oldval, newval) \ - atomic_compare_and_exchange_val_acq (mem, oldval, newval) +# define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \ + atomic_compare_and_exchange_val_acq (mem, newval, oldval) #endif @@ -95,8 +95,8 @@ #ifndef atomic_compare_and_exchange_bool_rel -# define atomic_compare_and_exchange_bool_rel(mem, oldval, newval) \ - atomic_compare_and_exchange_bool_acq (mem, oldval, newval) +# define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \ + atomic_compare_and_exchange_bool_acq (mem, newval, oldval) #endif diff --git a/nptl/ChangeLog b/nptl/ChangeLog index e74dec5c36..eb32fe193e 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,35 @@ +2003-09-22 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/unix/sysv/linux/lowlevellock.c (__lll_timedlock_wait): Use + lll_futex_timed_wait instead of lll_futex_wait. + * sysdeps/unix/sysv/linux/s390/lowlevellock.c: Removed. + * sysdeps/unix/sysv/linux/s390/lowlevelmutex.c: Removed. + * sysdeps/unix/sysv/linux/s390/libc-lowlevellock.c: Removed. + * sysdeps/unix/sysv/linux/s390/libc-lowlevelmutex.c: Removed. + * sysdeps/unix/sysv/linux/s390/sem_trywait.c: Removed. + * sysdeps/unix/sysv/linux/s390/sem_wait.c: Removed. + * sysdeps/unix/sysv/linux/s390/sem_post.c: Removed. + * sysdeps/unix/sysv/linux/s390/sem_timedwait.c: Removed. + * sysdeps/unix/sysv/linux/s390/lowlevellock.h: Include atomic.h. + Completely revamp the locking macros. No distinction between + normal and mutex locking anymore. + * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/ia64/lowlevellock.h (__lll_lock_wait, + __lll_lock_timedwait): Fix prototypes. + * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (__lll_lock_wait, + __lll_lock_timedwait): Likewise. + (lll_mutex_lock, lll_mutex_cond_lock): Use _val instead of _bool + macros, add __builtin_expect. + (lll_mutex_timedlock): Likewise. Fix return value. + * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S: Removed. + * sysdeps/unix/sysv/linux/i386/i586/libc-lowlevelmutex.S: Removed. + * sysdeps/unix/sysv/linux/i386/i586/lowlevelmutex.S: Removed. + * sysdeps/unix/sysv/linux/i386/i686/libc-lowlevelmutex.S: Removed. + * sysdeps/unix/sysv/linux/i386/i686/lowlevelmutex.S: Removed. + * sysdeps/unix/sysv/linux/x86_64/libc-lowlevelmutex.S: Removed. + * sysdeps/unix/sysv/linux/lowlevelmutex.c: Removed. + * sysdeps/unix/sysv/linux/libc-lowlevelmutex.c: Removed. + 2003-09-22 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S deleted file mode 100644 index 8b6bff4761..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* In libc.so we do not unconditionally use the lock prefix. Only if - the application is using threads. */ -#ifndef UP -# define LOCK \ - cmpl $0, %gs:MULTIPLE_THREADS_OFFSET; \ - je,pt 0f; \ - lock; \ -0: -#endif - -#include "lowlevelmutex.S" diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i586/libc-lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i586/libc-lowlevelmutex.S deleted file mode 100644 index 7c24ed1d3c..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/i386/i586/libc-lowlevelmutex.S +++ /dev/null @@ -1 +0,0 @@ -#include "../i486/libc-lowlevelmutex.S" diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i586/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i586/lowlevelmutex.S deleted file mode 100644 index 50481991ff..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/i386/i586/lowlevelmutex.S +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include "../i486/lowlevelmutex.S" diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i686/libc-lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i686/libc-lowlevelmutex.S deleted file mode 100644 index 7c24ed1d3c..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/i386/i686/libc-lowlevelmutex.S +++ /dev/null @@ -1 +0,0 @@ -#include "../i486/libc-lowlevelmutex.S" diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i686/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i686/lowlevelmutex.S deleted file mode 100644 index 50481991ff..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/i386/i686/lowlevelmutex.S +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include "../i486/lowlevelmutex.S" diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h index b30659fe90..d068b06894 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h @@ -120,7 +120,7 @@ __lll_mutex_trylock (int *futex) #define lll_mutex_trylock(futex) __lll_mutex_trylock (&(futex)) -extern void __lll_lock_wait (int *futex, int val) attribute_hidden; +extern void __lll_lock_wait (int *futex) attribute_hidden; static inline void @@ -143,7 +143,7 @@ __lll_mutex_cond_lock (int *futex) #define lll_mutex_cond_lock(futex) __lll_mutex_cond_lock (&(futex)) -extern int __lll_timedlock_wait (int *futex, int val, const struct timespec *) +extern int __lll_timedlock_wait (int *futex, const struct timespec *) attribute_hidden; diff --git a/nptl/sysdeps/unix/sysv/linux/libc-lowlevelmutex.c b/nptl/sysdeps/unix/sysv/linux/libc-lowlevelmutex.c deleted file mode 100644 index 7c594e3470..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/libc-lowlevelmutex.c +++ /dev/null @@ -1 +0,0 @@ -/* Nothing needed here in fact. */ diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c index 5021cdf4ba..932e27300f 100644 --- a/nptl/sysdeps/unix/sysv/linux/lowlevellock.c +++ b/nptl/sysdeps/unix/sysv/linux/lowlevellock.c @@ -68,7 +68,7 @@ __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_wait (futex, 2); + lll_futex_timed_wait (futex, 2, &rt); } while (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0); diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelmutex.c b/nptl/sysdeps/unix/sysv/linux/lowlevelmutex.c deleted file mode 100644 index 7c594e3470..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/lowlevelmutex.c +++ /dev/null @@ -1 +0,0 @@ -/* Nothing needed here in fact. */ diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h index 0caee0cd1f..a715879dbd 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h @@ -101,30 +101,35 @@ #define lll_mutex_trylock(lock) __lll_trylock (&(lock)) -extern void __lll_lock_wait (int *futex, int val) attribute_hidden; +extern void __lll_lock_wait (int *futex) attribute_hidden; #define lll_mutex_lock(lock) \ (void) ({ \ int *__futex = &(lock); \ - if (atomic_compare_and_exchange_bool_acq (__futex, 1, 0) != 0) \ + if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 1, 0),\ + 0) != 0) \ __lll_lock_wait (__futex); \ }) #define lll_mutex_cond_lock(lock) \ (void) ({ \ int *__futex = &(lock); \ - if (atomic_compare_and_exchange_bool_acq (__futex, 2, 0) != 0) \ + if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 2, 0),\ + 0) != 0) \ __lll_lock_wait (__futex); \ }) extern int __lll_timedlock_wait - (int *futex, int val, const struct timespec *) attribute_hidden; + (int *futex, const struct timespec *) attribute_hidden; #define lll_mutex_timedlock(lock, abstime) \ - (void) ({ \ + ({ \ int *__futex = &(lock); \ - if (atomic_compare_and_exchange_bool_acq (__futex, 1, 0) != 0) \ - __lll_timedlock_wait (__futex, abstime); \ + int __val = 0; \ + if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 1, 0),\ + 0) != 0) \ + __val = __lll_timedlock_wait (__futex, abstime); \ + __val; \ }) #define lll_mutex_unlock(lock) \ diff --git a/nptl/sysdeps/unix/sysv/linux/s390/libc-lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/s390/libc-lowlevellock.c deleted file mode 100644 index 085ee30188..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/s390/libc-lowlevellock.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sysdep.h> -#include <lowlevellock.h> -#include <sys/time.h> - - -void -___lll_lock (futex, newval) - int *futex; - int newval; -{ - do - { - int oldval; - - lll_futex_wait (futex, newval); - lll_compare_and_swap (futex, oldval, newval, "lr %2,%1; ahi %2,-1"); - } - while (newval != 0); - - *futex = -1; -} diff --git a/nptl/sysdeps/unix/sysv/linux/s390/libc-lowlevelmutex.c b/nptl/sysdeps/unix/sysv/linux/s390/libc-lowlevelmutex.c deleted file mode 100644 index 38f11ba3a5..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/s390/libc-lowlevelmutex.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* No difference to lowlevelmutex.c */ -#include "lowlevelmutex.c" diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.c deleted file mode 100644 index 37d885760d..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <sysdep.h> -#include <lowlevellock.h> -#include <sys/time.h> - - -void -___lll_lock (futex, newval) - int *futex; - int newval; -{ - do - { - int oldval; - - lll_futex_wait (futex, newval); - lll_compare_and_swap (futex, oldval, newval, "lr %2,%1; ahi %2,-1"); - } - while (newval != 0); - - *futex = -1; -} - - -int -lll_unlock_wake_cb (futex) - int *futex; -{ - int oldval; - int newval; - - lll_compare_and_swap (futex, oldval, newval, "lr %2,%1; ahi %2,1"); - if (oldval < 0) - lll_futex_wake (futex, 1); - return 0; -} - - -int -___lll_timedwait_tid (ptid, abstime) - int *ptid; - const struct timespec *abstime; -{ - int tid; - - if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) - return EINVAL; - - /* Repeat until thread terminated. */ - while ((tid = *ptid) != 0) - { - /* Get current time. */ - struct timeval tv; - __gettimeofday (&tv, NULL); - - /* Determine relative timeout. */ - struct timespec rt; - rt.tv_sec = abstime->tv_sec - tv.tv_sec; - rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000; |
