Back to index

openldap  2.4.31
Classes | Defines | Typedefs | Functions | Variables
mdb.c File Reference

memory-mapped database library More...

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stddef.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <resolv.h>
#include <pthread.h>
#include "mdb.h"
#include "midl.h"

Go to the source code of this file.

Classes

struct  MDB_rxbody
 The information we store in a single slot of the reader table. More...
struct  MDB_reader
 The actual reader record, with cacheline padding. More...
struct  MDB_txbody
 The header for the reader table. More...
struct  MDB_txninfo
 The actual reader table definition. More...
struct  MDB_page
 Common header for all page types. More...
struct  MDB_node
 Header for a single key/data pair within a page. More...
struct  MDB_db
 Information about a single database in the environment. More...
struct  MDB_meta
 Meta page content. More...
union  MDB_pagebuf
 Buffer for a stack-allocated dirty page. More...
struct  MDB_dbx
 Auxiliary DB info. More...
struct  MDB_txn
 A database transaction. More...
struct  MDB_cursor
 Cursors are used for all DB operations. More...
struct  MDB_xcursor
 Context for sorted-dup records. More...
struct  MDB_oldpages
 A set of pages freed by an earlier transaction. More...
struct  MDB_env
 The database environment. More...
union  MDB_reader.mru
union  MDB_txninfo.mt1
union  MDB_txninfo.mt2
union  MDB_page.mp_p
union  MDB_page.mp_pb
struct  MDB_page.mp_pb.pb
struct  MDB_pagebuf.mb_metabuf
union  MDB_txn.mt_u

Defines

#define VGMEMP_CREATE(h, r, z)
#define VGMEMP_ALLOC(h, a, s)
#define VGMEMP_FREE(h, a)
#define VGMEMP_DESTROY(h)
#define VGMEMP_DEFINED(a, s)
#define BYTE_ORDER   __BYTE_ORDER
#define LITTLE_ENDIAN   __LITTLE_ENDIAN
#define BIG_ENDIAN   __BIG_ENDIAN
#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))
#define MDB_DSYNC   O_DSYNC
 A flag for opening a file and requesting synchronous data writes.
#define MDB_FDATASYNC   fdatasync
 Function for flushing the data of a file.
#define MDB_DEBUG   0
 Enable debug output.
#define DPRINTF   (void) /* Vararg macros may be unsupported */
#define DPUTS(arg)   DPRINTF("%s", arg)
 Print a debug string.
#define MDB_PAGESIZE   4096
 A default memory page size.
#define MDB_MINKEYS   2
 The minimum number of keys required in a database page.
#define MDB_MAGIC   0xBEEFC0DE
 A stamp that identifies a file as an MDB file.
#define MDB_VERSION   1
 The version number for a database's file format.
#define MAXKEYSIZE   511
 The maximum size of a key in the database.
#define DKBUF   typedef int dummy_kbuf /* so we can put ';' after */
#define DKEY(x)   0
#define LAZY_LOCKS   1
 Use lazy locking.
#define LAZY_MUTEX_LOCK(x)
 Grab the reader lock.
#define LAZY_MUTEX_UNLOCK(x)
 Release the reader lock.
#define LAZY_RWLOCK_UNLOCK(x)
 Release the DB table reader/writer lock.
#define LAZY_RWLOCK_WRLOCK(x)
 Grab the DB table write lock.
#define LAZY_RWLOCK_RDLOCK(x)
 Grab the DB table read lock.
#define LAZY_RWLOCK_DEF(x)
 Declare the DB table rwlock.
#define LAZY_RWLOCK_INIT(x, y)
 Initialize the DB table rwlock.
#define LAZY_RWLOCK_DESTROY(x)
 Destroy the DB table rwlock.
#define P_INVALID   (~0UL)
 An invalid page number.
#define F_ISSET(w, f)   (((w) & (f)) == (f))
 Test if a flag f is set in a flag word w.
#define DEFAULT_MAPSIZE   1048576
 Default size of memory map.
#define DEFAULT_READERS   126
 Number of slots in the reader table.
#define CACHELINE   64
 The size of a CPU cache line in bytes.
#define mr_txnid   mru.mrx.mrb_txnid
 shorthand for mrb_txnid
