.TH "compat" 3 "Wed Mar 25 2020" "LMDB" \" -*- nroff -*- .ad l .nh .SH NAME compat \- A bunch of macros to minimize the amount of platform-specific ifdefs needed throughout the rest of the code\&. When the features this library needs are similar enough to POSIX to be hidden in a one-or-two line replacement, this macro approach is used\&. .SH SYNOPSIS .br .PP .SS "Macros" .in +1c .ti -1c .RI "#define \fBMDB_DEVEL\fP 0" .br .ti -1c .RI "#define \fBmdb_func_\fP ''" .br .ti -1c .RI "#define \fBMDB_NO_ROOT\fP (\fBMDB_LAST_ERRCODE\fP + 10)" .br .ti -1c .RI "#define \fBMDB_USE_ROBUST\fP 1" .br .ti -1c .RI "#define \fBTHREAD_RET\fP void *" .br .ti -1c .RI "#define \fBTHREAD_CREATE\fP(thr, start, arg) pthread_create(&thr,NULL,start,arg)" .br .ti -1c .RI "#define \fBTHREAD_FINISH\fP(thr) pthread_join(thr,NULL)" .br .ti -1c .RI "#define \fBZ\fP 'z'" .br .ti -1c .RI "#define \fBMDB_PIDLOCK\fP 1" .br .ti -1c .RI "#define \fBLOCK_MUTEX0\fP(mutex) pthread_mutex_lock(mutex)" .br .ti -1c .RI "#define \fBUNLOCK_MUTEX\fP(mutex) pthread_mutex_unlock(mutex)" .br .ti -1c .RI "#define \fBmdb_mutex_consistent\fP(mutex) pthread_mutex_consistent(mutex)" .br .ti -1c .RI "#define \fBErrCode\fP() errno" .br .ti -1c .RI "#define \fBHANDLE\fP int" .br .ti -1c .RI "#define \fBINVALID_HANDLE_VALUE\fP (\-1)" .br .ti -1c .RI "#define \fBGET_PAGESIZE\fP(x) ((x) = sysconf(_SC_PAGE_SIZE))" .br .ti -1c .RI "#define \fBMNAME_LEN\fP (sizeof(pthread_mutex_t))" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef pthread_mutex_t \fBmdb_mutex_t\fP[1]" .br .ti -1c .RI "typedef pthread_mutex_t * \fBmdb_mutexref_t\fP" .br .in -1c .SH "Detailed Description" .PP A bunch of macros to minimize the amount of platform-specific ifdefs needed throughout the rest of the code\&. When the features this library needs are similar enough to POSIX to be hidden in a one-or-two line replacement, this macro approach is used\&. .SH "Macro Definition Documentation" .PP .SS "#define MDB_DEVEL 0" Features under development .SS "#define mdb_func_ ''" Wrapper around \fBfunc\fP, which is a C99 feature .SS "#define MDB_USE_ROBUST 1" Some platforms define the EOWNERDEAD error code even though they don't support Robust Mutexes\&. Compile with -DMDB_USE_ROBUST=0, or use some other mechanism like -DMDB_USE_POSIX_SEM instead of -DMDB_USE_POSIX_MUTEX\&. (Posix semaphores are not robust\&.) .SS "#define Z 'z'" printf format modifier for size_t .SS "#define MDB_PIDLOCK 1" For MDB_LOCK_FORMAT: True if readers take a pid lock in the lockfile .SS "#define LOCK_MUTEX0(mutex) pthread_mutex_lock(mutex)" Lock the reader or writer mutex\&. Returns 0 or a code to give mdb_mutex_failed(), as in LOCK_MUTEX()\&. .SS "#define UNLOCK_MUTEX(mutex) pthread_mutex_unlock(mutex)" Unlock the reader or writer mutex\&. .SS "#define mdb_mutex_consistent(mutex) pthread_mutex_consistent(mutex)" Mark mutex-protected data as repaired, after death of previous owner\&. .SS "#define ErrCode() errno" Get the error code for the last failed system function\&. .SS "#define HANDLE int" An abstraction for a file handle\&. On POSIX systems file handles are small integers\&. On Windows they're opaque pointers\&. .SS "#define INVALID_HANDLE_VALUE (\-1)" A value for an invalid file handle\&. Mainly used to initialize file variables and signify that they are unused\&. .SS "#define GET_PAGESIZE(x) ((x) = sysconf(_SC_PAGE_SIZE))" Get the size of a memory page for the system\&. This is the basic size that the platform's memory manager uses, and is fundamental to the use of memory-mapped files\&. .SH "Typedef Documentation" .PP .SS "typedef pthread_mutex_t mdb_mutex_t[1]" Shared mutex/semaphore as the original is stored\&. .PP Not for copies\&. Instead it can be assigned to an \fBmdb_mutexref_t\fP\&. When mdb_mutexref_t is a pointer and mdb_mutex_t is not, then it is array[size 1] so it can be assigned to the pointer\&. .SS "typedef pthread_mutex_t* \fBmdb_mutexref_t\fP" Reference to an \fBmdb_mutex_t\fP .SH "Author" .PP Generated automatically by Doxygen for LMDB from the source code\&.