aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-01-04 07:58:23 +0000
committerJakub Jelinek <jakub@redhat.com>2006-01-04 07:58:23 +0000
commit04c414477bd220f2c842453314a6dbb928e3c9e6 (patch)
tree8052cfeac9ce6b340d133433674270ad6a293af9
parentUpdated to fedora-glibc-20060102T2114 (diff)
downloadglibc-04c414477bd220f2c842453314a6dbb928e3c9e6.tar.gz
glibc-04c414477bd220f2c842453314a6dbb928e3c9e6.tar.bz2
glibc-04c414477bd220f2c842453314a6dbb928e3c9e6.zip
Updated to fedora-glibc-20060104T0754cvs/fedora-glibc-2_3_90-26
-rw-r--r--ChangeLog71
-rw-r--r--Versions.def1
-rwxr-xr-xconfigure20
-rw-r--r--configure.in8
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in27
-rw-r--r--include/aio.h8
-rw-r--r--nptl/ChangeLog38
-rw-r--r--nptl/sysdeps/pthread/pthread.h10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h25
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c131
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c62
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c100
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_init.c63
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c54
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c117
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c59
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c74
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_init.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_post.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_timedwait.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_trywait.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_wait.c1
-rw-r--r--nscd/connections.c9
-rw-r--r--posix/unistd.h4
-rw-r--r--rt/Versions2
-rw-r--r--rt/tst-aio2.c25
-rwxr-xr-xscripts/check-local-headers.sh3
-rw-r--r--sysdeps/ieee754/bits/nan.h10
-rw-r--r--sysdeps/pthread/Versions5
-rw-r--r--sysdeps/pthread/aio_misc.c5
-rw-r--r--sysdeps/pthread/lio_listio.c77
-rw-r--r--sysdeps/pthread/lio_listio64.c4
-rw-r--r--sysdeps/sparc/sparc32/bits/atomic.h260
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h9
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/bits/atomic.h8
-rw-r--r--sysdeps/sparc/sparc64/bits/atomic.h8
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/brk.c4
41 files changed, 1209 insertions, 104 deletions
diff --git a/ChangeLog b/ChangeLog
index 8387b9374c..1f7fa156c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,74 @@
+2006-01-04 Joseph S. Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/brk.c (__brk): Use
+ __SYSCALL_CLOBBERS.
+
+2006-01-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure.in (HAVE_LIBAUDIT): Check
+ audit_log_user_avc_message instead of audit_log_avc.
+
+2006-01-04 Joseph S. Myers <joseph@codesourcery.com>
+
+ * sysdeps/ieee754/bits/nan.h: Fix typo.
+
+2006-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/m68k/fchownat.c: Include string.h.
+
+ * sysdeps/sparc/sparc32/dl-machine.h (LD_SO_PRELOAD): Remove unused
+ define.
+
+ * sysdeps/sparc/sparc32/bits/atomic.h: Include stdint.h, add
+ {,u}atomic*_t typedefs.
+ (__sparc32_atomic_do_lock): Add __volatile and memory clobber.
+ (__sparc32_atomic_do_unlock): Add memory barrier.
+ (__sparc32_atomic_do_lock24, __sparc32_atomic_do_unlock24): Define.
+ [!SHARED] (__v9_compare_and_exchange_val_32_acq): Define.
+ (__v7_compare_and_exchange_val_acq, __v7_compare_and_exchange_bool_acq,
+ __v7_exchange_acq, __v7_exchange_and_add, __v7_exchange_24_rel,
+ __v7_compare_and_exchange_val_24_acq, __atomic_is_v9,
+ atomic_exchange_acq, atomic_compare_and_exchange_val_24_acq,
+ atomic_exchange_24_rel): Define.
+ [SHARED] (atomic_exchange_and_add): Define.
+ [!SHARED] (__ATOMIC_HWCAP_SPARC_V9): Define.
+ [!SHARED] (_dl_hwcap): New weak decl.
+ * sysdeps/sparc/sparc32/sparcv9/bits/atomic.h (atomic_exchange_24_rel,
+ atomic_compare_and_exchange_val_24_acq): Define.
+ * sysdeps/sparc/sparc64/bits/atomic.h (atomic_exchange_24_rel,
+ atomic_compare_and_exchange_val_24_acq): Define.
+
+2006-01-03 Ulrich Drepper <drepper@redhat.com>
+
+ lio_listio should emit an event for each individual request in
+ addition to the global event.
+ * sysdeps/pthread/lio_listio.c (lio_listio): Renamed to
+ lio_listio_internal. Remove mode parameter check. Only set sigevent
+ type to SIGEV_NONE if LIO_NO_INDIVIDUAL_EVENT is set.
+ (__lio_listio_21): New function. Compatiblity version which sets
+ LIO_NO_INDIVIDUAL_EVENT before calling lio_listio_internal.
+ (__lio_listio_item_notify): New function.
+ * sysdeps/pthread/lio_listio64.c: Define __lio_listio_21 and
+ __lio_listio_item_notify macros.
+ * sysdeps/pthread/Versions: New file.
+ * rt/tst-aio2.c: Adjust test for new semantics of lio_listio.
+ * include/aio.h: Define LIO_NO_INDIVIDUAL_EVENT.
+ * Versions.def: Add GLIBC_2.4 for librt.
+
+ * rt/Versions: Whitespace fix.
+ * sysdeps/pthread/aio_misc.c: Likewise.
+
+ * nscd/connections.c (nscd_init): Remove if block which should
+ have been removed as part of the -S option removal.
+
+2006-01-03 Andreas Jaeger <aj@suse.de>
+
+ * scripts/check-local-headers.sh: Allow $includedir/c++.
+
+2006-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ * posix/unistd.h (ctermid): Remove __nonnull attribute.
+
2006-01-02 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h (PTR_MANGLE,
diff --git a/Versions.def b/Versions.def
index d7be70386e..062a94730d 100644
--- a/Versions.def
+++ b/Versions.def
@@ -95,6 +95,7 @@ librt {
GLIBC_2.3
GLIBC_2.3.3
GLIBC_2.3.4
+ GLIBC_2.4
}
libutil {
GLIBC_2.0
diff --git a/configure b/configure
index d46bb19fb0..224322a62b 100755
--- a/configure
+++ b/configure
@@ -6765,9 +6765,9 @@ _ACEOF
# See if we have the libaudit library
- echo "$as_me:$LINENO: checking for audit_log_avc in -laudit" >&5
-echo $ECHO_N "checking for audit_log_avc in -laudit... $ECHO_C" >&6
-if test "${ac_cv_lib_audit_audit_log_avc+set}" = set; then
+ echo "$as_me:$LINENO: checking for audit_log_user_avc_message in -laudit" >&5
+echo $ECHO_N "checking for audit_log_user_avc_message in -laudit... $ECHO_C" >&6
+if test "${ac_cv_lib_audit_audit_log_user_avc_message+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -6785,11 +6785,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char audit_log_avc ();
+char audit_log_user_avc_message ();
int
main ()
{
-audit_log_avc ();
+audit_log_user_avc_message ();
;
return 0;
}
@@ -6816,20 +6816,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_audit_audit_log_avc=yes
+ ac_cv_lib_audit_audit_log_user_avc_message=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_audit_audit_log_avc=no
+ac_cv_lib_audit_audit_log_user_avc_message=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_audit_audit_log_avc" >&5
-echo "${ECHO_T}$ac_cv_lib_audit_audit_log_avc" >&6
-if test $ac_cv_lib_audit_audit_log_avc = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_audit_audit_log_user_avc_message" >&5
+echo "${ECHO_T}$ac_cv_lib_audit_audit_log_user_avc_message" >&6
+if test $ac_cv_lib_audit_audit_log_user_avc_message = yes; then
have_libaudit=yes
else
have_libaudit=no
diff --git a/configure.in b/configure.in
index 4ae30ae2c9..1199ac00ea 100644
--- a/configure.in
+++ b/configure.in
@@ -1956,13 +1956,13 @@ else
fi
# Check if we're building with SELinux support.
if test "x$have_selinux" = xyes; then
- AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
+ AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
# See if we have the libaudit library
- AC_CHECK_LIB(audit, audit_log_avc,
- have_libaudit=yes, have_libaudit=no)
+ AC_CHECK_LIB(audit, audit_log_user_avc_message,
+ have_libaudit=yes, have_libaudit=no)
if test "x$have_libaudit" = xyes; then
- AC_DEFINE(HAVE_LIBAUDIT,1,[SELinux libaudit support])
+ AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
fi
AC_SUBST(have_libaudit)
fi
diff --git a/fedora/branch.mk b/fedora/branch.mk
index c01b686a25..aff47f5bfa 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-fc4
-fedora-sync-date := 2006-01-02 21:14 UTC
-fedora-sync-tag := fedora-glibc-20060102T2114
+fedora-sync-date := 2006-01-04 07:54 UTC
+fedora-sync-tag := fedora-glibc-20060104T0754
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 7a3c5f2a0e..d0692de3e7 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 25
+%define glibcrelease 26
%define auxarches i586 i686 athlon sparcv9 alphaev6
%define prelinkarches noarch
%define xenarches i686 athlon
@@ -56,8 +56,8 @@ Conflicts: gcc4 <= 4.0.0-0.6
# /etc/default
Conflicts: shadow-utils < 2:4.0.3-20
Conflicts: nscd < 2.3.3-52
-Conflicts: kernel < 2.4.20
-%define enablekernel 2.4.20
+Conflicts: kernel < 2.6.9
+%define enablekernel 2.6.9
%ifarch i386
%define nptl_target_cpu i486
%else
@@ -477,6 +477,7 @@ touch locale/programs/*-kw.h
%build
GCC=gcc
+GXX=g++
%ifarch %{ix86}
BuildFlags="-march=%{_target_cpu}"
%endif
@@ -489,18 +490,22 @@ BuildFlags="-mcpu=ev6"
%ifarch sparc
BuildFlags="-fcall-used-g6"
GCC="gcc -m32"
+GXX="g++ -m32"
%endif
%ifarch sparcv9
BuildFlags="-mcpu=ultrasparc -fcall-used-g6"
GCC="gcc -m32"
+GXX="g++ -m32"
%endif
%ifarch sparc64
BuildFlags="-mcpu=ultrasparc -mvis -fcall-used-g6"
GCC="gcc -m64"
+GXX="g++ -m64"
%endif
%ifarch ppc64
BuildFlags="-mno-minimal-toc"
GCC="gcc -m64"
+GXX="g++ -m64"
%endif
BuildFlags="$BuildFlags -DNDEBUG=1"
@@ -523,7 +528,7 @@ shift
rm -rf $builddir
mkdir $builddir ; cd $builddir
build_CFLAGS="$BuildFlags -g -O3 $*"
-CC="$GCC" CFLAGS="$build_CFLAGS" ../configure --prefix=%{_prefix} \
+CC="$GCC" CXX="$GXX" CFLAGS="$build_CFLAGS" ../configure --prefix=%{_prefix} \
--enable-add-ons=nptl$AddOns --without-cvs $EnableKernel \
--with-headers=%{_prefix}/include --enable-bind-now \
--with-tls --with-__thread --build %{nptl_target_cpu}-redhat-linux \
@@ -604,7 +609,7 @@ rm -f $RPM_BUILD_ROOT/%{_lib}/libNoVersion*
# the generic one (#162634)
cp -a bits/stdio-lock.h $RPM_BUILD_ROOT%{_prefix}/include/bits/stdio-lock.h
# And <bits/libc-lock.h> needs sanitizing as well.
-cp -a redhat/libc-lock.h $RPM_BUILD_ROOT%{_prefix}/include/bits/libc-lock.h
+cp -a fedora/libc-lock.h $RPM_BUILD_ROOT%{_prefix}/include/bits/libc-lock.h
if [ -d $RPM_BUILD_ROOT%{_prefix}/info -a "%{_infodir}" != "%{_prefix}/info" ]; then
mkdir -p $RPM_BUILD_ROOT%{_infodir}
@@ -1117,10 +1122,20 @@ rm -f *.filelist*
%endif
%changelog
+* Wed Jan 4 2006 Jakub Jelinek <jakub@redhat.com> 2.3.90-26
+- update from CVS
+ - for newly linked lio_listio* callers, send per request
+ notifications (#170116)
+ - fixup nscd -S option removal changes (#176860)
+ - remove nonnull attribute from ctermid (#176753)
+ - fix PTHREAD_*_INITIALIZER{,_NP} on 64-bit arches
+ - SPARC NPTL support for pre-v9 CPUs
+- drop support for 2.4.xx and < 2.6.9 kernels
+
* Mon Jan 2 2006 Jakub Jelinek <jakub@redhat.com> 2.3.90-25
- update from CVS
- s390{,x} and sparc{,64} pointer mangling fixes
- - install a sanitized LinuxThreads <bits/libc-lock.h>
+- install a sanitized LinuxThreads <bits/libc-lock.h>
* Mon Jan 2 2006 Jakub Jelinek <jakub@redhat.com> 2.3.90-24
- update from CVS
diff --git a/include/aio.h b/include/aio.h
index e3dc86f99a..be40c0bcef 100644
--- a/include/aio.h
+++ b/include/aio.h
@@ -1,6 +1,12 @@
#ifndef _AIO_H
#include <rt/aio.h>
-/* Now define the internal interfaces. */
+/* Now define the internal interfaces. */
extern void __aio_init (__const struct aioinit *__init);
+
+/* Flag to signal we need to be compatible with glibc < 2.4 in
+ lio_listio and we do not issue events for each individual list
+ element. */
+#define LIO_NO_INDIVIDUAL_EVENT 128
+
#endif
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index fd67f0ff22..3bc50ba637 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,41 @@
+2006-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Remove #error for
+ sparc-linux configured glibc.
+ (lll_futex_wake_unlock): Define to 1 for sparc-linux configured glibc.
+ (__lll_mutex_trylock, __lll_mutex_cond_trylock, __lll_mutex_lock,
+ __lll_mutex_cond_lock, __lll_mutex_timedlock): Use
+ atomic_compare_and_exchange_val_24_acq instead of
+ atomic_compare_and_exchange_val_acq.
+ (lll_mutex_unlock, lll_mutex_unlock_force): Use atomic_exchange_24_rel
+ instead of atomic_exchange_rel.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c: New
+ file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c: New
+ file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sem_init.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c:
+ New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c:
+ New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_init.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_post.c: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_timedwait.c: New
+ file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_trywait.c: New
+ file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_wait.c: New file.
+
+2006-01-03 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/pthread/pthread.h [__WORDSIZE==64]: Don't use cast in
+ mutex initializers.
+
2006-01-02 Jakub Jelinek <jakub@redhat.com>
* sysdeps/sparc/tls.h (tcbhead_t): Add pointer_guard field.
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index 5413661eb3..d887e37aee 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 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
@@ -74,14 +74,14 @@ enum
/* Mutex initializers. */
#if __WORDSIZE == 64
# define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, 0, 0, (void *) 0, (void *) 0 } }
+ { { 0, 0, 0, 0, 0, 0, 0, 0 } }
# ifdef __USE_GNU
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, (void *) 0, (void *) 0 } }
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, 0, 0 } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, (void *) 0, (void *) 0 } }
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, 0, 0 } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, (void *) 0, (void *) 0 } }
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, 0, 0 } }
# endif
#else
# define PTHREAD_MUTEX_INITIALIZER \
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
index 8d12db3a16..ad82aa3ea4 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -79,7 +79,11 @@
})
/* Returns non-zero if error happened, zero if success. */
-#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2) \
+#ifdef __sparc32_atomic_do_lock
+/* Avoid FUTEX_WAKE_OP if supporting pre-v9 CPUs. */
+# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2) 1
+#else
+# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
@@ -90,16 +94,13 @@
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
-
-#ifdef __sparc32_atomic_do_lock
-#error SPARC < v9 does not support compare and swap which is essential for futex based locking
#endif
static inline int
__attribute__ ((always_inline))
__lll_mutex_trylock (int *futex)
{
- return atomic_compare_and_exchange_val_acq (futex, 1, 0) != 0;
+ return atomic_compare_and_exchange_val_24_acq (futex, 1, 0) != 0;
}
#define lll_mutex_trylock(futex) __lll_mutex_trylock (&(futex))
@@ -107,7 +108,7 @@ static inline int
__attribute__ ((always_inline))
__lll_mutex_cond_trylock (int *futex)
{
- return atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0;
+ return atomic_compare_and_exchange_val_24_acq (futex, 2, 0) != 0;
}
#define lll_mutex_cond_trylock(futex) __lll_mutex_cond_trylock (&(futex))
@@ -119,7 +120,7 @@ static inline void
__attribute__ ((always_inline))
__lll_mutex_lock (int *futex)
{
- int val = atomic_compare_and_exchange_val_acq (futex, 1, 0);
+ int val = atomic_compare_and_exchange_val_24_acq (futex, 1, 0);
if (__builtin_expect (val != 0, 0))
__lll_lock_wait (futex);
@@ -131,7 +132,7 @@ static inline void
__attribute__ ((always_inline))
__lll_mutex_cond_lock (int *futex)
{
- int val = atomic_compare_and_exchange_val_acq (futex, 2, 0);
+ int val = atomic_compare_and_exchange_val_24_acq (futex, 2, 0);
if (__builtin_expect (val != 0, 0))
__lll_lock_wait (futex);
@@ -147,7 +148,7 @@ static inline int
__attribute__ ((always_inline))
__lll_mutex_timedlock (int *futex, const struct timespec *abstime)
{
- int val = atomic_compare_and_exchange_val_acq (futex, 1, 0);
+ int val = atomic_compare_and_exchange_val_24_acq (futex, 1, 0);
int result = 0;
if (__builtin_expect (val != 0, 0))
@@ -160,7 +161,7 @@ __lll_mutex_timedlock (int *futex, const struct timespec *abstime)
#define lll_mutex_unlock(lock) \
((void) ({ \
int *__futex = &(lock); \
- int __val = atomic_exchange_rel (__futex, 0); \
+ int __val = atomic_exchange_24_rel (__futex, 0); \
if (__builtin_expect (__val > 1, 0)) \
lll_futex_wake (__futex, 1); \
}))
@@ -168,7 +169,7 @@ __lll_mutex_timedlock (int *futex, const struct timespec *abstime)
#define lll_mutex_unlock_force(lock) \
((void) ({ \
int *__futex = &(lock); \
- (void) atomic_exchange_rel (__futex, 0); \
+ (void) atomic_exchange_24_rel (__futex, 0); \
lll_futex_wake (__futex, 1); \
}))
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
new file mode 100644
index 0000000000..a7611d6a88
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/lowlevellock.c
@@ -0,0 +1,131 @@
+/* low level locking for pthread library. SPARC version.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Paul Mackerras <paulus@au.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_wait (int *futex)
+{
+ do
+ {
+ int oldval = atomic_compare_and_exchange_val_24_acq (futex, 2, 1);
+ if (oldval != 0)
+ lll_futex_wait (futex, 2);
+ }
+ while (atomic_compare_and_exchange_val_24_acq (futex, 2, 0) != 0);
+}
+
+
+int
+__lll_timedlock_wait (int *futex, const struct timespec *abstime)
+{
+ /* Reject invalid timeouts. */
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ return EINVAL;
+
+ do
+ {
+ struct timeval tv;
+ struct timespec rt;
+
+ /* Get the current time. */
+ (void) __gettimeofday (&tv, NULL);
+
+ /* Compute relative timeout. */
+ rt.tv_sec = abstime->tv_sec - tv.tv_sec;
+ rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
+ if (rt.tv_nsec < 0)
+ {
+ rt.tv_nsec += 1000000000;
+ --rt.tv_sec;
+ }
+
+ /* Already timed out? */
+ if (rt.tv_sec < 0)
+ return ETIMEDOUT;
+
+ /* Wait. */
+ int oldval = atomic_compare_and_exchange_val_24_acq (futex, 2, 1);
+ if (oldval != 0)
+ lll_futex_timed_wait (futex, 2, &rt);
+ }
+ while (atomic_compare_and_exchange_val_24_acq (futex, 2, 0) != 0);
+
+ return 0;
+}
+
+
+/* These don't get included in libc.so */
+#ifdef IS_IN_libpthread
+int
+lll_unlock_wake_cb (int *futex)
+{
+ int val = atomic_exchange_24_rel (futex, 0);
+
+ if (__builtin_expect (val > 1, 0))
+ lll_futex_wake (futex, 1);
+
+ return 0;
+}
+
+
+int
+__lll_timedwait_tid (int *tidp, const struct timespec *abstime)
+{
+ int tid;
+
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ return EINVAL;
+
+ /* Repeat until thread terminated. */
+ while ((tid = *tidp) != 0)
+ {
+ struct timeval tv;
+ struct timespec rt;
+
+ /* Get the current time. */
+ (void) __gettimeofday (&tv, NULL);
+
+ /* Compute relative timeout. */
+ rt.tv_sec = abstime->tv_sec - tv.tv_sec;
+ rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
+ if (rt.tv_nsec < 0)
+ {
+ rt.tv_nsec += 1000000000;
+ --rt.tv_sec;
+ }
+
+ /* Already timed out? */
+ if (rt.tv_sec < 0)
+ return ETIMEDOUT;
+
+ /* Wait until thread terminates. */
+ if (lll_futex_timed_wait (tidp, tid, &rt) == -ETIMEDOUT)
+ return ETIMEDOUT;
+ }
+
+ return 0;
+}
+
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c
new file mode 100644
index 0000000000..bbd08d0041
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_init.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2002, 2006 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 <errno.h>
+#include "pthreadP.h"
+#include <lowlevellock.h>
+
+struct sparc_pthread_barrier
+{
+ struct pthread_barrier b;
+ unsigned char left_lock;
+ unsigned char pshared;
+};
+
+int
+pthread_barrier_init (barrier, attr, count)
+ pthread_barrier_t *barrier;
+ const pthread_barrierattr_t *attr;
+ unsigned int count;
+{
+ struct sparc_pthread_barrier *ibarrier;
+
+ if (__builtin_expect (count == 0, 0))
+ return EINVAL;
+
+ struct pthread_barrierattr *iattr = (struct pthread_barrierattr *) attr;
+ if (iattr != NULL)
+ {
+ if (iattr->pshared != PTHREAD_PROCESS_PRIVATE
+ && __builtin_expect (iattr->pshared != PTHREAD_PROCESS_SHARED, 0))
+ /* Invalid attribute. */
+ return EINVAL;
+ }
+
+ ibarrier = (struct sparc_pthread_barrier *) barrier;
+
+ /* Initialize the individual fields. */
+ ibarrier->b.lock = LLL_LOCK_INITIALIZER;
+ ibarrier->b.left = count;
+ ibarrier->b.init_count = count;
+ ibarrier->b.curr_event = 0;
+ ibarrier->left_lock = 0;
+ ibarrier->pshared = (iattr && iattr->pshared == PTHREAD_PROCESS_SHARED);
+
+ return 0;
+}
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
new file mode 100644
index 0000000000..4dfd11dcbe
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2003, 2004, 2006 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 <pthreadP.h>
+
+struct sparc_pthread_barrier
+{
+ struct pthread_barrier b;
+ unsigned char left_lock;
+ unsigned char pshared;
+};
+
+/* Wait on barrier. */
+int
+pthread_barrier_wait (barrier)
+ pthread_barrier_t *barrier;
+{
+ struct sparc_pthread_barrier *ibarrier
+ = (struct sparc_pthread_barrier *) barrier;
+ int result = 0;
+
+ /* Make sure we are alone. */
+ lll_lock (ibarrier->b.lock);
+
+ /* One more arrival. */
+ --ibarrier->b.left;
+
+ /* Are these all? */
+ if (ibarrier->b.left == 0)
+ {
+ /* Yes. Increment the event counter to avoid invalid wake-ups and
+ tell the current waiters that it is their turn. */
+ ++ibarrier->b.curr_event;
+
+ /* Wake up everybody. */
+ lll_futex_wake (&ibarrier->b.curr_event, INT_MAX);
+
+ /* This is the thread which finished the serialization. */
+ result = PTHREAD_BARRIER_SERIAL_THREAD;
+ }
+ else
+ {
+ /* The number of the event we are waiting for. The barrier's event
+ number must be bumped before we continue. */
+ unsigned int event = ibarrier->b.curr_event;
+
+ /* Before suspending, make the barrier available to others. */
+ lll_unlock (ibarrier->b.lock);
+
+ /* Wait for the event counter of the barrier to change. */
+ do
+ lll_futex_wait (&ibarrier->b.curr_event, event);
+ while (event == ibarrier->b.curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+ unsigned int init_count = ibarrier->b.init_count;
+
+ /* If this was the last woken thread, unlock. */
+ if (__atomic_is_v9 || ibarrier->pshared == 0)
+ {
+ if (atomic_increment_val (&ibarrier->b.left) == init_count)
+ /* We are done. */
+ lll_unlock (ibarrier->b.lock);
+ }
+ else
+ {
+ unsigned int left;
+ /* Slightly more complicated. On pre-v9 CPUs, atomic_increment_val
+ is only atomic for threads within the same process, not for
+ multiple processes. */
+ __sparc32_atomic_do_lock24 (&ibarrier->left_lock);
+ left = ++ibarrier->b.left;
+ __sparc32_atomic_do_unlock24 (&ibarrier->left_lock);
+ if (left == init_count)
+ /* We are done. */
+ lll_unlock (ibarrier->b.lock);
+ }
+
+ return result;
+}
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_init.c
new file mode 100644
index 0000000000..dffd8c7efa
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_init.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2002, 2006 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 <errno.h>
+#include <semaphore.h>
+#include <lowlevellock.h>
+#include <shlib-compat.h>
+#include "semaphoreP.h"
+
+struct sparc_sem
+{
+ struct sem s;
+ unsigned char lock;
+};
+
+
+int
+__new_sem_init (sem, pshared, value)
+ sem_t *sem;
+ int pshared;
+ unsigned int value;
+{
+ /* Parameter sanity check. */
+ if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* Map to the internal type. */
+ struct sparc_sem *isem = (struct sparc_sem *) sem;
+
+ /* Use the value the user provided. */
+ isem->s.count = value;
+
+ isem->lock = 0;
+
+ /* We can completely ignore the PSHARED parameter since inter-process
+ use needs no special preparation. */
+
+ return 0;
+}
+versioned_symbol (libpthread, __new_sem_init, sem_init, GLIBC_2_1);
+#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_init, __old_sem_init)
+compat_symbol (libpthread, __old_sem_init, sem_init, GLIBC_2_0);
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c
new file mode 100644
index 0000000000..be1cc60b11
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c
@@ -0,0 +1,54 @@
+/* sem_post -- post to a POSIX semaphore. SPARC version.
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.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 <internaltypes.h>
+#include <semaphore.h>
+
+#include <shlib-compat.h>
+
+int
+__new_sem_post (sem_t *sem)
+{
+ int *futex = (int *) sem, nr;
+
+ if (__atomic_is_v9)
+ nr = atomic_increment_val (futex);
+ else
+ {
+ __sparc32_atomic_do_lock24 (futex + 1);
+ nr = ++*futex;
+ __sparc32_atomic_do_unlock24 (futex + 1);
+ }
+ int err = lll_futex_wake (futex, nr);
+ if (__builtin_expect (err, 0) < 0)
+ {
+ __set_errno (-err);
+ return -1;
+ }
+ return 0;
+}
+versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1);
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_post, __old_sem_post)
+compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c
new file mode 100644
index 0000000000..efcc9e9aa8
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c
@@ -0,0 +1,117 @@
+/* sem_timedwait -- wait on a semaphore. SPARC version.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Paul Mackerras <paulus@au.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 <internaltypes.h>
+#include <semaphore.h>
+
+#include <pthreadP.h>
+#include <shlib-compat.h>
+
+
+int
+sem_timedwait (sem_t *sem, const struct timespec *abstime)
+{
+ /* First check for cancellation. */
+ CANCELLATION_P (THREAD_SELF);
+
+ int *futex = (int *) sem;
+ int val;
+ int err;
+
+ if (*futex > 0)
+ {
+ if (__atomic_is_v9)
+ val = atomic_decrement_if_positive (futex);
+ else
+ {
+ __sparc32_atomic_do_lock24 (futex + 1);
+ val = *futex;
+ if (val > 0)
+ *futex = val - 1;
+ __sparc32_atomic_do_unlock24 (futex + 1);
+ }
+ if (val > 0)
+ return 0;
+ }
+
+ err = -EINVAL;
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ goto error_return;
+
+ do
+ {
+ struct timeval tv;
+ struct timespec rt;
+ int sec, nsec;
+
+ /* Get the current time. */
+ __gettimeofday (&tv, NULL);
+
+ /* Compute relative timeout. */
+ sec = abstime->tv_sec - tv.tv_sec;
+ nsec = abstime->tv_nsec - tv.tv_usec * 1000;
+ if (nsec < 0)
+ {
+ nsec += 1000000000;
+ --sec;
+ }
+
+ /* Already timed out? */
+ err = -ETIMEDOUT;
+ if (sec < 0)
+ goto error_return;
+
+ /* Do wait. */
+ rt.tv_sec = sec;
+ rt.tv_nsec = nsec;
+
+ /* Enable asynchronous cancellation. Required by the standard. */
+ int oldtype = __pthread_enable_asynccancel ();
+
+ err = lll_futex_timed_wait (futex, 0, &rt);
+
+ /* Disable asynchronous cancellation. */
+ __pthread_disable_asynccancel (oldtype);
+
+ if (err != 0 && err != -EWOULDBLOCK)
+ goto error_return;
+
+ if (__atomic_is_v9)
+ val = atomic_decrement_if_positive (futex);
+ else
+ {
+ __sparc32_atomic_do_lock24 (futex + 1);
+ val = *futex;
+ if (val > 0)
+ *futex = val - 1;
+ __sparc32_atomic_do_unlock24 (futex + 1);
+ }
+ }
+ while (val <= 0);
+
+ return 0;
+
+ error_return:
+ __set_errno (-err);
+ return -1;
+}
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c
new file mode 100644
index 0000000000..429494e257
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c
@@ -0,0 +1,59 @@
+/* sem_trywait -- wait on a semaphore. SPARC version.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Paul Mackerras <paulus@au.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 <internaltypes.h>
+#include <semaphore.h>
+
+#include <shlib-compat.h>
+
+
+int
+__new_sem_trywait (sem_t *sem)
+{
+ int *futex = (int *) sem;
+ int val;
+
+ if (*futex > 0)
+ {
+ if (__atomic_is_v9)
+ val = atomic_decrement_if_positive (futex);
+ else
+ {
+ __sparc32_atomic_do_lock24 (futex + 1);
+ val = *futex;
+ if (val > 0)
+ *futex = val - 1;
+ __sparc32_atomic_do_unlock24 (futex + 1);
+ }
+ if (val > 0)
+ return 0;
+ }
+
+ __set_errno (EAGAIN);
+ return -1;
+}
+versioned_symbol (libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1);
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_trywait, __old_sem_trywait)
+compat_symbol (libpthread, __old_sem_trywait, sem_trywait, GLIBC_2_0);
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c
new file mode 100644
index 0000000000..d9fcdcd4ee
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c
@@ -0,0 +1,74 @@
+/* sem_wait -- wait on a semaphore. SPARC version.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Paul Mackerras <paulus@au.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 <internaltypes.h>
+#include <semaphore.h>
+
+#include <pthreadP.h>
+#include <shlib-compat.h>
+
+
+int
+__new_sem_wait (sem_t *sem)
+{
+ /* First check for cancellation. */
+ CANCELLATION_P (THREAD_SELF);
+
+ int *futex = (int *) sem;
+ int err;
+
+ do
+ {
+ int val;
+ if (__atomic_is_v9)
+ val = atomic_decrement_if_positive (futex);
+ else
+ {
+ __sparc32_atomic_do_lock24 (futex + 1);
+ val = *futex;
+ if (val > 0)
+ *futex = val - 1;
+ __sparc32_atomic_do_unlock24 (futex + 1);
+ }
+ if (val > 0)
+ return 0;
+
+ /* Enable asynchronous cancellation. Required by the standard. */
+ int oldtype = __pthread_enable_asynccancel ();
+
+ err = lll_futex_wait (futex, 0);
+
+ /* Disable asynchronous cancellation. */
+ __pthread_disable_asynccancel (oldtype);
+ }
+ while (err == 0 || err == -EWOULDBLOCK);
+
+ __set_errno (-err);
+ return -1;
+}
+
+versioned_symbol (libpthread, __new_sem_wait, sem_wait, GLIBC_2_1);
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__new_sem_wait, __old_sem_wait)
+compat_symbol (libpthread, __old_sem_wait, sem_wait, GLIBC_2_0);
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c
new file mode 100644
index 0000000000..b2b842336e
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_init.c
@@ -0,0 +1 @@
+#include "../../../../../../../pthread_barrier_init.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c
new file mode 100644
index 0000000000..7613863bba
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/pthread_barrier_wait.c
@@ -0,0 +1 @@
+#include "../../../../../../pthread/pthread_barrier_wait.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_init.c
new file mode 100644
index 0000000000..b2ebc4cbb5
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_init.c
@@ -0,0 +1 @@
+#include "../../../../../../../sem_init.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_post.c
new file mode 100644
index 0000000000..4a6eac88f5
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_post.c
@@ -0,0 +1 @@
+#include "../../../sem_post.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_timedwait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_timedwait.c
new file mode 100644
index 0000000000..b2526db02c
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_timedwait.c
@@ -0,0 +1 @@
+#include "../../../sem_timedwait.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_trywait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_trywait.c
new file mode 100644
index 0000000000..aae46f725e
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_trywait.c
@@ -0,0 +1 @@
+#include "../../../sem_trywait.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_wait.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_wait.c
new file mode 100644
index 0000000000..31157f636f
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/sem_wait.c
@@ -0,0 +1 @@
+#include "../../../sem_wait.c"
diff --git a/nscd/connections.c b/nscd/connections.c
index 9c096e2e05..1e3cd7557f 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1,5 +1,5 @@
/* Inner loops of cache daemon.
- Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -430,13 +430,6 @@ fail:
void
nscd_init (void)
{
- /* Secure mode and unprivileged mode are incompatible */
- if (server_user != NULL)
- {
- dbg_log (_("Cannot run nscd in secure mode as unprivileged user"));
- exit (4);
- }
-
/* Look up unprivileged uid/gid/groups before we start listening on the
socket */
if (server_user != NULL)
diff --git a/posix/unistd.h b/posix/unistd.h
index 9684126eaa..4c03c4d702 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002,2003,2004,2005,2006 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
@@ -1075,7 +1075,7 @@ extern void swab (__const void *__restrict __from, void *__restrict __to,
It is also found in <stdio.h>. */
#ifdef __USE_XOPEN
/* Return the name of the controlling terminal. */
-extern char *ctermid (char *__s) __THROW __nonnull ((1));
+extern char *ctermid (char *__s) __THROW;
#endif
diff --git a/rt/Versions b/rt/Versions
index a7d633d0ea..51bb033ec9 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -19,7 +19,7 @@ librt {
}
GLIBC_2.3.4 {
# m*
- mq_open; mq_close; mq_unlink; mq_getattr; mq_setattr;
+ mq_open; mq_close; mq_unlink; mq_getattr; mq_setattr;
mq_notify; mq_send; mq_receive; mq_timedsend; mq_timedreceive;
}
}
diff --git a/rt/tst-aio2.c b/rt/tst-aio2.c
index 1ff92ce93b..79076396a4 100644
--- a/rt/tst-aio2.c
+++ b/rt/tst-aio2.c
@@ -1,5 +1,5 @@
/* Test for notification mechanism in lio_listio.
- Copyright (C) 2000,02 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
@@ -25,13 +25,19 @@
#include <unistd.h>
#include <errno.h>
-int flag;
+
+static pthread_barrier_t b;
static void
thrfct (sigval_t arg)
{
- flag = 1;
+ int e = pthread_barrier_wait (&b);
+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("thread: barrier_wait failed");
+ exit (1);
+ }
}
@@ -53,6 +59,12 @@ do_test (int argc, char *argv[])
unlink (name);
+ if (pthread_barrier_init (&b, NULL, 2) != 0)
+ {
+ puts ("barrier_init failed");
+ return 1;
+ }
+
arr[0] = &cb;
cb.aio_fildes = fd;
@@ -77,9 +89,12 @@ do_test (int argc, char *argv[])
return 1;
}
- if (flag != 0)
+ puts ("lio_listio returned");
+
+ int e = pthread_barrier_wait (&b);
+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
- puts ("thread created, should not have happened");
+ puts ("barrier_wait failed");
return 1;
}
diff --git a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh
index 88c85f7106..5896a933d2 100755
--- a/scripts/check-local-headers.sh
+++ b/scripts/check-local-headers.sh
@@ -30,7 +30,8 @@ if fgrep "$includedir" */*.d |
fgrep -v "$includedir/asm" |
fgrep -v "$includedir/linux" |
fgrep -v "$includedir/selinux" |
-fgrep -v "$includedir/gd"; then
+fgrep -v "$includedir/gd" |
+fgrep -v "$includedir/c++"; then
# If we found a match something is wrong.
exit 1
fi
diff --git a/sysdeps/ieee754/bits/nan.h b/sysdeps/ieee754/bits/nan.h
index 4d4062cfcb..bae97f2165 100644
--- a/sysdeps/ieee754/bits/nan.h
+++ b/sysdeps/ieee754/bits/nan.h
@@ -1,5 +1,5 @@
/* `NAN' constant for IEEE 754 machines.
- Copyright (C) 1992, 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1992,1996,1997,1999,2004,2006 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
@@ -26,13 +26,13 @@
#if __GNUC_PREREQ(3,3)
-# define NAN (__builtin_nanf(""))
+# define NAN (__builtin_nanf (""))
-#elif defined__GNUC__
+#elif defined __GNUC__
# define NAN \
- (__extension__ \
- ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
+ (__extension__ \
+ ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
{ __l: 0x7fc00000UL }).__d)
#else
diff --git a/sysdeps/pthread/Versions b/sysdeps/pthread/Versions
new file mode 100644
index 0000000000..a71cffbed4
--- /dev/null
+++ b/sysdeps/pthread/Versions
@@ -0,0 +1,5 @@
+librt {
+ GLIBC_2.4 {
+ lio_listio; lio_listio64;
+ }
+}
diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c
index 5c9ccb46d0..3e1dbe9c63 100644
--- a/sysdeps/pthread/aio_misc.c
+++ b/sysdeps/pthread/aio_misc.c
@@ -1,5 +1,5 @@
/* Handle general operations.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -46,8 +46,7 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
(void) pthread_attr_destroy (&attr);
return ret;
-}
-
+}
#endif
static void add_request_to_runlist (struct requestlist *newrequest);
diff --git a/sysdeps/pthread/lio_listio.c b/sysdeps/pthread/lio_listio.c
index 29dc9d6eab..815840397e 100644
--- a/sysdeps/pthread/lio_listio.c
+++ b/sysdeps/pthread/lio_listio.c
@@ -1,5 +1,5 @@
/* Enqueue and list of read or write requests.
- Copyright (C) 1997,1998,1999,2000,2001,2003,2005
+ Copyright (C) 1997,1998,1999,2000,2001,2003,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -31,6 +31,9 @@
#define LIO_OPCODE_BASE 0
#endif
+#include <shlib-compat.h>
+
+
/* We need this special structure to handle asynchronous I/O. */
struct async_waitlist
{
@@ -40,12 +43,22 @@ struct async_waitlist
};
-int
-lio_listio (mode, list, nent, sig)
- int mode;
- struct aiocb *const list[];
- int nent;
- struct sigevent *sig;
+/* The code in glibc 2.1 to glibc 2.4 issued only one event when all
+ requests submitted with lio_listio finished. The existing practice
+ is to issue events for the individual requests as well. This is
+ what the new code does. */
+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
+# define LIO_MODE(mode) ((mode) & 127)
+# define NO_INDIVIDUAL_EVENT_P(mode) ((mode) & 128)
+#else
+# define LIO_MODE(mode) mode
+# define NO_INDIVIDUAL_EVENT_P(mode) 0
+#endif
+
+
+static int
+lio_listio_internal (int mode, struct aiocb *const list[], int nent,
+ struct sigevent *sig)
{
struct sigevent defsigev;
struct requestlist *requests[nent];
@@ -53,13 +66,6 @@ lio_listio (mode, list, nent, sig)
volatile int total = 0;
int result = 0;
- /* Check arguments. */
- if (mode != LIO_WAIT && mode != LIO_NOWAIT)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
if (sig == NULL)
{
defsigev.sigev_notify = SIGEV_NONE;
@@ -74,7 +80,9 @@ lio_listio (mode, list, nent, sig)
for (cnt = 0; cnt < nent; ++cnt)
if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
{
- list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
+ if (NO_INDIVIDUAL_EVENT_P (mode))
+ list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
+
requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
(list[cnt]->aio_lio_opcode
| LIO_OPCODE_BASE));
@@ -100,7 +108,7 @@ lio_listio (mode, list, nent, sig)
locked forever. */
pthread_mutex_unlock (&__aio_requests_mutex);
- if (mode == LIO_NOWAIT)
+ if (LIO_MODE (mode) == LIO_NOWAIT)
{
#ifdef BROKEN_THREAD_SIGNALS
__aio_notify_only (sig,
@@ -112,7 +120,7 @@ lio_listio (mode, list, nent, sig)
return result;
}
- else if (mode == LIO_WAIT)
+ else if (LIO_MODE (mode) == LIO_WAIT)
{
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
struct waitlist waitlist[nent];
@@ -202,3 +210,38 @@ lio_listio (mode, list, nent, sig)
return result;
}
+
+
+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
+int
+attribute_compat_text_section
+__lio_listio_21 (int mode, struct aiocb *const list[], int nent,
+ struct sigevent *sig)
+{
+ /* Check arguments. */
+ if (mode != LIO_WAIT && mode != LIO_NOWAIT)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return lio_listio_internal (mode | LIO_NO_INDIVIDUAL_EVENT, list, nent, sig);
+}
+compat_symbol (librt, __lio_listio_21, lio_listio, GLIBC_2_1);
+#endif
+
+
+int
+__lio_listio_item_notify (int mode, struct aiocb *const list[], int nent,
+ struct sigevent *sig)
+{
+ /* Check arguments. */
+ if (mode != LIO_WAIT && mode != LIO_NOWAIT)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return lio_listio_internal (mode, list, nent, sig);
+}
+versioned_symbol (librt, __lio_listio_item_notify, lio_listio, GLIBC_2_4);
diff --git a/sysdeps/pthread/lio_listio64.c b/sysdeps/pthread/lio_listio64.c
index 4bec3f6195..c6b7cf7bd2 100644
--- a/sysdeps/pthread/lio_listio64.c
+++ b/sysdeps/pthread/lio_listio64.c
@@ -1,5 +1,5 @@
/* Enqueue and list of read or write requests, 64bit offset version.
- Copyright (C) 1997, 1998, 1999, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,1999,2003,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -27,6 +27,8 @@
#include <aio_misc.h>
#define lio_listio lio_listio64
+#define __lio_listio_21 __lio_listio64_21
+#define __lio_listio_item_notify __lio_listio64_item_notify
#define aiocb aiocb64
#define LIO_OPCODE_BASE 128
#include <lio_listio.c>
diff --git a/sysdeps/sparc/sparc32/bits/atomic.h b/sysdeps/sparc/sparc32/bits/atomic.h
index 736372a3d4..707a4b0a52 100644
--- a/sysdeps/sparc/sparc32/bits/atomic.h
+++ b/sysdeps/sparc/sparc32/bits/atomic.h
@@ -1,5 +1,5 @@
/* Atomic operations. sparc32 version.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -21,6 +21,34 @@
#ifndef _BITS_ATOMIC_H
#define _BITS_ATOMIC_H 1
+#include <stdint.h>
+
+typedef int8_t atomic8_t;
+typedef uint8_t uatomic8_t;
+typedef int_fast8_t atomic_fast8_t;
+typedef uint_fast8_t uatomic_fast8_t;
+
+typedef int16_t atomic16_t;
+typedef uint16_t uatomic16_t;
+typedef int_fast16_t atomic_fast16_t;
+typedef uint_fast16_t uatomic_fast16_t;
+
+typedef int32_t atomic32_t;
+typedef uint32_t uatomic32_t;
+typedef int_fast32_t atomic_fast32_t;
+typedef uint_fast32_t uatomic_fast32_t;
+
+typedef int64_t atomic64_t;
+typedef uint64_t uatomic64_t;
+typedef int_fast64_t atomic_fast64_t;
+typedef uint_fast64_t uatomic_fast64_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+
/* We have no compare and swap, just test and set.
The following implementation contends on 64 global locks
per library and assumes no variable will be accessed using atomic.h
@@ -41,22 +69,65 @@ volatile unsigned char __sparc32_atomic_locks[64]
unsigned int __idx = (((long) addr >> 2) ^ ((long) addr >> 12)) \
& 63; \
do \
- __asm ("ldstub %1, %0" \
- : "=r" (__old_lock), \
- "=m" (__sparc32_atomic_locks[__idx]) \
- : "m" (__sparc32_atomic_locks[__idx])); \
+ __asm __volatile ("ldstub %1, %0" \
+ : "=r" (__old_lock), \
+ "=m" (__sparc32_atomic_locks[__idx]) \
+ : "m" (__sparc32_atomic_locks[__idx]) \
+ : "memory"); \
while (__old_lock); \
} \
while (0)
#define __sparc32_atomic_do_unlock(addr) \
do \
- __sparc32_atomic_locks[(((long) addr >> 2) \
- ^ ((long) addr >> 12)) & 63] = 0; \
+ { \
+ __sparc32_atomic_locks[(((long) addr >> 2) \
+ ^ ((long) addr >> 12)) & 63] = 0; \
+ __asm __volatile ("" ::: "memory"); \
+ } \
+ while (0)
+
+#define __sparc32_atomic_do_lock24(addr) \
+ do \
+ { \
+ unsigned int __old_lock; \
+ do \
+ __asm __volatile ("ldstub %1, %0" \
+ : "=r" (__old_lock), "=m" (*(addr)) \
+ : "m" (*(addr)) \
+ : "memory"); \
+ while (__old_lock); \
+ } \
while (0)
+#define __sparc32_atomic_do_unlock24(addr) \
+ do \
+ { \
+ *(char *) (addr) = 0; \
+ __asm __volatile ("" ::: "memory"); \
+ } \
+ while (0)
+
+
+#ifndef SHARED
+# define __v9_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+({ \
+ register __typeof (*(mem)) __acev_tmp __asm ("%g6"); \
+ register __typeof (mem) __acev_mem __asm ("%g1") = (mem); \
+ register __typeof (*(mem)) __acev_oldval __asm ("%g5"); \
+ __acev_tmp = (newval); \
+ __acev_oldval = (oldval); \
+ /* .word 0xcde05005 is cas [%g1], %g5, %g6. Can't use cas here though, \
+ because as will then mark the object file as V8+ arch. */ \
+ __asm __volatile (".word 0xcde05005" \
+ : "+r" (__acev_tmp), "=m" (*__acev_mem) \
+ : "r" (__acev_oldval), "m" (*__acev_mem), \
+ "r" (__acev_mem)); \
+ __acev_tmp; })
+#endif
+
/* The only basic operation needed is compare and exchange. */
-#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+#define __v7_compare_and_exchange_val_acq(mem, newval, oldval) \
({ __typeof (mem) __acev_memp = (mem); \
__typeof (*mem) __acev_ret; \
__typeof (*mem) __acev_newval = (newval); \
@@ -68,7 +139,7 @@ volatile unsigned char __sparc32_atomic_locks[64]
__sparc32_atomic_do_unlock (__acev_memp); \
__acev_ret; })
-#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+#define __v7_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ __typeof (mem) __aceb_memp = (mem); \
int __aceb_ret; \
__typeof (*mem) __aceb_newval = (newval); \
@@ -82,4 +153,175 @@ volatile unsigned char __sparc32_atomic_locks[64]
__sparc32_atomic_do_unlock (__aceb_memp); \
__aceb_ret; })
+#define __v7_exchange_acq(mem, newval) \
+ ({ __typeof (mem) __acev_memp = (mem); \
+ __typeof (*mem) __acev_ret; \
+ __typeof (*mem) __acev_newval = (newval); \
+ \
+ __sparc32_atomic_do_lock (__acev_memp); \
+ __acev_ret = *__acev_memp; \
+ *__acev_memp = __acev_newval; \
+ __sparc32_atomic_do_unlock (__acev_memp); \
+ __acev_ret; })
+
+#define __v7_exchange_and_add(mem, value) \
+ ({ __typeof (mem) __acev_memp = (mem); \
+ __typeof (*mem) __acev_ret; \
+ \
+ __sparc32_atomic_do_lock (__acev_memp); \
+ __acev_ret = *__acev_memp; \
+ *__acev_memp = __acev_ret + (value); \
+ __sparc32_atomic_do_unlock (__acev_memp); \
+ __acev_ret; })
+
+/* Special versions, which guarantee that top 8 bits of all values
+ are cleared and use those bits as the ldstub lock. */
+#define __v7_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+ ({ __typeof (mem) __acev_memp = (mem); \
+ __typeof (*mem) __acev_ret; \
+ __typeof (*mem) __acev_newval = (newval); \
+ \
+ __sparc32_atomic_do_lock24 (__acev_memp); \
+ __acev_ret = *__acev_memp & 0xffffff; \
+ if (__acev_ret == (oldval)) \
+ *__acev_memp = __acev_newval; \
+ else \
+ __sparc32_atomic_do_unlock24 (__acev_memp); \
+ __asm __volatile ("" ::: "memory"); \
+ __acev_ret; })
+
+#define __v7_exchange_24_rel(mem, newval) \
+ ({ __typeof (mem) __acev_memp = (mem); \
+ __typeof (*mem) __acev_ret; \
+ __typeof (*mem) __acev_newval = (newval); \
+ \
+ __sparc32_atomic_do_lock24 (__acev_memp); \
+ __acev_ret = *__acev_memp & 0xffffff; \
+ *__acev_memp = __acev_newval; \
+ __asm __volatile ("" ::: "memory"); \
+ __acev_ret; })
+
+#ifdef SHARED
+
+/* When dynamically linked, we assume pre-v9 libraries are only ever
+ used on pre-v9 CPU. */
+# define __atomic_is_v9 0
+
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+ __v7_compare_and_exchange_val_acq (mem, newval, oldval)
+
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ __v7_compare_and_exchange_bool_acq (mem, newval, oldval)
+
+# define atomic_exchange_acq(mem, newval) \
+ __v7_exchange_acq (mem, newval)
+
+# define atomic_exchange_and_add(mem, value) \
+ __v7_exchange_and_add (mem, value)
+
+# define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+ ({ \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ __v7_compare_and_exchange_val_24_acq (mem, newval, oldval); })
+
+# define atomic_exchange_24_rel(mem, newval) \
+ ({ \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ __v7_exchange_24_rel (mem, newval); })
+
+#else
+
+/* In libc.a/libpthread.a etc. we don't know if we'll be run on
+ pre-v9 or v9 CPU. To be interoperable with dynamically linked
+ apps on v9 CPUs e.g. with process shared primitives, use cas insn
+ on v9 CPUs and ldstub on pre-v9. */
+
+/* Avoid <ldsodefs.h> include here. */
+extern uint64_t _dl_hwcap __attribute__((weak));
+# define __ATOMIC_HWCAP_SPARC_V9 16
+# define __atomic_is_v9 \
+ (__builtin_expect (&_dl_hwcap != 0, 1) \
+ && __builtin_expect (_dl_hwcap & __ATOMIC_HWCAP_SPARC_V9, \
+ __ATOMIC_HWCAP_SPARC_V9))
+
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+ ({ \
+ __typeof (*mem) __acev_wret; \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ if (__atomic_is_v9) \
+ __acev_wret \
+ = __v9_compare_and_exchange_val_32_acq (mem, newval, oldval);\
+ else \
+ __acev_wret \
+ = __v7_compare_and_exchange_val_acq (mem, newval, oldval); \
+ __acev_wret; })
+
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ ({ \
+ int __acev_wret; \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ if (__atomic_is_v9) \
+ { \
+ __typeof (oldval) __acev_woldval = (oldval); \
+ __acev_wret \
+ = __v9_compare_and_exchange_val_32_acq (mem, newval, \
+ __acev_woldval) \
+ != __acev_woldval; \
+ } \
+ else \
+ __acev_wret \
+ = __v7_compare_and_exchange_bool_acq (mem, newval, oldval); \
+ __acev_wret; })
+
+# define atomic_exchange_rel(mem, newval) \
+ ({ \
+ __typeof (*mem) __acev_wret; \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ if (__atomic_is_v9) \
+ { \
+ __typeof (mem) __acev_wmemp = (mem); \
+ __typeof (*(mem)) __acev_wval = (newval); \
+ do \
+ __acev_wret = *__acev_wmemp; \
+ while (__builtin_expect \
+ (__v9_compare_and_exchange_val_32_acq (__acev_wmemp,\
+ __acev_wval, \
+ __acev_wret) \
+ != __acev_wret, 0)); \
+ } \
+ else \
+ __acev_wret = __v7_exchange_acq (mem, newval); \
+ __acev_wret; })
+
+# define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+ ({ \
+ __typeof (*mem) __acev_wret; \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ if (__atomic_is_v9) \
+ __acev_wret \
+ = __v9_compare_and_exchange_val_32_acq (mem, newval, oldval);\
+ else \
+ __acev_wret \
+ = __v7_compare_and_exchange_val_24_acq (mem, newval, oldval);\
+ __acev_wret; })
+
+# define atomic_exchange_24_rel(mem, newval) \
+ ({ \
+ __typeof (*mem) __acev_w24ret; \
+ if (sizeof (*mem) != 4) \
+ abort (); \
+ if (__atomic_is_v9) \
+ __acev_w24ret = atomic_exchange_rel (mem, newval); \
+ else \
+ __acev_w24ret = __v7_exchange_24_rel (mem, newval); \
+ __acev_w24ret; })
+
+#endif
+
#endif /* bits/atomic.h */
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 4ea122c46b..02dabaabb4 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. SPARC version.
- Copyright (C) 1996-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2003, 2004, 2005, 2006 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
@@ -40,13 +40,6 @@
#define OPCODE_SAVE_SP 0x9de3bfa8 /* save %sp, -(16+6)*4, %sp */
#define OPCODE_BA 0x30800000 /* b,a ?; add PC-rel word address */
-/* Use a different preload file when running in 32-bit emulation mode
- on a 64-bit host. */
-#define LD_SO_PRELOAD ((GLRO(dl_hwcap) & HWCAP_SPARC_V9) \
- ? "/etc/ld.so.preload32" \
- : "/etc/ld.so.preload")
-
-
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
elf_machine_matches_host (const Elf32_Ehdr *ehdr)
diff --git a/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h b/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
index 6d316f37d5..36959a9926 100644
--- a/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
+++ b/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
@@ -1,5 +1,5 @@
/* Atomic operations. sparcv9 version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -79,6 +79,12 @@ typedef uintmax_t uatomic_max_t;
abort (); \
__oldval; })
+#define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+ atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+
+#define atomic_exchange_24_rel(mem, newval) \
+ atomic_exchange_rel (mem, newval)
+
#define atomic_full_barrier() \
__asm __volatile ("membar #LoadLoad | #LoadStore" \
" | #StoreLoad | #StoreStore" : : : "memory")
diff --git a/sysdeps/sparc/sparc64/bits/atomic.h b/sysdeps/sparc/sparc64/bits/atomic.h
index 8f97753140..2fb377810e 100644
--- a/sysdeps/sparc/sparc64/bits/atomic.h
+++ b/sysdeps/sparc/sparc64/bits/atomic.h
@@ -1,5 +1,5 @@
/* Atomic operations. sparc64 version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -94,6 +94,12 @@ typedef uintmax_t uatomic_max_t;
} \
__oldval; })
+#define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+ atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+
+#define atomic_exchange_24_rel(mem, newval) \
+ atomic_exchange_rel (mem, newval)
+
#define atomic_full_barrier() \
__asm __volatile ("membar #LoadLoad | #LoadStore" \
" | #StoreLoad | #StoreStore" : : : "memory")
diff --git a/sysdeps/unix/sysv/linux/m68k/fchownat.c b/sysdeps/unix/sysv/linux/m68k/fchownat.c
index 71df4feda7..0da8cd8082 100644
--- a/sysdeps/unix/sysv/linux/m68k/fchownat.c
+++ b/sysdeps/unix/sysv/linux/m68k/fchownat.c
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include <sysdep.h>
#include <sys/syscall.h>
diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c
index 5c31bec5ee..33e51a22b2 100644
--- a/sysdeps/unix/sysv/linux/mips/brk.c
+++ b/sysdeps/unix/sysv/linux/mips/brk.c
@@ -1,5 +1,5 @@
/* brk system call for Linux/MIPS.
- Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2005, 2006 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
@@ -41,7 +41,7 @@ __brk (void *addr)
"syscall" /* Perform the system call. */
: "=r" (res)
: "I" (SYS_ify (brk)), "r" (addr)
- : "$4", "$7");
++ : "$4", "$7", __SYSCALL_CLOBBERS);
newbrk = (void *) res;
}
__curbrk = newbrk;