ITS#7959 fix prev commit

fstat returns -1, not an errno. Move code into its own function
for reuse.
ITS#7969 LMDB: volatile & __synchronize().

Globally shared fields of meta-data are not 'volatile'.
ITS#7970 LMDB: Critical Heisenbug

Inconsistent reading & SIGSEGV due to the race condition.
ITS#7971 LMDB: clarification in mdb_txn_renew0().
ITS#7961,#7987 Re-fix txn init.

More fallout from 4d02c741b120786df1b87ee9ed49c1d3f9bc7522:
Don't modify another thread's write txn. Reinit me_txn0 fully.
Simplify recent changes a bit.
Fix robust mutexes - repair mti_txnid.

Broken by e3b6c359a935283c21e1fd7d03b790d87d53b933, if
commit() crashes in write_meta before setting mti_txnid.
Clean up SysV semaphore code.

Change MDB_LOCK_FORMAT to differ from Posix semaphores/mutexes.
Do not use array/member length 0 for MDB_txninfo.mt2.
Fix comments
mdb_strerror: Silence warning @ Windows
Fix WIN32 -> _WIN32
For ITS#7789: Ensure mapsize >= pages in use.

Check new mapsizes against mm_last_pg.  Move
mdb_env_init_meta0() so it can set mm_last_pg earlier.
Fix SysV semaphores - repair mti_txnid.

Similar to 443a7e40c4280cfd07cbf80c5de62ea072b136e3.
ITS#7994 Access to current transaction ID.

I, David Barbour, hereby place the following modifications to OpenLDAP
Software (and only these modifications) into the public domain. Hence,
these modifications may be freely used and/or redistributed for any
purpose with or without attribution and/or other notice.
ITS#7994 fix prev commit

Strip docs promising behaviors that we don't promise to hold.
Strip MDB_txnid_t typedef.
ITS#7987 fix excessive space for single write txn
C90-compatible code for SysV semaphores
Clarify mdb_dbi_open doc

The concurrency restriction is on threads within a single process.
Multiple processes can use mdb_dbi_open without affecting each other.
Try to avoid an invalid datafile after failed init