#define mr_pid   mru.mrx.mrb_pid
#define mr_tid   mru.mrx.mrb_tid
#define mti_magic   mt1.mtb.mtb_magic
#define mti_version   mt1.mtb.mtb_version
#define mti_mutex   mt1.mtb.mtb_mutex
#define mti_rmname   mt1.mtb.mtb_rmname
#define mti_txnid   mt1.mtb.mtb_txnid
#define mti_numreaders   mt1.mtb.mtb_numreaders
#define mti_me_toggle   mt1.mtb.mtb_me_toggle
#define mti_wmutex   mt2.mt2_wmutex
#define mp_pgno   mp_p.p_pgno
#define mp_next   mp_p.p_next
#define P_BRANCH   0x01
 branch page
#define P_LEAF   0x02
 leaf page
#define P_OVERFLOW   0x04
 overflow page
#define P_META   0x08
 meta page
#define P_DIRTY   0x10
 dirty page
#define P_LEAF2   0x20
 for MDB_DUPFIXED records
#define P_SUBP   0x40
 for MDB_DUPSORT sub-pages
#define mp_lower   mp_pb.pb.pb_lower
#define mp_upper   mp_pb.pb.pb_upper
#define mp_pages   mp_pb.pb_pages
#define PAGEHDRSZ   ((unsigned) offsetof(MDB_page, mp_ptrs))
 Size of the page header, excluding dynamic data at the end.
#define METADATA(p)   ((void *)((char *)(p) + PAGEHDRSZ))
 Address of first usable data byte in a page, after the header.
#define NUMKEYS(p)   (((p)->mp_lower - PAGEHDRSZ) >> 1)
 Number of nodes on a page.
#define SIZELEFT(p)   (indx_t)((p)->mp_upper - (p)->mp_lower)
 The amount of space remaining in the page.
#define PAGEFILL(env, p)
 The percentage of space used in the page, in tenths of a percent.
#define FILL_THRESHOLD   250
 The minimum page fill factor, in tenths of a percent.
#define IS_LEAF(p)   F_ISSET((p)->mp_flags, P_LEAF)
 Test if a page is a leaf page.
#define IS_LEAF2(p)   F_ISSET((p)->mp_flags, P_LEAF2)
 Test if a page is a LEAF2 page.
#define IS_BRANCH(p)   F_ISSET((p)->mp_flags, P_BRANCH)
 Test if a page is a branch page.
#define IS_OVERFLOW(p)   F_ISSET((p)->mp_flags, P_OVERFLOW)
 Test if a page is an overflow page.
#define IS_SUBP(p)   F_ISSET((p)->mp_flags, P_SUBP)
 Test if a page is a sub page.
#define OVPAGES(size, psize)   ((PAGEHDRSZ-1 + (size)) / (psize) + 1)
 The number of overflow pages needed to store the given size.
#define mn_lo   mn_offset[BYTE_ORDER!=LITTLE_ENDIAN]
 lo and hi are used for data size on leaf nodes and for child pgno on branch nodes.
#define mn_hi   mn_offset[BYTE_ORDER==LITTLE_ENDIAN]
 part of dsize or pgno
#define F_BIGDATA   0x01
 data put on overflow page
#define F_SUBDATA   0x02
 data is a sub-database
#define F_DUPDATA   0x04
 data has duplicates
#define NODE_ADD_FLAGS   (F_DUPDATA|F_SUBDATA|MDB_RESERVE|MDB_APPEND)
 valid flags for mdb_node_add()
#define NODESIZE   offsetof(MDB_node, mn_data)
 Size of the node header, excluding dynamic data at the end.
#define PGNO_TOPWORD   ((pgno_t)-1 > 0xffffffffu ? 32 : 0)
 Bit position of top word in page number, for shifting mn_flags.
#define INDXSIZE(k)   (NODESIZE + ((k) == NULL ? 0 : (k)->mv_size))
 Size of a node in a branch page with a given key.
#define LEAFSIZE(k, d)   (NODESIZE + (k)->mv_size + (d)->mv_size)
 Size of a node in a leaf page with a given key and data.
#define NODEPTR(p, i)   ((MDB_node *)((char *)(p) + (p)->mp_ptrs[i]))
 Address of node i in page p.
#define NODEKEY(node)   (void *)((node)->mn_data)
 Address of the key for the node.
#define NODEDATA(node)   (void *)((char *)(node)->mn_data + (node)->mn_ksize)
 Address of the data for a node.
#define NODEPGNO(node)
 Get the page number pointed to by a branch node.
#define SETPGNO(node, pgno)
 Set the page number in a branch node.
