lmdb_master3_sys/
bindings.rs

1/* automatically generated by rust-bindgen 0.69.4 */
2
3pub const MDB_FMT_Z: &[u8; 2] = b"z\0";
4pub const MDB_RPAGE_CACHE: ::libc::c_uint = 1;
5pub const MDB_SIZE_MAX: u64 = 18446744073709551615;
6pub const MDB_VERSION_MAJOR: ::libc::c_uint = 0;
7pub const MDB_VERSION_MINOR: ::libc::c_uint = 9;
8pub const MDB_VERSION_PATCH: ::libc::c_uint = 90;
9pub const MDB_VERSION_DATE: &[u8; 12] = b"May 1, 2017\0";
10pub const MDB_FIXEDMAP: ::libc::c_uint = 1;
11pub const MDB_ENCRYPT: ::libc::c_uint = 8192;
12pub const MDB_NOSUBDIR: ::libc::c_uint = 16384;
13pub const MDB_NOSYNC: ::libc::c_uint = 65536;
14pub const MDB_RDONLY: ::libc::c_uint = 131072;
15pub const MDB_NOMETASYNC: ::libc::c_uint = 262144;
16pub const MDB_WRITEMAP: ::libc::c_uint = 524288;
17pub const MDB_MAPASYNC: ::libc::c_uint = 1048576;
18pub const MDB_NOTLS: ::libc::c_uint = 2097152;
19pub const MDB_NOLOCK: ::libc::c_uint = 4194304;
20pub const MDB_NORDAHEAD: ::libc::c_uint = 8388608;
21pub const MDB_NOMEMINIT: ::libc::c_uint = 16777216;
22pub const MDB_PREVSNAPSHOT: ::libc::c_uint = 33554432;
23pub const MDB_REMAP_CHUNKS: ::libc::c_uint = 67108864;
24pub const MDB_REVERSEKEY: ::libc::c_uint = 2;
25pub const MDB_DUPSORT: ::libc::c_uint = 4;
26pub const MDB_INTEGERKEY: ::libc::c_uint = 8;
27pub const MDB_DUPFIXED: ::libc::c_uint = 16;
28pub const MDB_INTEGERDUP: ::libc::c_uint = 32;
29pub const MDB_REVERSEDUP: ::libc::c_uint = 64;
30pub const MDB_CREATE: ::libc::c_uint = 262144;
31pub const MDB_NOOVERWRITE: ::libc::c_uint = 16;
32pub const MDB_NODUPDATA: ::libc::c_uint = 32;
33pub const MDB_CURRENT: ::libc::c_uint = 64;
34pub const MDB_RESERVE: ::libc::c_uint = 65536;
35pub const MDB_APPEND: ::libc::c_uint = 131072;
36pub const MDB_APPENDDUP: ::libc::c_uint = 262144;
37pub const MDB_MULTIPLE: ::libc::c_uint = 524288;
38pub const MDB_CP_COMPACT: ::libc::c_uint = 1;
39pub const MDB_SUCCESS: ::libc::c_int = 0;
40pub const MDB_KEYEXIST: ::libc::c_int = -30799;
41pub const MDB_NOTFOUND: ::libc::c_int = -30798;
42pub const MDB_PAGE_NOTFOUND: ::libc::c_int = -30797;
43pub const MDB_CORRUPTED: ::libc::c_int = -30796;
44pub const MDB_PANIC: ::libc::c_int = -30795;
45pub const MDB_VERSION_MISMATCH: ::libc::c_int = -30794;
46pub const MDB_INVALID: ::libc::c_int = -30793;
47pub const MDB_MAP_FULL: ::libc::c_int = -30792;
48pub const MDB_DBS_FULL: ::libc::c_int = -30791;
49pub const MDB_READERS_FULL: ::libc::c_int = -30790;
50pub const MDB_TLS_FULL: ::libc::c_int = -30789;
51pub const MDB_TXN_FULL: ::libc::c_int = -30788;
52pub const MDB_CURSOR_FULL: ::libc::c_int = -30787;
53pub const MDB_PAGE_FULL: ::libc::c_int = -30786;
54pub const MDB_MAP_RESIZED: ::libc::c_int = -30785;
55pub const MDB_INCOMPATIBLE: ::libc::c_int = -30784;
56pub const MDB_BAD_RSLOT: ::libc::c_int = -30783;
57pub const MDB_BAD_TXN: ::libc::c_int = -30782;
58pub const MDB_BAD_VALSIZE: ::libc::c_int = -30781;
59pub const MDB_BAD_DBI: ::libc::c_int = -30780;
60pub const MDB_PROBLEM: ::libc::c_int = -30779;
61pub const MDB_BAD_CHECKSUM: ::libc::c_int = -30778;
62pub const MDB_CRYPTO_FAIL: ::libc::c_int = -30777;
63pub const MDB_ENV_ENCRYPTION: ::libc::c_int = -30776;
64pub const MDB_LAST_ERRCODE: ::libc::c_int = -30776;
65#[doc = "Unsigned type used for mapsize, entry counts and page/transaction IDs.\n\n\tIt is normally size_t, hence the name. Defining MDB_VL32 makes it\n\tuint64_t, but do not try this unless you know what you are doing."]
66pub type mdb_size_t = usize;
67#[repr(C)]
68#[derive(Debug, Copy, Clone)]
69pub struct MDB_env {
70    _unused: [u8; 0],
71}
72#[repr(C)]
73#[derive(Debug, Copy, Clone)]
74pub struct MDB_txn {
75    _unused: [u8; 0],
76}
77#[doc = "A handle for an individual database in the DB environment."]
78pub type MDB_dbi = ::libc::c_uint;
79#[repr(C)]
80#[derive(Debug, Copy, Clone)]
81pub struct MDB_cursor {
82    _unused: [u8; 0],
83}
84#[doc = "Generic structure used for passing keys and data in and out\n of the database.\n\n Values returned from the database are valid only until a subsequent\n update operation, or the end of the transaction. Do not modify or\n free them, they commonly point into the database itself.\n\n Key sizes must be between 1 and #mdb_env_get_maxkeysize() inclusive.\n The same applies to data sizes in databases with the #MDB_DUPSORT flag.\n Other data items can in theory be from 0 to 0xffffffff bytes long."]
85#[repr(C)]
86#[derive(Debug, Copy, Clone)]
87pub struct MDB_val {
88    #[doc = "< size of the data item"]
89    pub mv_size: usize,
90    #[doc = "< address of the data item"]
91    pub mv_data: *mut ::libc::c_void,
92}
93#[doc = "A callback function used to compare two keys in a database"]
94pub type MDB_cmp_func = ::std::option::Option<
95    unsafe extern "C" fn(a: *const MDB_val, b: *const MDB_val) -> ::libc::c_int,
96>;
97#[doc = "A callback function used to relocate a position-dependent data item\n in a fixed-address database.\n\n The **newptr** gives the item's desired address in\n the memory map, and **oldptr** gives its previous address. The item's actual\n data resides at the address in **item.** This callback is expected to walk\n through the fields of the record in **item** and modify any\n values based at the **oldptr** address to be relative to the **newptr** address.\n # Arguments\n\n* `item` (direction in, out) - The item that is to be relocated.\n * `oldptr` (direction in) - The previous address.\n * `newptr` (direction in) - The new address to relocate to.\n * `relctx` (direction in) - An application-provided context, set by #mdb_set_relctx().\n This feature is currently unimplemented."]
98pub type MDB_rel_func = ::std::option::Option<
99    unsafe extern "C" fn(
100        item: *mut MDB_val,
101        oldptr: *mut ::libc::c_void,
102        newptr: *mut ::libc::c_void,
103        relctx: *mut ::libc::c_void,
104    ),
105>;
106#[doc = "A callback function used to encrypt/decrypt pages in the env.\n\n Encrypt or decrypt the data in src and store the result in dst using the\n provided key. The result must be the same number of bytes as the input.\n # Arguments\n\n* `src` (direction in) - The input data to be transformed.\n * `dst` (direction out) - Storage for the result.\n * `key` (direction in) - An array of three values: key[0] is the encryption key,\n key[1] is the initialization vector, and key[2] is the authentication\n data, if any.\n * `encdec` (direction in) - 1 to encrypt, 0 to decrypt.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
107pub type MDB_enc_func = ::std::option::Option<
108    unsafe extern "C" fn(
109        src: *const MDB_val,
110        dst: *mut MDB_val,
111        key: *const MDB_val,
112        encdec: ::libc::c_int,
113    ) -> ::libc::c_int,
114>;
115#[doc = "A callback function used to checksum pages in the env.\n\n Compute the checksum of the data in src and store the result in dst,\n An optional key may be used with keyed hash algorithms.\n # Arguments\n\n* `src` (direction in) - The input data to be transformed.\n * `dst` (direction out) - Storage for the result.\n * `key` (direction in) - An encryption key, if encryption was configured. This\n parameter will be NULL if there is no key."]
116pub type MDB_sum_func = ::std::option::Option<
117    unsafe extern "C" fn(src: *const MDB_val, dst: *mut MDB_val, key: *const MDB_val),
118>;
119#[doc = "< Position at first key/data item"]
120pub const MDB_FIRST: MDB_cursor_op = 0;
121#[doc = "< Position at first data item of current key.\nOnly for #MDB_DUPSORT"]
122pub const MDB_FIRST_DUP: MDB_cursor_op = 1;
123#[doc = "< Position at key/data pair. Only for #MDB_DUPSORT"]
124pub const MDB_GET_BOTH: MDB_cursor_op = 2;
125#[doc = "< position at key, nearest data. Only for #MDB_DUPSORT"]
126pub const MDB_GET_BOTH_RANGE: MDB_cursor_op = 3;
127#[doc = "< Return key/data at current cursor position"]
128pub const MDB_GET_CURRENT: MDB_cursor_op = 4;
129#[doc = "< Return up to a page of duplicate data items\nfrom current cursor position. Move cursor to prepare\nfor #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED"]
130pub const MDB_GET_MULTIPLE: MDB_cursor_op = 5;
131#[doc = "< Position at last key/data item"]
132pub const MDB_LAST: MDB_cursor_op = 6;
133#[doc = "< Position at last data item of current key.\nOnly for #MDB_DUPSORT"]
134pub const MDB_LAST_DUP: MDB_cursor_op = 7;
135#[doc = "< Position at next data item"]
136pub const MDB_NEXT: MDB_cursor_op = 8;
137#[doc = "< Position at next data item of current key.\nOnly for #MDB_DUPSORT"]
138pub const MDB_NEXT_DUP: MDB_cursor_op = 9;
139#[doc = "< Return up to a page of duplicate data items\nfrom next cursor position. Move cursor to prepare\nfor #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED"]
140pub const MDB_NEXT_MULTIPLE: MDB_cursor_op = 10;
141#[doc = "< Position at first data item of next key"]
142pub const MDB_NEXT_NODUP: MDB_cursor_op = 11;
143#[doc = "< Position at previous data item"]
144pub const MDB_PREV: MDB_cursor_op = 12;
145#[doc = "< Position at previous data item of current key.\nOnly for #MDB_DUPSORT"]
146pub const MDB_PREV_DUP: MDB_cursor_op = 13;
147#[doc = "< Position at last data item of previous key"]
148pub const MDB_PREV_NODUP: MDB_cursor_op = 14;
149#[doc = "< Position at specified key"]
150pub const MDB_SET: MDB_cursor_op = 15;
151#[doc = "< Position at specified key, return key + data"]
152pub const MDB_SET_KEY: MDB_cursor_op = 16;
153#[doc = "< Position at first key greater than or equal to specified key."]
154pub const MDB_SET_RANGE: MDB_cursor_op = 17;
155#[doc = "< Position at previous page and return up to\na page of duplicate data items. Only for #MDB_DUPFIXED"]
156pub const MDB_PREV_MULTIPLE: MDB_cursor_op = 18;
157#[doc = "Cursor Get operations.\n\n\tThis is the set of all operations for retrieving data\n\tusing a cursor."]
158pub type MDB_cursor_op = ::libc::c_uint;
159#[doc = "Statistics for a database in the environment"]
160#[repr(C)]
161#[derive(Debug, Copy, Clone)]
162pub struct MDB_stat {
163    #[doc = "< Size of a database page.\nThis is currently the same for all databases."]
164    pub ms_psize: ::libc::c_uint,
165    #[doc = "< Depth (height) of the B-tree"]
166    pub ms_depth: ::libc::c_uint,
167    #[doc = "< Number of internal (non-leaf) pages"]
168    pub ms_branch_pages: mdb_size_t,
169    #[doc = "< Number of leaf pages"]
170    pub ms_leaf_pages: mdb_size_t,
171    #[doc = "< Number of overflow pages"]
172    pub ms_overflow_pages: mdb_size_t,
173    #[doc = "< Number of data items"]
174    pub ms_entries: mdb_size_t,
175}
176#[doc = "Information about the environment"]
177#[repr(C)]
178#[derive(Debug, Copy, Clone)]
179pub struct MDB_envinfo {
180    #[doc = "< Address of map, if fixed"]
181    pub me_mapaddr: *mut ::libc::c_void,
182    #[doc = "< Size of the data memory map"]
183    pub me_mapsize: mdb_size_t,
184    #[doc = "< ID of the last used page"]
185    pub me_last_pgno: mdb_size_t,
186    #[doc = "< ID of the last committed transaction"]
187    pub me_last_txnid: mdb_size_t,
188    #[doc = "< max reader slots in the environment"]
189    pub me_maxreaders: ::libc::c_uint,
190    #[doc = "< max reader slots used in the environment"]
191    pub me_numreaders: ::libc::c_uint,
192}
193extern "C" {
194    #[doc = "Return the LMDB library version information.\n\n # Arguments\n\n* `major` (direction out) - if non-NULL, the library major version number is copied here\n * `minor` (direction out) - if non-NULL, the library minor version number is copied here\n * `patch` (direction out) - if non-NULL, the library patch version number is copied here\n # Returns\n\n* `\"version` - string\" The library version as a string"]
195    pub fn mdb_version(
196        major: *mut ::libc::c_int,
197        minor: *mut ::libc::c_int,
198        patch: *mut ::libc::c_int,
199    ) -> *mut ::libc::c_char;
200}
201extern "C" {
202    #[doc = "Return a string describing a given error code.\n\n This function is a superset of the ANSI C X3.159-1989 (ANSI C) strerror(3)\n function. If the error code is greater than or equal to 0, then the string\n returned by the system function strerror(3) is returned. If the error code\n is less than 0, an error string corresponding to the LMDB library error is\n returned. See errors for a list of LMDB-specific error codes.\n # Arguments\n\n* `err` (direction in) - The error code\n # Returns\n\n* `\"error` - message\" The description of the error"]
203    pub fn mdb_strerror(err: ::libc::c_int) -> *mut ::libc::c_char;
204}
205extern "C" {
206    #[doc = "Create an LMDB environment handle.\n\n This function allocates memory for a #MDB_env structure. To release\n the allocated memory and discard the handle, call #mdb_env_close().\n Before the handle may be used, it must be opened using #mdb_env_open().\n Various other options may also need to be set before opening the handle,\n e.g. #mdb_env_set_mapsize(), #mdb_env_set_maxreaders(), #mdb_env_set_maxdbs(),\n depending on usage requirements.\n # Arguments\n\n* `env` (direction out) - The address where the new handle will be stored\n # Returns\n\nA non-zero error value on failure and 0 on success."]
207    pub fn mdb_env_create(env: *mut *mut MDB_env) -> ::libc::c_int;
208}
209extern "C" {
210    #[doc = "Open an environment handle.\n\n If this function fails, #mdb_env_close() must be called to discard the #MDB_env handle.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `path` (direction in) - The directory in which the database files reside. This\n directory must already exist and be writable.\n * `flags` (direction in) - Special options for this environment. This parameter\n must be set to 0 or by bitwise OR'ing together one or more of the\n values described here.\n Flags set by mdb_env_set_flags() are also used.\n <ul>\n\t<li>#MDB_FIXEDMAP\n use a fixed address for the mmap region. This flag must be specified\n when creating the environment, and is stored persistently in the environment.\n\t\tIf successful, the memory map will always reside at the same virtual address\n\t\tand pointers used to reference data items in the database will be constant\n\t\tacross multiple invocations. This option may not always work, depending on\n\t\thow the operating system has allocated memory to shared libraries and other uses.\n\t\tThe feature is highly experimental.\n\t<li>#MDB_NOSUBDIR\n\t\tBy default, LMDB creates its environment in a directory whose\n\t\tpathname is given in **path,** and creates its data and lock files\n\t\tunder that directory. With this option, **path** is used as-is for\n\t\tthe database main data file. The database lock file is the **path**\n\t\twith \"-lock\" appended.\n\t<li>#MDB_RDONLY\n\t\tOpen the environment in read-only mode. No write operations will be\n\t\tallowed. LMDB will still modify the lock file - except on read-only\n\t\tfilesystems, where LMDB does not use locks.\n\t<li>#MDB_WRITEMAP\n\t\tUse a writeable memory map unless MDB_RDONLY is set. This uses\n\t\tfewer mallocs but loses protection from application bugs\n\t\tlike wild pointer writes and other bad updates into the database.\n\t\tThis may be slightly faster for DBs that fit entirely in RAM, but\n\t\tis slower for DBs larger than RAM.\n\t\tIncompatible with nested transactions.\n\t\tDo not mix processes with and without MDB_WRITEMAP on the same\n\t\tenvironment. This can defeat durability (#mdb_env_sync etc).\n\t<li>#MDB_NOMETASYNC\n\t\tFlush system buffers to disk only once per transaction, omit the\n\t\tmetadata flush. Defer that until the system flushes files to disk,\n\t\tor next non-MDB_RDONLY commit or #mdb_env_sync(). This optimization\n\t\tmaintains database integrity, but a system crash may undo the last\n\t\tcommitted transaction. I.e. it preserves the ACI (atomicity,\n\t\tconsistency, isolation) but not D (durability) database property.\n\t\tThis flag may be changed at any time using #mdb_env_set_flags().\n\t<li>#MDB_NOSYNC\n\t\tDon't flush system buffers to disk when committing a transaction.\n\t\tThis optimization means a system crash can corrupt the database or\n\t\tlose the last transactions if buffers are not yet flushed to disk.\n\t\tThe risk is governed by how often the system flushes dirty buffers\n\t\tto disk and how often #mdb_env_sync() is called. However, if the\n\t\tfilesystem preserves write order and the #MDB_WRITEMAP flag is not\n\t\tused, transactions exhibit ACI (atomicity, consistency, isolation)\n\t\tproperties and only lose D (durability). I.e. database integrity\n\t\tis maintained, but a system crash may undo the final transactions.\n\t\tNote that (#MDB_NOSYNC | #MDB_WRITEMAP) leaves the system with no\n\t\thint for when to write transactions to disk, unless #mdb_env_sync()\n\t\tis called. (#MDB_MAPASYNC | #MDB_WRITEMAP) may be preferable.\n\t\tThis flag may be changed at any time using #mdb_env_set_flags().\n\t<li>#MDB_MAPASYNC\n\t\tWhen using #MDB_WRITEMAP, use asynchronous flushes to disk.\n\t\tAs with #MDB_NOSYNC, a system crash can then corrupt the\n\t\tdatabase or lose the last transactions. Calling #mdb_env_sync()\n\t\tensures on-disk database integrity until next commit.\n\t\tThis flag may be changed at any time using #mdb_env_set_flags().\n\t<li>#MDB_NOTLS\n\t\tDon't use Thread-Local Storage. Tie reader locktable slots to\n\t\t#MDB_txn objects instead of to threads. I.e. #mdb_txn_reset() keeps\n\t\tthe slot reserved for the #MDB_txn object. A thread may use parallel\n\t\tread-only transactions. A read-only transaction may span threads if\n\t\tthe user synchronizes its use. Applications that multiplex many\n\t\tuser threads over individual OS threads need this option. Such an\n\t\tapplication must also serialize the write transactions in an OS\n\t\tthread, since LMDB's write locking is unaware of the user threads.\n\t<li>#MDB_NOLOCK\n\t\tDon't do any locking. If concurrent access is anticipated, the\n\t\tcaller must manage all concurrency itself. For proper operation\n\t\tthe caller must enforce single-writer semantics, and must ensure\n\t\tthat no readers are using old transactions while a writer is\n\t\tactive. The simplest approach is to use an exclusive lock so that\n\t\tno readers may be active at all when a writer begins.\n\t<li>#MDB_NORDAHEAD\n\t\tTurn off readahead. Most operating systems perform readahead on\n\t\tread requests by default. This option turns it off if the OS\n\t\tsupports it. Turning it off may help random read performance\n\t\twhen the DB is larger than RAM and system RAM is full.\n\t\tThe option is not implemented on Windows.\n\t<li>#MDB_NOMEMINIT\n\t\tDon't initialize malloc'd memory before writing to unused spaces\n\t\tin the data file. By default, memory for pages written to the data\n\t\tfile is obtained using malloc. While these pages may be reused in\n\t\tsubsequent transactions, freshly malloc'd pages will be initialized\n\t\tto zeroes before use. This avoids persisting leftover data from other\n\t\tcode (that used the heap and subsequently freed the memory) into the\n\t\tdata file. Note that many other system libraries may allocate\n\t\tand free memory from the heap for arbitrary uses. E.g., stdio may\n\t\tuse the heap for file I/O buffers. This initialization step has a\n\t\tmodest performance cost so some applications may want to disable\n\t\tit using this flag. This option can be a problem for applications\n\t\twhich handle sensitive data like passwords, and it makes memory\n\t\tcheckers like Valgrind noisy. This flag is not needed with #MDB_WRITEMAP,\n\t\twhich writes directly to the mmap instead of using malloc for pages. The\n\t\tinitialization is also skipped if #MDB_RESERVE is used; the\n\t\tcaller is expected to overwrite all of the memory that was\n\t\treserved in that case.\n\t\tThis flag may be changed at any time using #mdb_env_set_flags().\n\t<li>#MDB_PREVSNAPSHOT\n\t\tOpen the environment with the previous snapshot rather than the latest\n\t\tone. This loses the latest transaction, but may help work around some\n\t\ttypes of corruption. If opened with write access, this must be the\n\t\tonly process using the environment. This flag is automatically reset\n\t\tafter a write transaction is successfully committed.\n </ul>\n * `mode` (direction in) - The UNIX permissions to set on created files and semaphores.\n This parameter is ignored on Windows.\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_VERSION_MISMATCH - the version of the LMDB library doesn't match the\n\tversion that created the database environment.\n\t<li>#MDB_INVALID - the environment file headers are corrupted.\n\t<li>ENOENT - the directory specified by the path parameter doesn't exist.\n\t<li>EACCES - the user didn't have permission to access the environment files.\n\t<li>EAGAIN - the environment was locked by another process.\n </ul>"]
211    pub fn mdb_env_open(
212        env: *mut MDB_env,
213        path: *const ::libc::c_char,
214        flags: ::libc::c_uint,
215        mode: mdb_mode_t,
216    ) -> ::libc::c_int;
217}
218extern "C" {
219    #[doc = "Copy an LMDB environment to the specified path.\n\n This function may be used to make a backup of an existing environment.\n No lockfile is created, since it gets recreated at need.\n > **Note:** This call can trigger significant file size growth if run in\n parallel with write transactions, because it employs a read-only\n transaction. See long-lived transactions under caveats_sec.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create(). It\n must have already been opened successfully.\n * `path` (direction in) - The directory in which the copy will reside. This\n directory must already exist and be writable but must otherwise be\n empty.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
220    pub fn mdb_env_copy(env: *mut MDB_env, path: *const ::libc::c_char) -> ::libc::c_int;
221}
222extern "C" {
223    #[doc = "Copy an LMDB environment to the specified file descriptor.\n\n This function may be used to make a backup of an existing environment.\n No lockfile is created, since it gets recreated at need.\n > **Note:** This call can trigger significant file size growth if run in\n parallel with write transactions, because it employs a read-only\n transaction. See long-lived transactions under caveats_sec.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create(). It\n must have already been opened successfully.\n * `fd` (direction in) - The filedescriptor to write the copy to. It must\n have already been opened for Write access.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
224    pub fn mdb_env_copyfd(env: *mut MDB_env, fd: mdb_filehandle_t) -> ::libc::c_int;
225}
226extern "C" {
227    #[doc = "Copy an LMDB environment to the specified path, with options.\n\n This function may be used to make a backup of an existing environment.\n No lockfile is created, since it gets recreated at need.\n > **Note:** This call can trigger significant file size growth if run in\n parallel with write transactions, because it employs a read-only\n transaction. See long-lived transactions under caveats_sec.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create(). It\n must have already been opened successfully.\n * `path` (direction in) - The directory in which the copy will reside. This\n directory must already exist and be writable but must otherwise be\n empty.\n * `flags` (direction in) - Special options for this operation. This parameter\n must be set to 0 or by bitwise OR'ing together one or more of the\n values described here.\n <ul>\n\t<li>#MDB_CP_COMPACT - Perform compaction while copying: omit free\n\t\tpages and sequentially renumber all pages in output. This option\n\t\tconsumes more CPU and runs more slowly than the default.\n\t\tCurrently it fails if the environment has suffered a page leak.\n </ul>\n # Returns\n\nA non-zero error value on failure and 0 on success."]
228    pub fn mdb_env_copy2(
229        env: *mut MDB_env,
230        path: *const ::libc::c_char,
231        flags: ::libc::c_uint,
232    ) -> ::libc::c_int;
233}
234extern "C" {
235    #[doc = "Copy an LMDB environment to the specified file descriptor,\n\twith options.\n\n This function may be used to make a backup of an existing environment.\n No lockfile is created, since it gets recreated at need. See\n #mdb_env_copy2() for further details.\n > **Note:** This call can trigger significant file size growth if run in\n parallel with write transactions, because it employs a read-only\n transaction. See long-lived transactions under caveats_sec.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create(). It\n must have already been opened successfully.\n * `fd` (direction in) - The filedescriptor to write the copy to. It must\n have already been opened for Write access.\n * `flags` (direction in) - Special options for this operation.\n See #mdb_env_copy2() for options.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
236    pub fn mdb_env_copyfd2(
237        env: *mut MDB_env,
238        fd: mdb_filehandle_t,
239        flags: ::libc::c_uint,
240    ) -> ::libc::c_int;
241}
242extern "C" {
243    #[doc = "Return statistics about the LMDB environment.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `stat` (direction out) - The address of an #MDB_stat structure\n \twhere the statistics will be copied"]
244    pub fn mdb_env_stat(env: *mut MDB_env, stat: *mut MDB_stat) -> ::libc::c_int;
245}
246extern "C" {
247    #[doc = "Return information about the LMDB environment.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `stat` (direction out) - The address of an #MDB_envinfo structure\n \twhere the information will be copied"]
248    pub fn mdb_env_info(env: *mut MDB_env, stat: *mut MDB_envinfo) -> ::libc::c_int;
249}
250extern "C" {
251    #[doc = "Flush the data buffers to disk.\n\n Data is always written to disk when #mdb_txn_commit() is called,\n but the operating system may keep it buffered. LMDB always flushes\n the OS buffers upon commit as well, unless the environment was\n opened with #MDB_NOSYNC or in part #MDB_NOMETASYNC. This call is\n not valid if the environment was opened with #MDB_RDONLY.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `force` (direction in) - If non-zero, force a synchronous flush. Otherwise\n if the environment has the #MDB_NOSYNC flag set the flushes\n\twill be omitted, and with #MDB_MAPASYNC they will be asynchronous.\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EACCES - the environment is read-only.\n\t<li>EINVAL - an invalid parameter was specified.\n\t<li>EIO - an error occurred during synchronization.\n </ul>"]
252    pub fn mdb_env_sync(env: *mut MDB_env, force: ::libc::c_int) -> ::libc::c_int;
253}
254extern "C" {
255    #[doc = "Close the environment and release the memory map.\n\n Only a single thread may call this function. All transactions, databases,\n and cursors must already be closed before calling this function. Attempts to\n use any such handles after calling this function will cause a SIGSEGV.\n The environment handle will be freed and must not be used again after this call.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()"]
256    pub fn mdb_env_close(env: *mut MDB_env);
257}
258extern "C" {
259    #[doc = "Set environment flags.\n\n This may be used to set some flags in addition to those from\n #mdb_env_open(), or to unset these flags. If several threads\n change the flags at the same time, the result is undefined.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `flags` (direction in) - The flags to change, bitwise OR'ed together\n * `onoff` (direction in) - A non-zero value sets the flags, zero clears them.\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
260    pub fn mdb_env_set_flags(
261        env: *mut MDB_env,
262        flags: ::libc::c_uint,
263        onoff: ::libc::c_int,
264    ) -> ::libc::c_int;
265}
266extern "C" {
267    #[doc = "Get environment flags.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `flags` (direction out) - The address of an integer to store the flags\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
268    pub fn mdb_env_get_flags(env: *mut MDB_env, flags: *mut ::libc::c_uint) -> ::libc::c_int;
269}
270extern "C" {
271    #[doc = "Return the path that was used in #mdb_env_open().\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `path` (direction out) - Address of a string pointer to contain the path. This\n is the actual string in the environment, not a copy. It should not be\n altered in any way.\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
272    pub fn mdb_env_get_path(env: *mut MDB_env, path: *mut *const ::libc::c_char) -> ::libc::c_int;
273}
274extern "C" {
275    #[doc = "Return the filedescriptor for the given environment.\n\n This function may be called after fork(), so the descriptor can be\n closed before exec*(). Other LMDB file descriptors have FD_CLOEXEC.\n (Until LMDB 0.9.18, only the lockfile had that.)\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `fd` (direction out) - Address of a mdb_filehandle_t to contain the descriptor.\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
276    pub fn mdb_env_get_fd(env: *mut MDB_env, fd: *mut mdb_filehandle_t) -> ::libc::c_int;
277}
278extern "C" {
279    #[doc = "Set the size of the memory map to use for this environment.\n\n The size should be a multiple of the OS page size. The default is\n 10485760 bytes. The size of the memory map is also the maximum size\n of the database. The value should be chosen as large as possible,\n to accommodate future growth of the database.\n This function should be called after #mdb_env_create() and before #mdb_env_open().\n It may be called at later times if no transactions are active in\n this process. Note that the library does not check for this condition,\n the caller must ensure it explicitly.\n\n The new size takes effect immediately for the current process but\n will not be persisted to any others until a write transaction has been\n committed by the current process. Also, only mapsize increases are\n persisted into the environment.\n\n If the mapsize is increased by another process, and data has grown\n beyond the range of the current mapsize, #mdb_txn_begin() will\n return #MDB_MAP_RESIZED. This function may be called with a size\n of zero to adopt the new size.\n\n Any attempt to set a size smaller than the space already consumed\n by the environment will be silently changed to the current size of the used space.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `size` (direction in) - The size in bytes\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified, or the environment has\n \tan active write transaction.\n </ul>"]
280    pub fn mdb_env_set_mapsize(env: *mut MDB_env, size: mdb_size_t) -> ::libc::c_int;
281}
282extern "C" {
283    #[doc = "Set the size of DB pages in bytes.\n\n The size defaults to the OS page size. Smaller or larger values may be\n desired depending on the size of keys and values being used. Also, an\n explicit size may need to be set when using filesystems like ZFS which\n don't use the OS page size."]
284    pub fn mdb_env_set_pagesize(env: *mut MDB_env, size: ::libc::c_int) -> ::libc::c_int;
285}
286extern "C" {
287    #[doc = "Set the maximum number of threads/reader slots for the environment.\n\n This defines the number of slots in the lock table that is used to track readers in the\n the environment. The default is 126.\n Starting a read-only transaction normally ties a lock table slot to the\n current thread until the environment closes or the thread exits. If\n MDB_NOTLS is in use, #mdb_txn_begin() instead ties the slot to the\n MDB_txn object until it or the #MDB_env object is destroyed.\n This function may only be called after #mdb_env_create() and before #mdb_env_open().\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `readers` (direction in) - The maximum number of reader lock table slots\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified, or the environment is already open.\n </ul>"]
288    pub fn mdb_env_set_maxreaders(env: *mut MDB_env, readers: ::libc::c_uint) -> ::libc::c_int;
289}
290extern "C" {
291    #[doc = "Get the maximum number of threads/reader slots for the environment.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `readers` (direction out) - Address of an integer to store the number of readers\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
292    pub fn mdb_env_get_maxreaders(env: *mut MDB_env, readers: *mut ::libc::c_uint)
293        -> ::libc::c_int;
294}
295extern "C" {
296    #[doc = "Set the maximum number of named databases for the environment.\n\n This function is only needed if multiple databases will be used in the\n environment. Simpler applications that use the environment as a single\n unnamed database can ignore this option.\n This function may only be called after #mdb_env_create() and before #mdb_env_open().\n\n Currently a moderate number of slots are cheap but a huge number gets\n expensive: 7-120 words per transaction, and every #mdb_dbi_open()\n does a linear search of the opened slots.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `dbs` (direction in) - The maximum number of databases\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified, or the environment is already open.\n </ul>"]
297    pub fn mdb_env_set_maxdbs(env: *mut MDB_env, dbs: MDB_dbi) -> ::libc::c_int;
298}
299extern "C" {
300    #[doc = "Get the maximum size of keys and #MDB_DUPSORT data we can write.\n\n Depends on the compile-time constant #MDB_MAXKEYSIZE. Default 511.\n See MDB_val.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n # Returns\n\nThe maximum size of a key we can write"]
301    pub fn mdb_env_get_maxkeysize(env: *mut MDB_env) -> ::libc::c_int;
302}
303extern "C" {
304    #[doc = "Set application information associated with the #MDB_env.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `ctx` (direction in) - An arbitrary pointer for whatever the application needs.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
305    pub fn mdb_env_set_userctx(env: *mut MDB_env, ctx: *mut ::libc::c_void) -> ::libc::c_int;
306}
307extern "C" {
308    #[doc = "Get the application information associated with the #MDB_env.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n # Returns\n\nThe pointer set by #mdb_env_set_userctx()."]
309    pub fn mdb_env_get_userctx(env: *mut MDB_env) -> *mut ::libc::c_void;
310}
311#[doc = "A callback function for most LMDB assert() failures,\n called before printing the message and aborting.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create().\n * `msg` (direction in) - The assertion message, not including newline."]
312pub type MDB_assert_func =
313    ::std::option::Option<unsafe extern "C" fn(env: *mut MDB_env, msg: *const ::libc::c_char)>;
314extern "C" {
315    #[doc = "Set or reset the assert() callback of the environment.\n Disabled if liblmdb is built with NDEBUG.\n > **Note:** This hack should become obsolete as lmdb's error handling matures.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create().\n * `func` (direction in) - An #MDB_assert_func function, or 0.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
316    pub fn mdb_env_set_assert(env: *mut MDB_env, func: MDB_assert_func) -> ::libc::c_int;
317}
318extern "C" {
319    #[doc = "Set encryption on an environment.\n\n This must be called before #mdb_env_open().\n It implicitly sets #MDB_REMAP_CHUNKS on the env.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create().\n * `func` (direction in) - An #MDB_enc_func function.\n * `key` (direction in) - The encryption key.\n * `size` (direction in) - The size of authentication data in bytes, if any.\n Set this to zero for unauthenticated encryption mechanisms.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
320    pub fn mdb_env_set_encrypt(
321        env: *mut MDB_env,
322        func: MDB_enc_func,
323        key: *const MDB_val,
324        size: ::libc::c_uint,
325    ) -> ::libc::c_int;
326}
327extern "C" {
328    #[doc = "Set checksums on an environment.\n\n This must be called before #mdb_env_open().\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create().\n * `func` (direction in) - An #MDB_sum_func function.\n * `size` (direction in) - The size of computed checksum values, in bytes.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
329    pub fn mdb_env_set_checksum(
330        env: *mut MDB_env,
331        func: MDB_sum_func,
332        size: ::libc::c_uint,
333    ) -> ::libc::c_int;
334}
335extern "C" {
336    #[doc = "Create a transaction for use with the environment.\n\n The transaction handle may be discarded using #mdb_txn_abort() or #mdb_txn_commit().\n > **Note:** A transaction and its cursors must only be used by a single\n thread, and a thread may only have a single transaction at a time.\n If #MDB_NOTLS is in use, this does not apply to read-only transactions.\n > **Note:** Cursors may not span transactions.\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `parent` (direction in) - If this parameter is non-NULL, the new transaction\n will be a nested transaction, with the transaction indicated by **parent**\n as its parent. Transactions may be nested to any level. A parent\n transaction and its cursors may not issue any other operations than\n mdb_txn_commit and mdb_txn_abort while it has active child transactions.\n * `flags` (direction in) - Special options for this transaction. This parameter\n must be set to 0 or by bitwise OR'ing together one or more of the\n values described here.\n <ul>\n\t<li>#MDB_RDONLY\n\t\tThis transaction will not perform any write operations.\n\t<li>#MDB_NOSYNC\n\t\tDon't flush system buffers to disk when committing this transaction.\n\t<li>#MDB_NOMETASYNC\n\t\tFlush system buffers but omit metadata flush when committing this transaction.\n </ul>\n * `txn` (direction out) - Address where the new #MDB_txn handle will be stored\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_PANIC - a fatal error occurred earlier and the environment\n\t\tmust be shut down.\n\t<li>#MDB_MAP_RESIZED - another process wrote data beyond this MDB_env's\n\t\tmapsize and this environment's map must be resized as well.\n\t\tSee #mdb_env_set_mapsize().\n\t<li>#MDB_READERS_FULL - a read-only transaction was requested and\n\t\tthe reader lock table is full. See #mdb_env_set_maxreaders().\n\t<li>ENOMEM - out of memory.\n </ul>"]
337    pub fn mdb_txn_begin(
338        env: *mut MDB_env,
339        parent: *mut MDB_txn,
340        flags: ::libc::c_uint,
341        txn: *mut *mut MDB_txn,
342    ) -> ::libc::c_int;
343}
344extern "C" {
345    #[doc = "Returns the transaction's #MDB_env\n\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()"]
346    pub fn mdb_txn_env(txn: *mut MDB_txn) -> *mut MDB_env;
347}
348extern "C" {
349    #[doc = "Return the transaction's ID.\n\n This returns the identifier associated with this transaction. For a\n read-only transaction, this corresponds to the snapshot being read;\n concurrent readers will frequently have the same transaction ID.\n\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n # Returns\n\nA transaction ID, valid if input is an active transaction."]
350    pub fn mdb_txn_id(txn: *mut MDB_txn) -> mdb_size_t;
351}
352extern "C" {
353    #[doc = "Commit all the operations of a transaction into the database.\n\n The transaction handle is freed. It and its cursors must not be used\n again after this call, except with #mdb_cursor_renew().\n > **Note:** Earlier documentation incorrectly said all cursors would be freed.\n Only write-transactions free cursors.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n\t<li>ENOSPC - no more disk space.\n\t<li>EIO - a low-level I/O error occurred while writing.\n\t<li>ENOMEM - out of memory.\n </ul>"]
354    pub fn mdb_txn_commit(txn: *mut MDB_txn) -> ::libc::c_int;
355}
356extern "C" {
357    #[doc = "Abandon all the operations of the transaction instead of saving them.\n\n The transaction handle is freed. It and its cursors must not be used\n again after this call, except with #mdb_cursor_renew().\n > **Note:** Earlier documentation incorrectly said all cursors would be freed.\n Only write-transactions free cursors.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()"]
358    pub fn mdb_txn_abort(txn: *mut MDB_txn);
359}
360extern "C" {
361    #[doc = "Reset a read-only transaction.\n\n Abort the transaction like #mdb_txn_abort(), but keep the transaction\n handle. #mdb_txn_renew() may reuse the handle. This saves allocation\n overhead if the process will start a new read-only transaction soon,\n and also locking overhead if #MDB_NOTLS is in use. The reader table\n lock is released, but the table slot stays tied to its thread or\n #MDB_txn. Use mdb_txn_abort() to discard a reset handle, and to free\n its lock table slot if MDB_NOTLS is in use.\n Cursors opened within the transaction must not be used\n again after this call, except with #mdb_cursor_renew().\n Reader locks generally don't interfere with writers, but they keep old\n versions of database pages allocated. Thus they prevent the old pages\n from being reused when writers commit new data, and so under heavy load\n the database size may grow much more rapidly than otherwise.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()"]
362    pub fn mdb_txn_reset(txn: *mut MDB_txn);
363}
364extern "C" {
365    #[doc = "Renew a read-only transaction.\n\n This acquires a new reader lock for a transaction handle that had been\n released by #mdb_txn_reset(). It must be called before a reset transaction\n may be used again.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_PANIC - a fatal error occurred earlier and the environment\n\t\tmust be shut down.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
366    pub fn mdb_txn_renew(txn: *mut MDB_txn) -> ::libc::c_int;
367}
368extern "C" {
369    #[doc = "Open a database in the environment.\n\n A database handle denotes the name and parameters of a database,\n independently of whether such a database exists.\n The database handle may be discarded by calling #mdb_dbi_close().\n The old database handle is returned if the database was already open.\n The handle may only be closed once.\n\n The database handle will be private to the current transaction until\n the transaction is successfully committed. If the transaction is\n aborted the handle will be closed automatically.\n After a successful commit the handle will reside in the shared\n environment, and may be used by other transactions.\n\n This function must not be called from multiple concurrent\n transactions in the same process. A transaction that uses\n this function must finish (either commit or abort) before\n any other transaction in the process may use this function.\n\n To use named databases (with name != NULL), #mdb_env_set_maxdbs()\n must be called before opening the environment. Database names are\n keys in the unnamed database, and may be read but not written.\n > **Note:** Names are C strings and stored with their NUL terminator included.\n In LMDB 0.9 the NUL terminator was omitted.\n\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `name` (direction in) - The name of the database to open. If only a single\n \tdatabase is needed in the environment, this value may be NULL.\n * `flags` (direction in) - Special options for this database. This parameter\n must be set to 0 or by bitwise OR'ing together one or more of the\n values described here.\n <ul>\n\t<li>#MDB_REVERSEKEY\n\t\tKeys are strings to be compared in reverse order, from the end\n\t\tof the strings to the beginning. By default, Keys are treated as strings and\n\t\tcompared from beginning to end.\n\t<li>#MDB_DUPSORT\n\t\tDuplicate keys may be used in the database. (Or, from another perspective,\n\t\tkeys may have multiple data items, stored in sorted order.) By default\n\t\tkeys must be unique and may have only a single data item.\n\t<li>#MDB_INTEGERKEY\n\t\tKeys are binary integers in native byte order, either unsigned int\n\t\tor #mdb_size_t, and will be sorted as such.\n\t\t(lmdb expects 32-bit int <= size_t <= 32/64-bit mdb_size_t.)\n\t\tThe keys must all be of the same size.\n\t<li>#MDB_DUPFIXED\n\t\tThis flag may only be used in combination with #MDB_DUPSORT. This option\n\t\ttells the library that the data items for this database are all the same\n\t\tsize, which allows further optimizations in storage and retrieval. When\n\t\tall data items are the same size, the #MDB_GET_MULTIPLE, #MDB_NEXT_MULTIPLE\n\t\tand #MDB_PREV_MULTIPLE cursor operations may be used to retrieve multiple\n\t\titems at once.\n\t<li>#MDB_INTEGERDUP\n\t\tThis option specifies that duplicate data items are binary integers,\n\t\tsimilar to #MDB_INTEGERKEY keys.\n\t<li>#MDB_REVERSEDUP\n\t\tThis option specifies that duplicate data items should be compared as\n\t\tstrings in reverse order.\n\t<li>#MDB_CREATE\n\t\tCreate the named database if it doesn't exist. This option is not\n\t\tallowed in a read-only transaction or a read-only environment.\n </ul>\n * `dbi` (direction out) - Address where the new #MDB_dbi handle will be stored\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_NOTFOUND - the specified database doesn't exist in the environment\n\t\tand #MDB_CREATE was not specified.\n\t<li>#MDB_DBS_FULL - too many databases have been opened. See #mdb_env_set_maxdbs().\n </ul>"]
370    pub fn mdb_dbi_open(
371        txn: *mut MDB_txn,
372        name: *const ::libc::c_char,
373        flags: ::libc::c_uint,
374        dbi: *mut MDB_dbi,
375    ) -> ::libc::c_int;
376}
377extern "C" {
378    #[doc = "Retrieve statistics for a database.\n\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `stat` (direction out) - The address of an #MDB_stat structure\n \twhere the statistics will be copied\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
379    pub fn mdb_stat(txn: *mut MDB_txn, dbi: MDB_dbi, stat: *mut MDB_stat) -> ::libc::c_int;
380}
381extern "C" {
382    #[doc = "Retrieve the DB flags for a database handle.\n\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `flags` (direction out) - Address where the flags will be returned.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
383    pub fn mdb_dbi_flags(
384        txn: *mut MDB_txn,
385        dbi: MDB_dbi,
386        flags: *mut ::libc::c_uint,
387    ) -> ::libc::c_int;
388}
389extern "C" {
390    #[doc = "Close a database handle. Normally unnecessary. Use with care:\n\n This call is not mutex protected. Handles should only be closed by\n a single thread, and only if no other threads are going to reference\n the database handle or one of its cursors any further. Do not close\n a handle if an existing transaction has modified its database.\n Doing so can cause misbehavior from database corruption to errors\n like MDB_BAD_VALSIZE (since the DB name is gone).\n\n Closing a database handle is not necessary, but lets #mdb_dbi_open()\n reuse the handle value. Usually it's better to set a bigger\n #mdb_env_set_maxdbs(), unless that value would be large.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()"]
391    pub fn mdb_dbi_close(env: *mut MDB_env, dbi: MDB_dbi);
392}
393extern "C" {
394    #[doc = "Empty or delete+close a database.\n\n See #mdb_dbi_close() for restrictions about closing the DB handle.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `del` (direction in) - 0 to empty the DB, 1 to delete it from the\n environment and close the DB handle.\n # Returns\n\nA non-zero error value on failure and 0 on success."]
395    pub fn mdb_drop(txn: *mut MDB_txn, dbi: MDB_dbi, del: ::libc::c_int) -> ::libc::c_int;
396}
397extern "C" {
398    #[doc = "Set a custom key comparison function for a database.\n\n The comparison function is called whenever it is necessary to compare a\n key specified by the application with a key currently stored in the database.\n If no comparison function is specified, and no special key flags were specified\n with #mdb_dbi_open(), the keys are compared lexically, with shorter keys collating\n before longer keys.\n This function must be called before any data access functions are used,\n otherwise data corruption may occur. The same comparison function must be used by every\n program accessing the database, every time the database is used.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `cmp` (direction in) - A #MDB_cmp_func function\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
399    pub fn mdb_set_compare(txn: *mut MDB_txn, dbi: MDB_dbi, cmp: MDB_cmp_func) -> ::libc::c_int;
400}
401extern "C" {
402    #[doc = "Set a custom data comparison function for a #MDB_DUPSORT database.\n\n This comparison function is called whenever it is necessary to compare a data\n item specified by the application with a data item currently stored in the database.\n This function only takes effect if the database was opened with the #MDB_DUPSORT\n flag.\n If no comparison function is specified, and no special key flags were specified\n with #mdb_dbi_open(), the data items are compared lexically, with shorter items collating\n before longer items.\n This function must be called before any data access functions are used,\n otherwise data corruption may occur. The same comparison function must be used by every\n program accessing the database, every time the database is used.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `cmp` (direction in) - A #MDB_cmp_func function\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
403    pub fn mdb_set_dupsort(txn: *mut MDB_txn, dbi: MDB_dbi, cmp: MDB_cmp_func) -> ::libc::c_int;
404}
405extern "C" {
406    #[doc = "Set a relocation function for a #MDB_FIXEDMAP database.\n\n The relocation function is called whenever it is necessary to move the data\n of an item to a different position in the database (e.g. through tree\n balancing operations, shifts as a result of adds or deletes, etc.). It is\n intended to allow address/position-dependent data items to be stored in\n a database in an environment opened with the #MDB_FIXEDMAP option.\n Currently the relocation feature is unimplemented and setting\n this function has no effect.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `rel` (direction in) - A #MDB_rel_func function\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
407    pub fn mdb_set_relfunc(txn: *mut MDB_txn, dbi: MDB_dbi, rel: MDB_rel_func) -> ::libc::c_int;
408}
409extern "C" {
410    #[doc = "Set a context pointer for a #MDB_FIXEDMAP database's relocation function.\n\n See #mdb_set_relfunc and #MDB_rel_func for more details.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `ctx` (direction in) - An arbitrary pointer for whatever the application needs.\n It will be passed to the callback function set by #mdb_set_relfunc\n as its **relctx** parameter whenever the callback is invoked.\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
411    pub fn mdb_set_relctx(
412        txn: *mut MDB_txn,
413        dbi: MDB_dbi,
414        ctx: *mut ::libc::c_void,
415    ) -> ::libc::c_int;
416}
417extern "C" {
418    #[doc = "Get items from a database.\n\n This function retrieves key/data pairs from the database. The address\n and length of the data associated with the specified **key** are returned\n in the structure to which **data** refers.\n If the database supports duplicate keys (#MDB_DUPSORT) then the\n first data item for the key will be returned. Retrieval of other\n items requires the use of #mdb_cursor_get().\n\n > **Note:** The memory pointed to by the returned values is owned by the\n database. The caller need not dispose of the memory, and may not\n modify it in any way. For values returned in a read-only transaction\n any modification attempts will cause a SIGSEGV.\n > **Note:** Values returned from the database are valid only until a\n subsequent update operation, or the end of the transaction.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `key` (direction in) - The key to search for in the database\n * `data` (direction out) - The data corresponding to the key\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_NOTFOUND - the key was not in the database.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
419    pub fn mdb_get(
420        txn: *mut MDB_txn,
421        dbi: MDB_dbi,
422        key: *mut MDB_val,
423        data: *mut MDB_val,
424    ) -> ::libc::c_int;
425}
426extern "C" {
427    #[doc = "Store items into a database.\n\n This function stores key/data pairs in the database. The default behavior\n is to enter the new key/data pair, replacing any previously existing key\n if duplicates are disallowed, or adding a duplicate data item if\n duplicates are allowed (#MDB_DUPSORT).\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `key` (direction in) - The key to store in the database\n * `data` (direction in, out) - The data to store\n * `flags` (direction in) - Special options for this operation. This parameter\n must be set to 0 or by bitwise OR'ing together one or more of the\n values described here.\n <ul>\n\t<li>#MDB_NODUPDATA - enter the new key/data pair only if it does not\n\t\talready appear in the database. This flag may only be specified\n\t\tif the database was opened with #MDB_DUPSORT. The function will\n\t\treturn #MDB_KEYEXIST if the key/data pair already appears in the\n\t\tdatabase.\n\t<li>#MDB_NOOVERWRITE - enter the new key/data pair only if the key\n\t\tdoes not already appear in the database. The function will return\n\t\t#MDB_KEYEXIST if the key already appears in the database, even if\n\t\tthe database supports duplicates (#MDB_DUPSORT). The **data**\n\t\tparameter will be set to point to the existing item.\n\t<li>#MDB_RESERVE - reserve space for data of the given size, but\n\t\tdon't copy the given data. Instead, return a pointer to the\n\t\treserved space, which the caller can fill in later - before\n\t\tthe next update operation or the transaction ends. This saves\n\t\tan extra memcpy if the data is being generated later.\n\t\tLMDB does nothing else with this memory, the caller is expected\n\t\tto modify all of the space requested. This flag must not be\n\t\tspecified if the database was opened with #MDB_DUPSORT.\n\t<li>#MDB_APPEND - append the given key/data pair to the end of the\n\t\tdatabase. This option allows fast bulk loading when keys are\n\t\talready known to be in the correct order. Loading unsorted keys\n\t\twith this flag will cause a #MDB_KEYEXIST error.\n\t<li>#MDB_APPENDDUP - as above, but for sorted dup data.\n </ul>\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_MAP_FULL - the database is full, see #mdb_env_set_mapsize().\n\t<li>#MDB_TXN_FULL - the transaction has too many dirty pages.\n\t<li>EACCES - an attempt was made to write in a read-only transaction.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
428    pub fn mdb_put(
429        txn: *mut MDB_txn,
430        dbi: MDB_dbi,
431        key: *mut MDB_val,
432        data: *mut MDB_val,
433        flags: ::libc::c_uint,
434    ) -> ::libc::c_int;
435}
436extern "C" {
437    #[doc = "Delete items from a database.\n\n This function removes key/data pairs from the database.\n If the database does not support sorted duplicate data items\n (#MDB_DUPSORT) the data parameter is ignored.\n If the database supports sorted duplicates and the data parameter\n is NULL, all of the duplicate data items for the key will be\n deleted. Otherwise, if the data parameter is non-NULL\n only the matching data item will be deleted.\n This function will return #MDB_NOTFOUND if the specified key/data\n pair is not in the database.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `key` (direction in) - The key to delete from the database\n * `data` (direction in) - The data to delete\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EACCES - an attempt was made to write in a read-only transaction.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
438    pub fn mdb_del(
439        txn: *mut MDB_txn,
440        dbi: MDB_dbi,
441        key: *mut MDB_val,
442        data: *mut MDB_val,
443    ) -> ::libc::c_int;
444}
445extern "C" {
446    #[doc = "Create a cursor handle.\n\n A cursor is associated with a specific transaction and database.\n A cursor cannot be used when its database handle is closed. Nor\n when its transaction has ended, except with #mdb_cursor_renew().\n It can be discarded with #mdb_cursor_close().\n A cursor in a write-transaction can be closed before its transaction\n ends, and will otherwise be closed when its transaction ends.\n A cursor in a read-only transaction must be closed explicitly, before\n or after its transaction ends. It can be reused with\n #mdb_cursor_renew() before finally closing it.\n > **Note:** Earlier documentation said that cursors in every transaction\n were closed when the transaction committed or aborted.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `cursor` (direction out) - Address where the new #MDB_cursor handle will be stored\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
447    pub fn mdb_cursor_open(
448        txn: *mut MDB_txn,
449        dbi: MDB_dbi,
450        cursor: *mut *mut MDB_cursor,
451    ) -> ::libc::c_int;
452}
453extern "C" {
454    #[doc = "Close a cursor handle.\n\n The cursor handle will be freed and must not be used again after this call.\n Its transaction must still be live if it is a write-transaction.\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()"]
455    pub fn mdb_cursor_close(cursor: *mut MDB_cursor);
456}
457extern "C" {
458    #[doc = "Renew a cursor handle.\n\n A cursor is associated with a specific transaction and database.\n Cursors that are only used in read-only\n transactions may be re-used, to avoid unnecessary malloc/free overhead.\n The cursor may be associated with a new read-only transaction, and\n referencing the same database handle as it was created with.\n This may be done whether the previous transaction is live or dead.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
459    pub fn mdb_cursor_renew(txn: *mut MDB_txn, cursor: *mut MDB_cursor) -> ::libc::c_int;
460}
461extern "C" {
462    #[doc = "Return the cursor's transaction handle.\n\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()"]
463    pub fn mdb_cursor_txn(cursor: *mut MDB_cursor) -> *mut MDB_txn;
464}
465extern "C" {
466    #[doc = "Return the cursor's database handle.\n\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()"]
467    pub fn mdb_cursor_dbi(cursor: *mut MDB_cursor) -> MDB_dbi;
468}
469extern "C" {
470    #[doc = "Check if the cursor is pointing to a named database record.\n\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()\n # Returns\n\n1 if current record is a named database, 0 otherwise."]
471    pub fn mdb_cursor_is_db(cursor: *mut MDB_cursor) -> ::libc::c_int;
472}
473extern "C" {
474    #[doc = "Retrieve by cursor.\n\n This function retrieves key/data pairs from the database. The address and length\n of the key are returned in the object to which **key** refers (except for the\n case of the #MDB_SET option, in which the **key** object is unchanged), and\n the address and length of the data are returned in the object to which **data**\n refers.\n See #mdb_get() for restrictions on using the output values.\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()\n * `key` (direction in, out) - The key for a retrieved item\n * `data` (direction in, out) - The data of a retrieved item\n * `op` (direction in) - A cursor operation #MDB_cursor_op\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_NOTFOUND - no matching key found.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
475    pub fn mdb_cursor_get(
476        cursor: *mut MDB_cursor,
477        key: *mut MDB_val,
478        data: *mut MDB_val,
479        op: MDB_cursor_op,
480    ) -> ::libc::c_int;
481}
482extern "C" {
483    #[doc = "Store by cursor.\n\n This function stores key/data pairs into the database.\n The cursor is positioned at the new item, or on failure usually near it.\n > **Note:** Earlier documentation incorrectly said errors would leave the\n state of the cursor unchanged.\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()\n * `key` (direction in) - The key operated on.\n * `data` (direction in) - The data operated on.\n * `flags` (direction in) - Options for this operation. This parameter\n must be set to 0 or one of the values described here.\n <ul>\n\t<li>#MDB_CURRENT - replace the item at the current cursor position.\n\t\tThe **key** parameter must still be provided, and must match it.\n\t\tIf using sorted duplicates (#MDB_DUPSORT) the data item must still\n\t\tsort into the same place. This is intended to be used when the\n\t\tnew data is the same size as the old. Otherwise it will simply\n\t\tperform a delete of the old record followed by an insert.\n\t<li>#MDB_NODUPDATA - enter the new key/data pair only if it does not\n\t\talready appear in the database. This flag may only be specified\n\t\tif the database was opened with #MDB_DUPSORT. The function will\n\t\treturn #MDB_KEYEXIST if the key/data pair already appears in the\n\t\tdatabase.\n\t<li>#MDB_NOOVERWRITE - enter the new key/data pair only if the key\n\t\tdoes not already appear in the database. The function will return\n\t\t#MDB_KEYEXIST if the key already appears in the database, even if\n\t\tthe database supports duplicates (#MDB_DUPSORT).\n\t<li>#MDB_RESERVE - reserve space for data of the given size, but\n\t\tdon't copy the given data. Instead, return a pointer to the\n\t\treserved space, which the caller can fill in later - before\n\t\tthe next update operation or the transaction ends. This saves\n\t\tan extra memcpy if the data is being generated later. This flag\n\t\tmust not be specified if the database was opened with #MDB_DUPSORT.\n\t<li>#MDB_APPEND - append the given key/data pair to the end of the\n\t\tdatabase. No key comparisons are performed. This option allows\n\t\tfast bulk loading when keys are already known to be in the\n\t\tcorrect order. Loading unsorted keys with this flag will cause\n\t\ta #MDB_KEYEXIST error.\n\t<li>#MDB_APPENDDUP - as above, but for sorted dup data.\n\t<li>#MDB_MULTIPLE - store multiple contiguous data elements in a\n\t\tsingle request. This flag may only be specified if the database\n\t\twas opened with #MDB_DUPFIXED. The **data** argument must be an\n\t\tarray of two MDB_vals. The mv_size of the first MDB_val must be\n\t\tthe size of a single data element. The mv_data of the first MDB_val\n\t\tmust point to the beginning of the array of contiguous data elements.\n\t\tThe mv_size of the second MDB_val must be the count of the number\n\t\tof data elements to store. On return this field will be set to\n\t\tthe count of the number of elements actually written. The mv_data\n\t\tof the second MDB_val is unused.\n </ul>\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>#MDB_MAP_FULL - the database is full, see #mdb_env_set_mapsize().\n\t<li>#MDB_TXN_FULL - the transaction has too many dirty pages.\n\t<li>EACCES - an attempt was made to write in a read-only transaction.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
484    pub fn mdb_cursor_put(
485        cursor: *mut MDB_cursor,
486        key: *mut MDB_val,
487        data: *mut MDB_val,
488        flags: ::libc::c_uint,
489    ) -> ::libc::c_int;
490}
491extern "C" {
492    #[doc = "Delete current key/data pair\n\n This function deletes the key/data pair to which the cursor refers.\n This does not invalidate the cursor, so operations such as MDB_NEXT\n can still be used on it.\n Both MDB_NEXT and MDB_GET_CURRENT will return the same record after\n this operation.\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()\n * `flags` (direction in) - Options for this operation. This parameter\n must be set to 0 or one of the values described here.\n <ul>\n\t<li>#MDB_NODUPDATA - delete all of the data items for the current key.\n\t\tThis flag may only be specified if the database was opened with #MDB_DUPSORT.\n </ul>\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EACCES - an attempt was made to write in a read-only transaction.\n\t<li>EINVAL - an invalid parameter was specified.\n </ul>"]
493    pub fn mdb_cursor_del(cursor: *mut MDB_cursor, flags: ::libc::c_uint) -> ::libc::c_int;
494}
495extern "C" {
496    #[doc = "Return count of duplicates for current key.\n\n This call is only valid on databases that support sorted duplicate\n data items #MDB_DUPSORT.\n # Arguments\n\n* `cursor` (direction in) - A cursor handle returned by #mdb_cursor_open()\n * `countp` (direction out) - Address where the count will be stored\n # Returns\n\nA non-zero error value on failure and 0 on success. Some possible\n errors are:\n <ul>\n\t<li>EINVAL - cursor is not initialized, or an invalid parameter was specified.\n </ul>"]
497    pub fn mdb_cursor_count(cursor: *mut MDB_cursor, countp: *mut mdb_size_t) -> ::libc::c_int;
498}
499extern "C" {
500    #[doc = "Compare two data items according to a particular database.\n\n This returns a comparison as if the two data items were keys in the\n specified database.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `a` (direction in) - The first item to compare\n * `b` (direction in) - The second item to compare\n # Returns\n\n< 0 if a < b, 0 if a == b, > 0 if a > b"]
501    pub fn mdb_cmp(
502        txn: *mut MDB_txn,
503        dbi: MDB_dbi,
504        a: *const MDB_val,
505        b: *const MDB_val,
506    ) -> ::libc::c_int;
507}
508extern "C" {
509    #[doc = "Compare two data items according to a particular database.\n\n This returns a comparison as if the two items were data items of\n the specified database. The database must have the #MDB_DUPSORT flag.\n # Arguments\n\n* `txn` (direction in) - A transaction handle returned by #mdb_txn_begin()\n * `dbi` (direction in) - A database handle returned by #mdb_dbi_open()\n * `a` (direction in) - The first item to compare\n * `b` (direction in) - The second item to compare\n # Returns\n\n< 0 if a < b, 0 if a == b, > 0 if a > b"]
510    pub fn mdb_dcmp(
511        txn: *mut MDB_txn,
512        dbi: MDB_dbi,
513        a: *const MDB_val,
514        b: *const MDB_val,
515    ) -> ::libc::c_int;
516}
517#[doc = "A callback function used to print a message from the library.\n\n # Arguments\n\n* `msg` (direction in) - The string to be printed.\n * `ctx` (direction in) - An arbitrary context pointer for the callback.\n # Returns\n\n< 0 on failure, >= 0 on success."]
518pub type MDB_msg_func = ::std::option::Option<
519    unsafe extern "C" fn(msg: *const ::libc::c_char, ctx: *mut ::libc::c_void) -> ::libc::c_int,
520>;
521extern "C" {
522    #[doc = "Dump the entries in the reader lock table.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `func` (direction in) - A #MDB_msg_func function\n * `ctx` (direction in) - Anything the message function needs\n # Returns\n\n< 0 on failure, >= 0 on success."]
523    pub fn mdb_reader_list(
524        env: *mut MDB_env,
525        func: MDB_msg_func,
526        ctx: *mut ::libc::c_void,
527    ) -> ::libc::c_int;
528}
529extern "C" {
530    #[doc = "Check for stale entries in the reader lock table.\n\n # Arguments\n\n* `env` (direction in) - An environment handle returned by #mdb_env_create()\n * `dead` (direction out) - Number of stale slots that were cleared\n # Returns\n\n0 on success, non-zero on failure."]
531    pub fn mdb_reader_check(env: *mut MDB_env, dead: *mut ::libc::c_int) -> ::libc::c_int;
532}
533#[doc = "A function for converting a string into an encryption key.\n\n # Arguments\n\n* `passwd` (direction in) - The string to be converted.\n * `key` (direction in, out) - The resulting key. The caller must\n provide the space for the key.\n # Returns\n\n0 on success, non-zero on failure."]
534pub type MDB_str2key_func = ::std::option::Option<
535    unsafe extern "C" fn(passwd: *const ::libc::c_char, key: *mut MDB_val) -> ::libc::c_int,
536>;
537#[doc = "A structure for dynamically loaded crypto modules.\n\n This is the information that the command line tools expect\n in order to operate on encrypted or checksummed environments."]
538#[repr(C)]
539#[derive(Debug, Copy, Clone)]
540pub struct MDB_crypto_funcs {
541    pub mcf_str2key: MDB_str2key_func,
542    pub mcf_encfunc: MDB_enc_func,
543    pub mcf_sumfunc: MDB_sum_func,
544    #[doc = "< The size of an encryption key, in bytes"]
545    pub mcf_keysize: ::libc::c_int,
546    #[doc = "< The size of the MAC, for authenticated encryption"]
547    pub mcf_esumsize: ::libc::c_int,
548    #[doc = "< The size of the checksum, for plain checksums"]
549    pub mcf_sumsize: ::libc::c_int,
550}
551#[doc = "The function that returns the #MDB_crypto_funcs structure.\n\n The command line tools expect this function to be named \"MDB_crypto\".\n It must be exported by the dynamic module so that the tools can use it.\n # Returns\n\nA pointer to a #MDB_crypto_funcs structure."]
552pub type MDB_crypto_hooks = ::std::option::Option<unsafe extern "C" fn() -> *mut MDB_crypto_funcs>;