Add a few more error messages to db locking

This could be useful when things don't work as expected. STDERR only.
introspection: don't fail in perl code on OSX
Convert some #defines with values like 2**x to enums with bitshifts