The test code in drd/tests/trylock.c attempts to write-lock a POSIX rwlock
twice. The code expects the second attempt to return an error, but POSIX
doesn't require that behaviour, and FreeBSD's implementation deadlocks
instead.
See also https://bugs.kde.org/show_bug.cgi?id=403212
Reported-by: Mark Johnston <markj@FreeBSD.org>
385386 Assertion failed "szB >= CACHE_ENTRY_SIZE" at m_debuginfo/image.c:517
400593 In Coregrind, use statx for some internal syscalls if [f]stat[64] fail
400872 Add nanoMIPS support to Valgrind
+403212 drd/tests/trylock hangs on FreeBSD
404406 s390x: z14 miscellaneous instructions not implemented
405201 Incorrect size of struct vki_siginfo on 64-bit Linux architectures
406561 mcinfcallWSRU gdbserver_test fails on ppc64
#define _GNU_SOURCE 1
#include "../../config.h"
+#include <errno.h>
#include <stdio.h>
#include <assert.h>
#include <pthread.h>
#endif
fprintf(stderr, "Attempt to lock for writing recursively (not allowed).\n");
r = pthread_rwlock_wrlock(&rwlock); assert(r == 0);
- r = pthread_rwlock_wrlock(&rwlock); assert(r != 0);
+ r = pthread_rwlock_trywrlock(&rwlock); assert(r == EBUSY);
r = pthread_rwlock_unlock(&rwlock); assert(r == 0);
r = pthread_rwlock_destroy(&rwlock); assert(r == 0);
Locking rwlock via pthread_rwlock_timedrdlock().
Attempt to lock for writing recursively (not allowed).
Recursive writer locking not allowed: rwlock 0x.........
- at 0x........: pthread_rwlock_wrlock (drd_pthread_intercepts.c:?)
+ at 0x........: pthread_rwlock_trywrlock (drd_pthread_intercepts.c:?)
by 0x........: main (trylock.c:?)
rwlock 0x........ was first observed at:
at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?)