fix db_concurrent_test
Try to simplify apoptosis/DeleteConnection locking mess.
Select() error code is no longer lost because of recv().
Merge pull request #1678 from jimis/select_error_lost

Select() error code is no longer lost because of recv().
Merge pull request #1676 from jimis/serverd_deadlock_fix

Try to simplify apoptosis/DeleteConnection locking mess.
Don't use Read/WriteDB inside a cursor loop.

LMDB doesn't allow multiple transactions per thread. Opening a cursor
opens a transaction, and so does Read/WriteDB. So, either re-use values
from cursor, or populate a sequence with keys, and then lookup the
individual values in a separate loop.

Note: Previously, the WriteDB code reused the transaction from an open
cursor, but that is making the entire LMDB driver not thread-safe.
Merge pull request #1679 from vohi/fix_db_cursor_usage

Don't use Read/WriteDB inside a cursor loop.
Add LoadDatabaseToStringMap utility function
Merge pull request #1680 from maciejmrowiec/master

Add LoadDatabaseToStringMap utility function
Add assert against mixing cursor and regular DB calls.

Only active in debug mode.
Remove superflous include.

cf-key uses functions from lastseen, not the DB API directly.
Fix linker errors in unit tests.
Merge remote-tracking branch 'hichame/up/master_rc8b'

Conflicts:
	tests/unit/Makefile.am
port of fix from 3.5.x for issue #3408 - getprocs64 on aix
Merge pull request #1681 from kacfengine/assert_against_cursor_errors

Add assert against mixing cursor and regular DB calls.
Merge pull request #1683 from McAtte/port-fix-for-3408-aix-getprocs64

port of fix from 3.5.x for issue #3408 - getprocs64 on aix
new autoconf option to make state directory configurable: --with-statedir=<directory>
make use of preprocessor macros for static known_dirs.c functions
rename MAX_WORKDIR_LENGTH macro to generic MAX_DIR_LENGTH
add GetStateDir() and supporting functions