Hello community,
here is the log from the commit of package glibc
checked in at Wed Apr 5 17:04:48 CEST 2006.
--------
--- glibc/glibc.changes 2006-03-31 15:50:38.000000000 +0200
+++ glibc/glibc.changes 2006-04-04 22:10:56.000000000 +0200
@@ -1,0 +2,24 @@
+Tue Apr 4 22:10:47 CEST 2006 - schwab@suse.de
+
+- Fix readlink declaration.
+
+-------------------------------------------------------------------
+Mon Apr 3 13:40:54 CEST 2006 - kukuk@suse.de
+
+- Update from CVS:
+ - nscd bug fixes
+ - Match return value of readlink to what POSIX says
+ - Fix NIS+ checks for NULL pointer
+
+-------------------------------------------------------------------
+Sun Apr 2 20:53:17 CEST 2006 - dmueller@suse.de
+
+- Fix clients crash if nscd is unresponsive (glibc-#2501)
+- Fix fd leak in nscd daemon (glibc-#2498)
+
+-------------------------------------------------------------------
+Sat Apr 1 21:48:54 CEST 2006 - schwab@suse.de
+
+- Fix on ppc64.
+
+-------------------------------------------------------------------
Old:
----
glibc-2.3.90-getcwd.diff
glibc-nptl-2.4-2006032009.tar.bz2
minmem
New:
----
glibc-2.4-2006040312-CVS.diff
glibc-2.4-readlink.diff
glibc-nptl-2.4-2006040312.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ glibc.spec ++++++
--- /var/tmp/diff_new_pack.YF7eJq/_old 2006-04-05 17:03:52.000000000 +0200
+++ /var/tmp/diff_new_pack.YF7eJq/_new 2006-04-05 17:03:52.000000000 +0200
@@ -28,13 +28,13 @@
Obsoletes: ngpt ngpt-devel
Autoreqprov: on
Version: 2.4
-Release: 14
+Release: 17
%define snapshot_date 2006032009
URL: http://www.gnu.org/software/libc/libc.html
PreReq: filesystem
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: glibc-%{version}-%{snapshot_date}.tar.bz2
-Source1: glibc-nptl-%{version}-%{snapshot_date}.tar.bz2
+Source1: glibc-nptl-%{version}-2006040312.tar.bz2
Source2: kernel-headers-2.6.16.tar.bz2
Source3: noversion.tar.bz2
Source4: manpages.tar.bz2
@@ -77,11 +77,12 @@
Patch27: glibc-2.3.90-nscd.diff
Patch28: glibc-2.3.3-nscd-db-path.diff
Patch29: glibc-2.3.5-nscd-zeronegtimeout.diff
-Patch30: glibc-2.3.90-getcwd.diff
-Patch31: glibc-2.3.90-ppc64-procfs.h.diff
-Patch32: glibc-2.3.90-pthread_kill-invalid-thread-id.diff
-Patch33: glibc-2.3.90-langpackdir.diff
-Patch34: glibc-2.3.90-clone-cfi.diff
+Patch30: glibc-2.3.90-ppc64-procfs.h.diff
+Patch31: glibc-2.3.90-pthread_kill-invalid-thread-id.diff
+Patch32: glibc-2.3.90-langpackdir.diff
+Patch33: glibc-2.3.90-clone-cfi.diff
+Patch34: glibc-2.4-2006040312-CVS.diff
+Patch35: glibc-2.4-readlink.diff
%description
The GNU C Library provides the most important standard libraries used
@@ -244,7 +245,8 @@
%patch30
%patch31
%patch33
-%patch34
+%patch34 -p2
+%patch35
# Install blowfish crypt add-on
rm crypt_blowfish-*/crypt.h
cp -a crypt_blowfish-*/*.[ch] crypt
@@ -257,7 +259,6 @@
touch asm-ia64/offsets.h
%build
-ls /proc
if [ -x /bin/uname.bin ]; then
/bin/uname.bin -a
else
@@ -885,6 +886,18 @@
%{_libdir}/libdl_p.a
%changelog -n glibc
+* Tue Apr 04 2006 - schwab@suse.de
+- Fix readlink declaration.
+* Mon Apr 03 2006 - kukuk@suse.de
+- Update from CVS:
+- nscd bug fixes
+- Match return value of readlink to what POSIX says
+- Fix NIS+ checks for NULL pointer
+* Sun Apr 02 2006 - dmueller@suse.de
+- Fix clients crash if nscd is unresponsive (glibc-#2501)
+- Fix fd leak in nscd daemon (glibc-#2498)
+* Sat Apr 01 2006 - schwab@suse.de
+- Fix on ppc64.
* Fri Mar 31 2006 - schwab@suse.de
- Extend last change also to ppc64.
* Sun Mar 26 2006 - schwab@suse.de
++++++ glibc-2.3.90-nscd.diff ++++++
--- /var/tmp/diff_new_pack.YF7eJq/_old 2006-04-05 17:03:52.000000000 +0200
+++ /var/tmp/diff_new_pack.YF7eJq/_new 2006-04-05 17:03:52.000000000 +0200
@@ -1,3 +1,20 @@
+--- nscd/Makefile.~1.48.~ 2005-12-16 11:37:08.000000000 +0100
++++ nscd/Makefile 2006-04-01 22:47:03.000000000 +0200
+@@ -62,14 +62,6 @@ endif
+
+ LDLIBS-nscd = $(selinux-LIBS)
+
+-# The configure.in check for libselinux and its headers did not use
+-# $SYSINCLUDES. The directory specified by --with-headers usually
+-# contains only the basic kernel interface headers, not something like
+-# libselinux. So the simplest thing is to presume that the standard
+-# system headers will be ok for this file.
+-$(objpfx)nscd_stat.o: sysincludes = # nothing
+-$(objpfx)selinux.o: sysincludes = # nothing
+-
+ distribute := nscd.h nscd-client.h dbg_log.h \
+ $(addsuffix .c, $(filter-out xmalloc,$(all-nscd-modules))) \
+ nscd.conf nscd.init nscd_proto.h nscd-types.h
--- nscd/cache.c
+++ nscd/cache.c 2005/06/23 21:12:15
@@ -198,28 +198,31 @@
++++++ glibc-2.3.90-ppc64-procfs.h.diff ++++++
--- /var/tmp/diff_new_pack.YF7eJq/_old 2006-04-05 17:03:52.000000000 +0200
+++ /var/tmp/diff_new_pack.YF7eJq/_new 2006-04-05 17:03:52.000000000 +0200
@@ -1,13 +1,11 @@
--- sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ sysdeps/unix/sysv/linux/powerpc/sys/procfs.h 2006/01/12 15:29:43
-@@ -24,10 +24,8 @@
- used on Linux. */
-
- #include
--#include
- #include
- #include
--#include
- #include
-
- __BEGIN_DECLS
+@@ -35,7 +35,7 @@ __BEGIN_DECLS
+ /* These definitions are normally provided by ucontext.h via
+ asm/sigcontext.h, asm/ptrace.h, and asm/elf.h. Otherwise we define
+ them here. */
+-#ifndef __PPC64_ELF_H
++#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H
+ #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
+ #define ELF_NFPREG 33 /* includes fpscr */
+ #if __WORDSIZE == 32
++++++ glibc-2.4-2006040312-CVS.diff ++++++
++++ 675 lines (skipped)
++++++ glibc-2.4-readlink.diff ++++++
--- posix/bits/unistd.h.~1.10.~ 2005-08-09 12:10:00.000000000 +0200
+++ posix/bits/unistd.h 2006-04-03 23:07:55.000000000 +0200
@@ -80,16 +80,17 @@ pread64 (int __fd, void *__buf, size_t _
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
-extern int __readlink_chk (__const char *__restrict __path,
- char *__restrict __buf, size_t __len,
- size_t __buflen)
+extern ssize_t __readlink_chk (__const char *__restrict __path,
+ char *__restrict __buf, size_t __len,
+ size_t __buflen)
__THROW __nonnull ((1, 2)) __wur;
-extern int __REDIRECT_NTH (__readlink_alias,
- (__const char *__restrict __path,
- char *__restrict __buf, size_t __len), readlink)
+extern ssize_t __REDIRECT_NTH (__readlink_alias,
+ (__const char *__restrict __path,
+ char *__restrict __buf, size_t __len),
+ readlink)
__nonnull ((1, 2)) __wur;
-extern __always_inline __nonnull ((1, 2)) __wur int
+extern __always_inline __nonnull ((1, 2)) __wur ssize_t
__NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
size_t __len))
{
++++++ glibc-nptl-2.4-2006032009.tar.bz2 -> glibc-nptl-2.4-2006040312.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/ChangeLog new/nptl/ChangeLog
--- old/nptl/ChangeLog 2006-03-08 22:05:27.000000000 +0100
+++ new/nptl/ChangeLog 2006-03-28 10:21:09.000000000 +0200
@@ -1,3 +1,30 @@
+2006-03-27 Ulrich Drepper
+
+ * allocatestack.c (allocate_stack): Always initialize robust_head.
+ * descr.h: Define struct robust_list_head.
+ (struct pthread): Use robust_list_head in robust mutex list definition.
+ Adjust ENQUEUE_MUTEX and DEQUEUE_MUTEX.
+ * init.c [!__ASSUME_SET_ROBUST_LIST] (__set_robust_list_avail): Define.
+ (__pthread_initialize_minimal_internal): Register robust_list with
+ the kernel.
+ * pthreadP.h: Remove PRIVATE_ from PTHREAD_MUTEX_ROBUST_* names.
+ Declare __set_robust_list_avail.
+ * pthread_create.c (start_thread): Register robust_list of new thread.
+ [!__ASSUME_SET_ROBUST_LIST]: If robust_list is not empty wake up
+ waiters.
+ * pthread_mutex_destroy.c: For robust mutexes don't look at the
+ number of users, it's unreliable.
+ * pthread_mutex_init.c: Allow use of pshared robust mutexes if
+ set_robust_list syscall is available.
+ * pthread_mutex_consistent.c: Adjust for PTHREAD_MUTEX_ROBUST_* rename.
+ * pthread_mutex_lock.c: Simplify robust mutex code a bit.
+ Set robust_head.list_op_pending before trying to lock a robust mutex.
+ * pthread_mutex_timedlock.c: Likewise.
+ * pthread_mutex_trylock.c: Likewise.
+ * pthread_mutex_unlock.c: Likewise for unlocking.
+ * Makefile (tests): Add tst-robust8.
+ * tst-robust8.c: New file.
+
2006-03-08 Andreas Schwab
* sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/Makefile new/nptl/Makefile
--- old/nptl/Makefile 2006-02-28 10:55:16.000000000 +0100
+++ new/nptl/Makefile 2006-03-28 10:21:09.000000000 +0200
@@ -206,7 +206,7 @@
tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
tst-cond20 tst-cond21 \
tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
- tst-robust6 tst-robust7 \
+ tst-robust6 tst-robust7 tst-robust8 \
tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/allocatestack.c new/nptl/allocatestack.c
--- old/nptl/allocatestack.c 2006-02-13 07:58:54.000000000 +0100
+++ new/nptl/allocatestack.c 2006-03-28 10:21:09.000000000 +0200
@@ -365,12 +365,6 @@
/* The process ID is also the same as that of the caller. */
pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
- /* List of robust mutexes. */
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
- pd->robust_list.__prev = &pd->robust_list;
-#endif
- pd->robust_list.__next = &pd->robust_list;
-
/* Allocate the DTV for this thread. */
if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
{
@@ -505,12 +499,6 @@
/* The process ID is also the same as that of the caller. */
pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
- /* List of robust mutexes. */
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
- pd->robust_list.__prev = &pd->robust_list;
-#endif
- pd->robust_list.__next = &pd->robust_list;
-
/* Allocate the DTV for this thread. */
if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
{
@@ -634,6 +622,18 @@
stillborn thread could be canceled while the lock is taken. */
pd->lock = LLL_LOCK_INITIALIZER;
+ /* The robust mutex lists also need to be initialized
+ unconditionally because the cleanup for the previous stack owner
+ might have happened in the kernel. */
+ pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
+ - offsetof (pthread_mutex_t,
+ __data.__list.__next));
+ pd->robust_head.list_op_pending = NULL;
+#ifdef __PTHREAD_MUTEX_HAVE_PREV
+ pd->robust_prev = &pd->robust_head;
+#endif
+ pd->robust_head.list = &pd->robust_head;
+
/* We place the thread descriptor at the end of the stack. */
*pdp = pd;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/descr.h new/nptl/descr.h
--- old/nptl/descr.h 2006-02-24 10:04:43.000000000 +0100
+++ new/nptl/descr.h 2006-03-28 10:21:09.000000000 +0200
@@ -102,6 +102,15 @@
};
+/* Data structure used by the kernel to find robust futexes. */
+struct robust_list_head
+{
+ void *list;
+ long int futex_offset;
+ void *list_op_pending;
+};
+
+
/* Thread descriptor data structure. */
struct pthread
{
@@ -136,25 +145,43 @@
/* List of robust mutexes the thread is holding. */
#ifdef __PTHREAD_MUTEX_HAVE_PREV
- __pthread_list_t robust_list;
+ void *robust_prev;
+ struct robust_list_head robust_head;
+
+ /* The list above is strange. It is basically a double linked list
+ but the pointer to the next/previous element of the list points
+ in the middle of the object, the __next element. Whenever
+ casting to __pthread_list_t we need to adjust the pointer
+ first. */
+# define QUEUE_PTR_ADJUST (offsetof (__pthread_list_t, __next))
# define ENQUEUE_MUTEX(mutex) \
do { \
- __pthread_list_t *next = THREAD_GETMEM (THREAD_SELF, robust_list.__next); \
- next->__prev = &mutex->__data.__list; \
- mutex->__data.__list.__next = next; \
- mutex->__data.__list.__prev = &THREAD_SELF->robust_list; \
- THREAD_SETMEM (THREAD_SELF, robust_list.__next, &mutex->__data.__list); \
+ __pthread_list_t *next = (THREAD_GETMEM (THREAD_SELF, robust_head.list) \
+ - QUEUE_PTR_ADJUST); \
+ next->__prev = (void *) &mutex->__data.__list.__next; \
+ mutex->__data.__list.__next = (void *) &next->__next; \
+ mutex->__data.__list.__prev = (void *) &THREAD_SELF->robust_head; \
+ THREAD_SETMEM (THREAD_SELF, robust_head.list, \
+ &mutex->__data.__list.__next); \
} while (0)
# define DEQUEUE_MUTEX(mutex) \
do { \
- mutex->__data.__list.__next->__prev = mutex->__data.__list.__prev; \
- mutex->__data.__list.__prev->__next = mutex->__data.__list.__next; \
+ __pthread_list_t *next = (__pthread_list_t *) \
+ ((char *) mutex->__data.__list.__next - QUEUE_PTR_ADJUST); \
+ next->__prev = mutex->__data.__list.__prev; \
+ __pthread_list_t *prev = (__pthread_list_t *) \
+ ((char *) mutex->__data.__list.__prev - QUEUE_PTR_ADJUST); \
+ prev->__next = mutex->__data.__list.__next; \
mutex->__data.__list.__prev = NULL; \
mutex->__data.__list.__next = NULL; \
} while (0)
#else
- __pthread_slist_t robust_list;
+ union
+ {
+ __pthread_slist_t robust_list;
+ struct robust_list_head robust_head;
+ };
# define ENQUEUE_MUTEX(mutex) \
do { \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/init.c new/nptl/init.c
--- old/nptl/init.c 2006-02-13 07:58:54.000000000 +0100
+++ new/nptl/init.c 2006-03-28 10:21:09.000000000 +0200
@@ -60,6 +60,15 @@
size_t __static_tls_size;
size_t __static_tls_align_m1;
+#ifndef __ASSUME_SET_ROBUST_LIST
+/* Negative if we do not have the system call and we can use it. */
+int __set_robust_list_avail;
+# define set_robust_list_not_avail() \
+ __set_robust_list_avail = -1
+#else
+# define set_robust_list_not_avail() do { } while (0)
+#endif
+
/* Version of the library, used in libthread_db to detect mismatches. */
static const char nptl_version[] __attribute_used__ = VERSION;
@@ -247,10 +256,6 @@
struct pthread *pd = THREAD_SELF;
INTERNAL_SYSCALL_DECL (err);
pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
- pd->robust_list.__prev = &pd->robust_list;
-#endif
- pd->robust_list.__next = &pd->robust_list;
THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]);
THREAD_SETMEM (pd, user_stack, true);
if (LLL_LOCK_INITIALIZER != 0)
@@ -259,6 +264,21 @@
THREAD_SETMEM (pd, cpuclock_offset, GL(dl_cpuclock_offset));
#endif
+ /* Initialize the robust mutex data. */
+#ifdef __PTHREAD_MUTEX_HAVE_PREV
+ pd->robust_prev = &pd->robust_head;
+#endif
+ pd->robust_head.list = &pd->robust_head;
+#ifdef __NR_set_robust_list
+ pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
+ - offsetof (pthread_mutex_t,
+ __data.__list.__next));
+ int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
+ sizeof (struct robust_list_head));
+ if (INTERNAL_SYSCALL_ERROR_P (res, err))
+#endif
+ set_robust_list_not_avail ();
+
/* Set initial thread's stack block from 0 up to __libc_stack_end.
It will be bigger than it actually is, but for unwind.c/pt-longjmp.c
purposes this is good enough. */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthreadP.h new/nptl/pthreadP.h
--- old/nptl/pthreadP.h 2006-02-28 10:55:16.000000000 +0100
+++ new/nptl/pthreadP.h 2006-03-28 10:21:09.000000000 +0200
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
/* Atomic operations on TLS memory. */
@@ -60,13 +61,13 @@
/* Internal mutex type value. */
enum
{
- PTHREAD_MUTEX_ROBUST_PRIVATE_NP = 16,
- PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP
- = PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP
- = PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP
- = PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ADAPTIVE_NP,
+ PTHREAD_MUTEX_ROBUST_NORMAL_NP = 16,
+ PTHREAD_MUTEX_ROBUST_RECURSIVE_NP
+ = PTHREAD_MUTEX_ROBUST_NORMAL_NP | PTHREAD_MUTEX_RECURSIVE_NP,
+ PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP
+ = PTHREAD_MUTEX_ROBUST_NORMAL_NP | PTHREAD_MUTEX_ERRORCHECK_NP,
+ PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP
+ = PTHREAD_MUTEX_ROBUST_NORMAL_NP | PTHREAD_MUTEX_ADAPTIVE_NP,
PTHREAD_MUTEX_PRIO_INHERIT_PRIVATE_NP = 32,
PTHREAD_MUTEX_PRIO_PROTECT_PRIVATE_NP = 64
};
@@ -128,6 +129,11 @@
/* Number of threads running. */
extern unsigned int __nptl_nthreads attribute_hidden;
+#ifndef __ASSUME_SET_ROBUST_LIST
+/* Negative if we do not have the system call and we can use it. */
+extern int __set_robust_list_avail attribute_hidden;
+#endif
+
/* The library can run in debugging mode where it performs a lot more
tests. */
extern int __pthread_debug attribute_hidden;
@@ -504,4 +510,15 @@
# define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name);
#endif
+
+#ifndef __NR_set_robust_list
+/* XXX For the time being... Once we can rely on the kernel headers
+ having the definition remove these lines. */
+# if defined __i386__
+# define __NR_set_robust_list 311
+# elif defined __x86_64__
+# define __NR_set_robust_list 273
+# endif
+#endif
+
#endif /* pthreadP.h */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_create.c new/nptl/pthread_create.c
--- old/nptl/pthread_create.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_create.c 2006-03-28 10:21:09.000000000 +0200
@@ -229,6 +229,19 @@
/* Initialize resolver state pointer. */
__resp = &pd->res;
+#ifdef __NR_set_robust_list
+# ifndef __ASSUME_SET_ROBUST_LIST
+ if (__set_robust_list_avail >= 0)
+# endif
+ {
+ INTERNAL_SYSCALL_DECL (err);
+ /* This call should never fail because the initial call in init.c
+ succeeded. */
+ INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
+ sizeof (struct robust_list_head));
+ }
+#endif
+
/* This is where the try/finally block should be created. For
compilers without that support we do use setjmp. */
struct pthread_unwind_buf unwind_buf;
@@ -310,35 +323,34 @@
the breakpoint reports TD_THR_RUN state rather than TD_THR_ZOMBIE. */
atomic_bit_set (&pd->cancelhandling, EXITING_BIT);
+#ifndef __ASSUME_SET_ROBUST_LIST
/* If this thread has any robust mutexes locked, handle them now. */
-#if __WORDSIZE == 64
- __pthread_list_t *robust = pd->robust_list.__next;
-#else
+# if __WORDSIZE == 64
+ void *robust = pd->robust_head.list;
+# else
__pthread_slist_t *robust = pd->robust_list.__next;
-#endif
- if (__builtin_expect (robust != &pd->robust_list, 0))
+# endif
+/* We let the kernel do the notification if it is able to do so. */
+ if (__set_robust_list_avail < 0
+ && __builtin_expect (robust != &pd->robust_head, 0))
{
do
{
struct __pthread_mutex_s *this = (struct __pthread_mutex_s *)
- ((char *) robust - offsetof (struct __pthread_mutex_s, __list));
- robust = robust->__next;
+ ((char *) robust - offsetof (struct __pthread_mutex_s,
+ __list.__next));
+ robust = *((void **) robust);
- this->__list.__next = NULL;
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
+# ifdef __PTHREAD_MUTEX_HAVE_PREV
this->__list.__prev = NULL;
-#endif
+# endif
+ this->__list.__next = NULL;
lll_robust_mutex_dead (this->__lock);
}
- while (robust != &pd->robust_list);
-
- /* Clean up so that the thread descriptor can be reused. */
- pd->robust_list.__next = &pd->robust_list;
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
- pd->robust_list.__prev = &pd->robust_list;
-#endif
+ while (robust != &pd->robust_head);
}
+#endif
/* If the thread is detached free the TCB. */
if (IS_DETACHED (pd))
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_consistent.c new/nptl/pthread_mutex_consistent.c
--- old/nptl/pthread_mutex_consistent.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_mutex_consistent.c 2006-03-28 10:21:09.000000000 +0200
@@ -26,7 +26,7 @@
pthread_mutex_t *mutex;
{
/* Test whether this is a robust mutex with a dead owner. */
- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_PRIVATE_NP) == 0
+ if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0
|| mutex->__data.__owner != PTHREAD_MUTEX_INCONSISTENT)
return EINVAL;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_destroy.c new/nptl/pthread_mutex_destroy.c
--- old/nptl/pthread_mutex_destroy.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_mutex_destroy.c 2006-03-28 10:21:09.000000000 +0200
@@ -25,15 +25,9 @@
__pthread_mutex_destroy (mutex)
pthread_mutex_t *mutex;
{
- if (mutex->__data.__nusers != 0)
- {
- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_PRIVATE_NP) != 0
- && (mutex->__data.__lock & FUTEX_OWNER_DIED) != 0
- && mutex->__data.__nusers == 1)
- goto dead_robust_mutex;
-
- return EBUSY;
- }
+ if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0
+ && mutex->__data.__nusers != 0)
+ return EBUSY;
/* Set to an invalid value. */
dead_robust_mutex:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_init.c new/nptl/pthread_mutex_init.c
--- old/nptl/pthread_mutex_init.c 2006-02-28 10:55:16.000000000 +0100
+++ new/nptl/pthread_mutex_init.c 2006-03-28 10:21:09.000000000 +0200
@@ -22,7 +22,6 @@
#include
#include "pthreadP.h"
-
static const struct pthread_mutexattr default_attr =
{
/* Default is a normal mutex, not shared between processes. */
@@ -42,10 +41,6 @@
imutexattr = (const struct pthread_mutexattr *) mutexattr ?: &default_attr;
/* Sanity checks. */
- // XXX For now we cannot implement robust mutexes if they are shared.
- if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0
- && (imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0)
- return ENOTSUP;
// XXX For now we don't support priority inherited or priority protected
// XXX mutexes.
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK)
@@ -57,8 +52,18 @@
/* Copy the values from the attribute. */
mutex->__data.__kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
+
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0)
- mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_PRIVATE_NP;
+ {
+#ifndef __ASSUME_SET_ROBUST_LIST
+ if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0
+ && __set_robust_list_avail < 0)
+ return ENOTSUP;
+#endif
+
+ mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP;
+ }
+
switch ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK)
>> PTHREAD_MUTEXATTR_PROTOCOL_SHIFT)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_lock.c new/nptl/pthread_mutex_lock.c
--- old/nptl/pthread_mutex_lock.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_mutex_lock.c 2006-03-28 10:21:09.000000000 +0200
@@ -108,25 +108,33 @@
assert (mutex->__data.__owner == 0);
break;
- case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_RECURSIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP:
+ case PTHREAD_MUTEX_ROBUST_NORMAL_NP:
+ case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ &mutex->__data.__list.__next);
+
oldval = mutex->__data.__lock;
do
{
+ again:
if ((oldval & FUTEX_OWNER_DIED) != 0)
{
/* The previous owner died. Try locking the mutex. */
- int newval;
- while ((newval
- = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
- id, oldval))
- != oldval)
+ int newval = id;
+#ifdef NO_INCR
+ newval |= FUTEX_WAITERS;
+#endif
+
+ newval
+ = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
+ newval, oldval);
+
+ if (newval != oldval)
{
- if ((newval & FUTEX_OWNER_DIED) == 0)
- goto normal;
oldval = newval;
+ goto again;
}
/* We got the mutex. */
@@ -135,6 +143,7 @@
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
ENQUEUE_MUTEX (mutex);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Note that we deliberately exit here. If we fall
through to the end of the function __nusers would be
@@ -149,18 +158,23 @@
return EOWNERDEAD;
}
- normal:
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((mutex->__data.__lock & FUTEX_TID_MASK)
- == id, 0))
+ if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
{
if (mutex->__data.__kind
- == PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP)
- return EDEADLK;
+ == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
+ {
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ NULL);
+ return EDEADLK;
+ }
if (mutex->__data.__kind
- == PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP)
+ == PTHREAD_MUTEX_ROBUST_RECURSIVE_NP)
{
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ NULL);
+
/* Just bump the counter. */
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
/* Overflow of the counter. */
@@ -180,6 +194,7 @@
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
lll_mutex_unlock (mutex->__data.__lock);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
}
}
@@ -187,6 +202,7 @@
mutex->__data.__count = 1;
ENQUEUE_MUTEX (mutex);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
default:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_timedlock.c new/nptl/pthread_mutex_timedlock.c
--- old/nptl/pthread_mutex_timedlock.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_mutex_timedlock.c 2006-03-28 10:21:09.000000000 +0200
@@ -103,25 +103,27 @@
}
break;
- case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_RECURSIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP:
+ case PTHREAD_MUTEX_ROBUST_NORMAL_NP:
+ case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ &mutex->__data.__list.__next);
+
oldval = mutex->__data.__lock;
do
{
+ again:
if ((oldval & FUTEX_OWNER_DIED) != 0)
{
/* The previous owner died. Try locking the mutex. */
- int newval;
- while ((newval
- = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
- id, oldval))
- != oldval)
+ int newval
+ = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
+ id, oldval);
+ if (newval != oldval)
{
- if ((newval & FUTEX_OWNER_DIED) == 0)
- goto normal;
oldval = newval;
+ goto again;
}
/* We got the mutex. */
@@ -130,6 +132,7 @@
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
ENQUEUE_MUTEX (mutex);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Note that we deliberately exist here. If we fall
through to the end of the function __nusers would be
@@ -138,18 +141,23 @@
return EOWNERDEAD;
}
- normal:
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((mutex->__data.__lock & FUTEX_TID_MASK)
- == id, 0))
+ if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
{
if (mutex->__data.__kind
- == PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP)
- return EDEADLK;
+ == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
+ {
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ NULL);
+ return EDEADLK;
+ }
if (mutex->__data.__kind
- == PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP)
+ == PTHREAD_MUTEX_ROBUST_RECURSIVE_NP)
{
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ NULL);
+
/* Just bump the counter. */
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
/* Overflow of the counter. */
@@ -170,6 +178,7 @@
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
lll_mutex_unlock (mutex->__data.__lock);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
}
@@ -182,6 +191,7 @@
mutex->__data.__count = 1;
ENQUEUE_MUTEX (mutex);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
default:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_trylock.c new/nptl/pthread_mutex_trylock.c
--- old/nptl/pthread_mutex_trylock.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_mutex_trylock.c 2006-03-28 10:21:09.000000000 +0200
@@ -77,25 +77,28 @@
return 0;
- case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_RECURSIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP:
+ case PTHREAD_MUTEX_ROBUST_NORMAL_NP:
+ case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ &mutex->__data.__list.__next);
+
oldval = mutex->__data.__lock;
do
{
+ again:
if ((oldval & FUTEX_OWNER_DIED) != 0)
{
/* The previous owner died. Try locking the mutex. */
- int newval;
- while ((newval
- = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
- id, oldval))
- != oldval)
+ int newval
+ = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
+ id, oldval);
+
+ if (newval != oldval)
{
- if ((newval & FUTEX_OWNER_DIED) == 0)
- goto normal;
oldval = newval;
+ goto again;
}
/* We got the mutex. */
@@ -104,6 +107,7 @@
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
ENQUEUE_MUTEX (mutex);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Note that we deliberately exist here. If we fall
through to the end of the function __nusers would be
@@ -112,18 +116,23 @@
return EOWNERDEAD;
}
- normal:
/* Check whether we already hold the mutex. */
- if (__builtin_expect ((mutex->__data.__lock & FUTEX_TID_MASK)
- == id, 0))
+ if (__builtin_expect ((oldval & FUTEX_TID_MASK) == id, 0))
{
if (mutex->__data.__kind
- == PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP)
- return EDEADLK;
+ == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
+ {
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ NULL);
+ return EDEADLK;
+ }
if (mutex->__data.__kind
- == PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP)
+ == PTHREAD_MUTEX_ROBUST_RECURSIVE_NP)
{
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ NULL);
+
/* Just bump the counter. */
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
/* Overflow of the counter. */
@@ -137,7 +146,11 @@
oldval = lll_robust_mutex_trylock (mutex->__data.__lock, id);
if (oldval != 0 && (oldval & FUTEX_OWNER_DIED) == 0)
- return EBUSY;
+ {
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
+
+ return EBUSY;
+ }
robust:
if (__builtin_expect (mutex->__data.__owner
@@ -147,12 +160,14 @@
mutex->__data.__count = 0;
if (oldval == id)
lll_mutex_unlock (mutex->__data.__lock);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
}
}
while ((oldval & FUTEX_OWNER_DIED) != 0);
ENQUEUE_MUTEX (mutex);
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
mutex->__data.__owner = id;
++mutex->__data.__nusers;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/pthread_mutex_unlock.c new/nptl/pthread_mutex_unlock.c
--- old/nptl/pthread_mutex_unlock.c 2006-02-16 10:24:36.000000000 +0100
+++ new/nptl/pthread_mutex_unlock.c 2006-03-28 10:21:09.000000000 +0200
@@ -63,10 +63,12 @@
lll_mutex_unlock (mutex->__data.__lock);
break;
- case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_RECURSIVE_NP:
/* Recursive mutex. */
if ((mutex->__data.__lock & FUTEX_TID_MASK)
- == THREAD_GETMEM (THREAD_SELF, tid))
+ == THREAD_GETMEM (THREAD_SELF, tid)
+ && __builtin_expect (mutex->__data.__owner
+ == PTHREAD_MUTEX_INCONSISTENT, 0))
{
if (--mutex->__data.__count != 0)
/* We still hold the mutex. */
@@ -84,9 +86,9 @@
goto robust;
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
- case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
+ case PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP:
+ case PTHREAD_MUTEX_ROBUST_NORMAL_NP:
+ case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
if ((mutex->__data.__lock & FUTEX_TID_MASK)
!= THREAD_GETMEM (THREAD_SELF, tid)
|| ! lll_mutex_islocked (mutex->__data.__lock))
@@ -102,6 +104,8 @@
robust:
/* Remove mutex from the list. */
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ &mutex->__data.__list.__next);
DEQUEUE_MUTEX (mutex);
mutex->__data.__owner = newowner;
@@ -111,6 +115,8 @@
/* Unlock. */
lll_robust_mutex_unlock (mutex->__data.__lock);
+
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
default:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/nptl/tst-robust8.c new/nptl/tst-robust8.c
--- old/nptl/tst-robust8.c 1970-01-01 01:00:00.000000000 +0100
+++ new/nptl/tst-robust8.c 2006-03-28 06:12:46.000000000 +0200
@@ -0,0 +1,264 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 3
+#include "../test-skeleton.c"
+
+
+static int fd;
+#define N 100
+
+static void
+prepare (void)
+{
+ fd = create_temp_file ("tst-robust8", NULL);
+ if (fd == -1)
+ exit (1);
+}
+
+
+#define THESIGNAL SIGKILL
+#define ROUNDS 5
+#define THREADS 9
+
+
+static const struct timespec before = { 0, 0 };
+
+
+static pthread_mutex_t *map;
+
+
+static void *
+tf (void *arg)
+{
+ long int nr = (long int) arg;
+ int fct = nr % 3;
+
+ uint8_t state[N];
+ memset (state, '\0', sizeof (state));
+
+ while (1)
+ {
+ int r = random () % N;
+ if (state[r] == 0)
+ {
+ int e;
+
+ switch (fct)
+ {
+ case 0:
+ e = pthread_mutex_lock (&map[r]);
+ if (e != 0)
+ {
+ printf ("mutex_lock of %d in thread %ld failed with %d\n",
+ r, nr, e);
+ exit (1);
+ }
+ state[r] = 1;
+ break;
+ case 1:
+ e = pthread_mutex_timedlock (&map[r], &before);
+ if (e != 0 && e != ETIMEDOUT)
+ {
+ printf ("\
+mutex_timedlock of %d in thread %ld failed with %d\n",
+ r, nr, e);
+ exit (1);
+ }
+ break;
+ default:
+ e = pthread_mutex_trylock (&map[r]);
+ if (e != 0 && e != EBUSY)
+ {
+ printf ("mutex_trylock of %d in thread %ld failed with %d\n",
+ r, nr, e);
+ exit (1);
+ }
+ break;
+ }
+
+ if (e == EOWNERDEAD)
+ pthread_mutex_consistent_np (&map[r]);
+
+ if (e == 0 || e == EOWNERDEAD)
+ state[r] = 1;
+ }
+ else
+ {
+ int e = pthread_mutex_unlock (&map[r]);
+ if (e != 0)
+ {
+ printf ("mutex_unlock of %d in thread %ld failed with %d\n",
+ r, nr, e);
+ exit (1);
+ }
+
+ state[r] = 0;
+ }
+ }
+}
+
+
+static void
+child (int round)
+{
+ for (int thread = 1; thread <= THREADS; ++thread)
+ {
+ pthread_t th;
+ if (pthread_create (&th, NULL, tf, (void *) (long int) thread) != 0)
+ {
+ printf ("cannot create thread %d in round %d\n", thread, round);
+ exit (1);
+ }
+ }
+
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000000000 / ROUNDS;
+ while (nanosleep (&ts, &ts) != 0)
+ /* nothing */;
+
+ /* Time to die. */
+ kill (getpid (), THESIGNAL);
+
+ /* We better never get here. */
+ abort ();
+}
+
+
+static int
+do_test (void)
+{
+ if (ftruncate (fd, N * sizeof (pthread_mutex_t)) != 0)
+ {
+ puts ("cannot size new file");
+ return 1;
+ }
+
+ map = mmap (NULL, N * sizeof (pthread_mutex_t), PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, 0);
+ if (map == MAP_FAILED)
+ {
+ puts ("mapping failed");
+ return 1;
+ }
+
+ pthread_mutexattr_t ma;
+ if (pthread_mutexattr_init (&ma) != 0)
+ {
+ puts ("mutexattr_init failed");
+ return 0;
+ }
+ if (pthread_mutexattr_setrobust_np (&ma, PTHREAD_MUTEX_ROBUST_NP) != 0)
+ {
+ puts ("mutexattr_setrobust failed");
+ return 1;
+ }
+ if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0)
+ {
+ puts ("mutexattr_setpshared failed");
+ return 1;
+ }
+
+ for (int round = 1; round <= ROUNDS; ++round)
+ {
+ for (int n = 0; n < N; ++n)
+ {
+ int e = pthread_mutex_init (&map[n], &ma);
+ if (e == ENOTSUP)
+ {
+ puts ("cannot support pshared robust mutexes");
+ return 0;
+ }
+ if (e != 0)
+ {
+ printf ("mutex_init %d in round %d failed\n", n + 1, round);
+ return 1;
+ }
+ }
+
+ pid_t p = fork ();
+ if (p == -1)
+ {
+ printf ("fork in round %d failed\n", round);
+ return 1;
+ }
+ if (p == 0)
+ child (round);
+
+ int status;
+ if (TEMP_FAILURE_RETRY (waitpid (p, &status, 0)) != p)
+ {
+ printf ("waitpid in round %d failed\n", round);
+ return 1;
+ }
+ if (!WIFSIGNALED (status))
+ {
+ printf ("child did not die of a signal in round %d\n", round);
+ return 1;
+ }
+ if (WTERMSIG (status) != THESIGNAL)
+ {
+ printf ("child did not die of signal %d in round %d\n",
+ THESIGNAL, round);
+ return 1;
+ }
+
+ for (int n = 0; n < N; ++n)
+ {
+ int e = pthread_mutex_lock (&map[n]);
+ if (e != 0 && e != EOWNERDEAD)
+ {
+ printf ("mutex_lock %d failed in round %d\n", n + 1, round);
+ return 1;
+ }
+ }
+
+ for (int n = 0; n < N; ++n)
+ if (pthread_mutex_unlock (&map[n]) != 0)
+ {
+ printf ("mutex_unlock %d failed in round %d\n", n + 1, round);
+ return 1;
+ }
+
+ for (int n = 0; n < N; ++n)
+ {
+ int e = pthread_mutex_destroy (&map[n]);
+ if (e != 0)
+ {
+ printf ("mutex_destroy %d in round %d failed with %d\n",
+ n + 1, round, e);
+ printf("nusers = %d\n", (int) map[n].__data.__nusers);
+ return 1;
+ }
+ }
+ }
+
+ if (pthread_mutexattr_destroy (&ma) != 0)
+ {
+ puts ("mutexattr_destroy failed");
+ return 1;
+ }
+
+ if (munmap (map, N * sizeof (pthread_mutex_t)) != 0)
+ {
+ puts ("munmap failed");
+ return 1;
+ }
+
+ return 0;
+}
++++++ kernel-headers.dif ++++++
--- /var/tmp/diff_new_pack.YF7eJq/_old 2006-04-05 17:03:54.000000000 +0200
+++ /var/tmp/diff_new_pack.YF7eJq/_new 2006-04-05 17:03:54.000000000 +0200
@@ -737,17 +737,6 @@
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_PAGE_H */
---- asm-powerpc/sigcontext.h
-+++ asm-powerpc/sigcontext.h 2006/03/24 13:57:10
-@@ -10,7 +10,7 @@
- #include
- #include
- #ifdef __powerpc64__
--#include
-+#include
- #endif
-
- struct sigcontext {
--- asm-powerpc/types.h
+++ asm-powerpc/types.h 2006/03/24 13:57:10
@@ -40,7 +40,7 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...