#define NODEDSZ(node)   ((node)->mn_lo | ((unsigned)(node)->mn_hi << 16))
 Get the size of the data in a leaf node.
#define SETDSZ(node, size)
 Set the size of the data for a leaf node.
#define NODEKSZ(node)   ((node)->mn_ksize)
 The size of a key in a node.
#define COPY_PGNO(dst, src)
 Copy a page number from src to dst.
#define LEAF2KEY(p, i, ks)   ((char *)(p) + PAGEHDRSZ + ((i)*(ks)))
 The address of a key in a LEAF2 page.
#define MDB_SET_KEY(node, key)
 Set the node's key into key, if requested.
#define FREE_DBI   0
 Handle for the DB used to track free pages.
#define MAIN_DBI   1
 Handle for the default DB.
#define mm_psize   mm_dbs[0].md_pad
 The size of pages used in this DB.
#define mm_flags   mm_dbs[0].md_flags
 Any persistent environment flags.
#define DB_DIRTY   0x01
 DB was written in this txn.
#define DB_STALE   0x02
 DB record is older than txnID.
#define MDB_TXN_RDONLY   0x01
 read-only transaction
#define MDB_TXN_ERROR   0x02
 an error has occurred
#define CURSOR_STACK   32
 Enough space for 2^32 nodes with minimum of 2 keys per node.
#define C_INITIALIZED   0x01
 cursor has been initialized and is valid
#define C_EOF   0x02
 No more data.
#define C_SUB   0x04
 Cursor is a sub-cursor.
#define C_SHADOW   0x08
 Cursor is a dup from a parent txn.
#define C_ALLOCD   0x10
 Cursor was malloc'd.
#define MDB_FATAL_ERROR   0x80000000U
 Failed to update the meta page.
#define MDB_COMMIT_PAGES   64
 max number of pages to commit in one writev() call
#define LOCKNAME   "/lock.mdb"
 The name of the lock file in the DB environment.
#define DATANAME   "/data.mdb"
 The name of the data file in the DB environment.
#define LOCKSUFF   "-lock"
 The suffix of the lock file when no subdir is used.
#define CHANGEABLE   (MDB_NOSYNC)
 Only a subset of the Environment Flags flags can be changed at runtime.

Typedefs

typedef ID pgno_t
 A page number in the database.
typedef ID txnid_t
 A transaction ID.
typedef uint16_t indx_t
 Used for offsets within a single page.
typedef struct MDB_rxbody MDB_rxbody
 The information we store in a single slot of the reader table.
typedef struct MDB_reader MDB_reader
 The actual reader record, with cacheline padding.
typedef struct MDB_txbody MDB_txbody
 The header for the reader table.
typedef struct MDB_txninfo MDB_txninfo
 The actual reader table definition.
typedef struct MDB_page MDB_page
 Common header for all page types.
typedef struct MDB_node MDB_node
 Header for a single key/data pair within a page.
typedef struct MDB_db MDB_db
 Information about a single database in the environment.
typedef struct MDB_meta MDB_meta
 Meta page content.
typedef union MDB_pagebuf MDB_pagebuf
 Buffer for a stack-allocated dirty page.
typedef struct MDB_dbx MDB_dbx
 Auxiliary DB info.
typedef struct MDB_xcursor MDB_xcursor
 Context for sorted-dup records.
typedef struct MDB_oldpages MDB_oldpages
 A set of pages freed by an earlier transaction.

Functions

static MDB_pagemdb_page_alloc (MDB_cursor *mc, int num)
 Allocate pages for writing.
static MDB_pagemdb_page_new (MDB_cursor *mc, uint32_t flags, int num)
 Allocate and initialize new pages for a database.
static int mdb_page_touch (MDB_cursor *mc)
 Touch a page: make it dirty and re-insert into tree with updated pgno.
static int mdb_page_get (MDB_txn *txn, pgno_t pgno, MDB_page **ret)
 Find the address of the page corresponding to a given page number.
static int mdb_page_search_root (MDB_cursor *mc, MDB_val *key, int modify)
 Search for the page a given key should be in.
static int mdb_page_search (MDB_cursor *mc, MDB_val *key, int modify)
 Search for the page a given key should be in.
static int mdb_page_merge (MDB_cursor *csrc, MDB_cursor *cdst)
 Merge one page into another.
static int mdb_page_split (MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno, unsigned int nflags)
 Split a page and insert a new node.
