SUMMARY 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. Seems to me that for the purpose of the test the second wrlock could become a trywrlock; I verified that in this case, drd on FreeBSD detects the attempted recursion and spits out the error message expected by the test. I can submit a patch if there are no objections to this approach. STEPS TO REPRODUCE 1. run drd/tests/trylock on FreeBSD OBSERVED RESULT trylock hangs and requires a ctrl-C. EXPECTED RESULT The test program should complete.
This proposal sounds good to me.
I've dealt with this in my git repo by putting the double call to wrlock in a conditional compilation block. https://github.com/paulfloyd/freebsd_valgrind/commit/abf44418d52416a625445c782f79717d7b06cadd
A candidate fix has been checked in as commit 20dc7278512c ("drd/tests/trylock, FreeBSD: Fix a hang"). I'm not familiar enough with FreeBSD to review the changes in FreeBSD-specific code.