Please try this patch, I can't. It's split up for readability.
Replace defined(BSD) in 1st patch with defined(__BSD__) or whatever,
Also, maybe we can drop __APPLE__ - it may #define __BSD__ too.
ANDROID should be something like __ANDROID__. I can't test either.
defined(BSD) breaks in strict ISO C mode. Is there a symbol like
__BSD__ or __BSD to use instead?
Namespace-wise, "MDB_USE_POSIX_SEM" would be better.
MDB_FDATASYNC should not depend on USE_POSIX_SEM.
We can #ifndef PTHREAD_PROCESS_SHARED instead of BSD, unless someone
#define it without supporting it. Not for MDB_FDATASYNC though.