static int mdb_env_read_header (MDB_env *env, MDB_meta *meta)
 Read the environment parameters of a DB environment before mapping it into memory.
static int mdb_env_read_meta (MDB_env *env, int *which)
 Check both meta pages to see which one is newer.
static int mdb_env_write_meta (MDB_txn *txn)
 Update the environment info to commit a transaction.
static MDB_nodemdb_node_search (MDB_cursor *mc, MDB_val *key, int *exactp)
 Search for key within a page, using binary search.
static int mdb_node_add (MDB_cursor *mc, indx_t indx, MDB_val *key, MDB_val *data, pgno_t pgno, unsigned int flags)
 Add a node to the page pointed to by the cursor.
static void mdb_node_del (MDB_page *mp, indx_t indx, int ksize)
 Delete the specified node from a page.
static void mdb_node_shrink (MDB_page *mp, indx_t indx)
 Compact the main page after deleting a node on a subpage.
static int mdb_node_move (MDB_cursor *csrc, MDB_cursor *cdst)
 Move a node from csrc to cdst.
static int mdb_node_read (MDB_txn *txn, MDB_node *leaf, MDB_val *data)
 Return the data associated with a given node.
static size_t mdb_leaf_size (MDB_env *env, MDB_val *key, MDB_val *data)
 Calculate the size of a leaf node.
static size_t mdb_branch_size (MDB_env *env, MDB_val *key)
 Calculate the size of a branch node.
static int mdb_rebalance (MDB_cursor *mc)
 Rebalance the tree after a delete operation.
static int mdb_update_key (MDB_page *mp, indx_t indx, MDB_val *key)
 Replace the key for a node with a new key.
static void mdb_cursor_pop (MDB_cursor *mc)
 Pop a page off the top of the cursor's stack.
static int mdb_cursor_push (MDB_cursor *mc, MDB_page *mp)
 Push a page onto the top of the cursor's stack.
static int mdb_cursor_del0 (MDB_cursor *mc, MDB_node *leaf)
 Complete a delete operation started by mdb_cursor_del().
static int mdb_cursor_sibling (MDB_cursor *mc, int move_right)
 Find a sibling for a page.
