* We could get rid of the last delta in 01_glibc_kludge.diff and the whole (hacky and ugly) 16-wrap-cdefs.diff if kfreebsd-kernel-headers would export cdefs.h like it does upstream [2].Could you fix this in kfreebsd-kernel-headers instead?
<sys/cdefs.h> comes from eglibc, it is same on all platforms. On the other hand, libbsd-dev provides it in "overlay" (bsd/sys/cdefs.h), may be it can be extended. Limitation is that it is libbsd-dev, not libfreebsd-dev.
* 15_pthread_compat.diff is a terrible hack. The upstream source uses pthread_mutex_isowned_np now which is supported in FreeBSD's libthr, but not in glibc pthread (apparently). The implementation of the function is simple, unfortunately our pthread_mutex_t type is not compatible either (seems to be a struct on FreeBSD, but (apparently) a scalar on glibc), so I made the code to be a no-op instead. Its usage is on assert() only, checking entry points of some functions. I guess disabling the call has no unwanted side effects on the functionality I hope.Maybe we can put it as inline stub in glibc headers instead? E.g. static inline pthread_mutex_isowned_np (...) { ... }
No, especially as layout of pthread_mutex_t is (should be) private to pthread library. You are only allowed to use library functions and static initializer to manipulate with it. I do anticipate that internal layout will be changed during move from linuxthreads based implementation.
Petr