Back to index

openldap  2.4.31
Defines
Windows Compatibility Macros
MDB Internals

A bunch of macros to minimize the amount of platform-specific ifdefs needed throughout the rest of the code. More...

Collaboration diagram for Windows Compatibility Macros:

Defines

#define LOCK_MUTEX_R(env)   pthread_mutex_lock(&(env)->me_txns->mti_mutex)
 Lock the reader mutex.
#define UNLOCK_MUTEX_R(env)   pthread_mutex_unlock(&(env)->me_txns->mti_mutex)
 Unlock the reader mutex.
#define LOCK_MUTEX_W(env)   pthread_mutex_lock(&(env)->me_txns->mti_wmutex)
 Lock the writer mutex.
#define UNLOCK_MUTEX_W(env)   pthread_mutex_unlock(&(env)->me_txns->mti_wmutex)
 Unlock the writer mutex.
#define ErrCode()   errno
 Get the error code for the last failed system function.
#define HANDLE   int
 An abstraction for a file handle.
#define INVALID_HANDLE_VALUE   (-1)
 A value for an invalid file handle.
#define GET_PAGESIZE(x)   ((x) = sysconf(_SC_PAGE_SIZE))
 Get the size of a memory page for the system.
#define MNAME_LEN   (sizeof(pthread_mutex_t))

Detailed Description

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.


Define Documentation

#define ErrCode ( )    errno

Get the error code for the last failed system function.

Definition at line 182 of file mdb.c.

#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.

Definition at line 200 of file mdb.c.

#define HANDLE   int

An abstraction for a file handle.

On POSIX systems file handles are small integers. On Windows they're opaque pointers.

Definition at line 188 of file mdb.c.

#define INVALID_HANDLE_VALUE   (-1)

A value for an invalid file handle.

Mainly used to initialize file variables and signify that they are unused.

Definition at line 194 of file mdb.c.

#define LOCK_MUTEX_R (   env)    pthread_mutex_lock(&(env)->me_txns->mti_mutex)

Lock the reader mutex.

Definition at line 165 of file mdb.c.

#define LOCK_MUTEX_W (   env)    pthread_mutex_lock(&(env)->me_txns->mti_wmutex)

Lock the writer mutex.

Only a single write transaction is allowed at a time. Other writers will block waiting for this mutex.

Definition at line 174 of file mdb.c.

#define MNAME_LEN   (sizeof(pthread_mutex_t))

Definition at line 206 of file mdb.c.

#define UNLOCK_MUTEX_R (   env)    pthread_mutex_unlock(&(env)->me_txns->mti_mutex)

Unlock the reader mutex.

Definition at line 168 of file mdb.c.

#define UNLOCK_MUTEX_W (   env)    pthread_mutex_unlock(&(env)->me_txns->mti_wmutex)

Unlock the writer mutex.

Definition at line 177 of file mdb.c.