static int mdb_cursor_next (MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
 Move the cursor to the next data item.
static int mdb_cursor_prev (MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
 Move the cursor to the previous data item.
static int mdb_cursor_set (MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op, int *exactp)
 Set the cursor on a specific data item.
static int mdb_cursor_first (MDB_cursor *mc, MDB_val *key, MDB_val *data)
 Move the cursor to the first item in the database.
static int mdb_cursor_last (MDB_cursor *mc, MDB_val *key, MDB_val *data)
 Move the cursor to the last item in the database.
static void mdb_cursor_init (MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx)
 Initialize a cursor for a given transaction and database.
static void mdb_xcursor_init0 (MDB_cursor *mc)
 Initial setup of a sorted-dups cursor.
static void mdb_xcursor_init1 (MDB_cursor *mc, MDB_node *node)
 Final setup of a sorted-dups cursor.
static int mdb_drop0 (MDB_cursor *mc, int subs)
 Add all the DB's pages to the free list.
static void mdb_default_cmp (MDB_txn *txn, MDB_dbi dbi)
 Set the default comparison functions for a database.
char * mdb_version (int *major, int *minor, int *patch)
 Return the library version info.
char * mdb_strerror (int err)
 Return a string describing a given error code.
int mdb_cmp (MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
 Compare two data items according to a particular database.
int mdb_dcmp (MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
 Compare two data items according to a particular database.
static MDB_pagemdb_page_malloc (MDB_cursor *mc)
 Allocate a single page.
int mdb_env_sync (MDB_env *env, int force)
 Flush the data buffers to disk.
static int mdb_cursor_shadow (MDB_txn *src, MDB_txn *dst)
 Make shadow copies of all of parent txn's cursors.
static void mdb_cursor_merge (MDB_txn *txn)
 Merge shadow cursors back into parent's.
static void mdb_txn_reset0 (MDB_txn *txn)
 Common code for mdb_txn_reset() and mdb_txn_abort().
static int mdb_txn_renew0 (MDB_txn *txn)
 Common code for mdb_txn_begin() and mdb_txn_renew().
int mdb_txn_renew (MDB_txn *txn)
 Renew a read-only transaction.
int mdb_txn_begin (MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret)
 Create a transaction for use with the environment.
void mdb_txn_reset (MDB_txn *txn)
 Reset a read-only transaction.
void mdb_txn_abort (MDB_txn *txn)
 Abandon all the operations of the transaction instead of saving them.
int mdb_txn_commit (MDB_txn *txn)
 Commit all the operations of a transaction into the database.
static int mdb_env_init_meta (MDB_env *env, MDB_meta *meta)
 Write the environment parameters of a freshly created DB environment.
int mdb_env_create (MDB_env **env)
 Create an MDB environment handle.
int mdb_env_set_mapsize (MDB_env *env, size_t size)
 Set the size of the memory map to use for this environment.
int mdb_env_set_maxdbs (MDB_env *env, MDB_dbi dbs)
 Set the maximum number of databases for the environment.
int mdb_env_set_maxreaders (MDB_env *env, unsigned int readers)
 Set the maximum number of threads for the environment.
int mdb_env_get_maxreaders (MDB_env *env, unsigned int *readers)
 Get the maximum number of threads for the environment.
static int mdb_env_open2 (MDB_env *env, unsigned int flags)
 Further setup required for opening an MDB environment.
static void mdb_env_reader_dest (void *ptr)
 Release a reader thread's slot in the reader lock table.
static void mdb_env_share_locks (MDB_env *env)
 Downgrade the exclusive lock on the region back to shared.
static int mdb_env_setup_locks (MDB_env *env, char *lpath, int mode, int *excl)
 Open and/or initialize the lock region for the environment.
int mdb_env_open (MDB_env *env, const char *path, unsigned int flags, mode_t mode)
 Open an environment handle.
void mdb_env_close (MDB_env *env)
 Close the environment and release the memory map.
static int mdb_cmp_long (const MDB_val *a, const MDB_val *b)
 Compare two items pointing at aligned size_t's.
static int mdb_cmp_int (const MDB_val *a, const MDB_val *b)
 Compare two items pointing at aligned int's.
static int mdb_cmp_cint (const MDB_val *a, const MDB_val *b)
 Compare two items pointing at ints of unknown alignment.
static int mdb_cmp_memn (const MDB_val *a, const MDB_val *b)
 Compare two items lexically.
static int mdb_cmp_memnr (const MDB_val *a, const MDB_val *b)
 Compare two items in reverse byte order.
int mdb_get (MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data)
 Get items from a database.
int mdb_cursor_get (MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
 Retrieve by cursor.
static int mdb_cursor_touch (MDB_cursor *mc)
 Touch all the pages in the cursor stack.
int mdb_cursor_put (MDB_cursor *mc, MDB_val *key, MDB_val *data, unsigned int flags)
 Store by cursor.
int mdb_cursor_del (MDB_cursor *mc, unsigned int flags)
 Delete current key/data pair.
int mdb_cursor_open (MDB_txn *txn, MDB_dbi dbi, MDB_cursor **ret)
 Create a cursor handle.
int mdb_cursor_count (MDB_cursor *mc, size_t *countp)
 Return count of duplicates for current key.
void mdb_cursor_close (MDB_cursor *mc)
 Close a cursor handle.
MDB_txnmdb_cursor_txn (MDB_cursor *mc)
 Return the cursor's transaction handle.
MDB_dbi mdb_cursor_dbi (MDB_cursor *mc)
 Return the cursor's database handle.
static void mdb_cursor_copy (const MDB_cursor *csrc, MDB_cursor *cdst)
 Copy the contents of a cursor.
int mdb_del (MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data)
 Delete items from a database.
int mdb_put (MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, unsigned int flags)
 Store items into a database.
int mdb_env_set_flags (MDB_env *env, unsigned int flag, int onoff)
 Set environment flags.
int mdb_env_get_flags (MDB_env *env, unsigned int *arg)
 Get environment flags.
int mdb_env_get_path (MDB_env *env, const char **arg)
 Return the path that was used in mdb_env_open().
static int mdb_stat0 (MDB_env *env, MDB_db *db, MDB_stat *arg)
 Common code for mdb_stat() and mdb_env_stat().
int mdb_env_stat (MDB_env *env, MDB_stat *arg)
 Return statistics about the MDB environment.
int mdb_open (MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi)
 Open a database in the environment.
int mdb_stat (MDB_txn *txn, MDB_dbi dbi, MDB_stat *arg)
 Retrieve statistics for a database.
void mdb_close (MDB_env *env, MDB_dbi dbi)
 Close a database handle.
int mdb_drop (MDB_txn *txn, MDB_dbi dbi, int del)
 Delete a database and/or free all its pages.
int mdb_set_compare (MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
 Set a custom key comparison function for a database.
int mdb_set_dupsort (MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
 Set a custom data comparison function for a MDB_DUPSORT database.
int mdb_set_relfunc (MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel)
 Set a relocation function for a MDB_FIXEDMAP database.
int mdb_set_relctx (MDB_txn *txn, MDB_dbi dbi, void *ctx)
 Set a context pointer for a MDB_FIXEDMAP database's relocation function.

Variables

static char *const mdb_errstr []
 Table of descriptions for MDB Return Codes.

Detailed Description

memory-mapped database library

A Btree-based database management library modeled loosely on the BerkeleyDB API, but much simplified.

Definition in file mdb.c.


Define Documentation

#define BIG_ENDIAN   __BIG_ENDIAN

Definition at line 105 of file mdb.c.

#define BYTE_ORDER   __BYTE_ORDER

Definition at line 97 of file mdb.c.

#define LITTLE_ENDIAN   __LITTLE_ENDIAN

Definition at line 102 of file mdb.c.

#define MDB_FATAL_ERROR   0x80000000U

Failed to update the meta page.

Probably an I/O error.

Definition at line 930 of file mdb.c.

#define mm_flags   mm_dbs[0].md_flags

Any persistent environment flags.

Environment Flags

Definition at line 767 of file mdb.c.

#define mm_psize   mm_dbs[0].md_pad

The size of pages used in this DB.

Definition at line 765 of file mdb.c.

#define mn_hi   mn_offset[BYTE_ORDER==LITTLE_ENDIAN]

part of dsize or pgno

Definition at line 641 of file mdb.c.

#define mn_lo   mn_offset[BYTE_ORDER!=LITTLE_ENDIAN]

lo and hi are used for data size on leaf nodes and for child pgno on branch nodes.

On 64 bit platforms, flags is also used for pgno. (Branch nodes have no flags). They are in host byte order in case that lets some accesses be optimized into a 32-bit word access.

Definition at line 640 of file mdb.c.

#define mp_lower   mp_pb.pb.pb_lower

Definition at line 583 of file mdb.c.

#define mp_next   mp_p.p_next

Definition at line 563 of file mdb.c.

#define mp_pages   mp_pb.pb_pages

Definition at line 585 of file mdb.c.

#define mp_pgno   mp_p.p_pgno

Definition at line 562 of file mdb.c.

#define mp_upper   mp_pb.pb.pb_upper

Definition at line 584 of file mdb.c.

#define mr_pid   mru.mrx.mrb_pid

Definition at line 478 of file mdb.c.

#define mr_tid   mru.mrx.mrb_tid

Definition at line 479 of file mdb.c.

#define mr_txnid   mru.mrx.mrb_txnid

shorthand for mrb_txnid

Definition at line 477 of file mdb.c.

#define mti_magic   mt1.mtb.mtb_magic

Definition at line 534 of file mdb.c.

#define mti_me_toggle   mt1.mtb.mtb_me_toggle

Definition at line 540 of file mdb.c.

#define mti_mutex   mt1.mtb.mtb_mutex

Definition at line 536 of file mdb.c.

#define mti_numreaders   mt1.mtb.mtb_numreaders

Definition at line 539 of file mdb.c.

#define mti_rmname   mt1.mtb.mtb_rmname

Definition at line 537 of file mdb.c.

#define mti_txnid   mt1.mtb.mtb_txnid

Definition at line 538 of file mdb.c.

#define mti_version   mt1.mtb.mtb_version

Definition at line 535 of file mdb.c.

#define mti_wmutex   mt2.mt2_wmutex

Definition at line 549 of file mdb.c.

#define VGMEMP_ALLOC (   h,
  a,
  s 
)

Definition at line 80 of file mdb.c.

#define VGMEMP_CREATE (   h,
  r,
 
)

Definition at line 79 of file mdb.c.

#define VGMEMP_DEFINED (   a,
  s 
)

Definition at line 83 of file mdb.c.

#define VGMEMP_DESTROY (   h)

Definition at line 82 of file mdb.c.

#define VGMEMP_FREE (   h,
  a 
)

Definition at line 81 of file mdb.c.