1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
/* automatically generated by rust-bindgen */

pub const MDBX_ENODATA: ::libc::c_uint = 96;
pub const MDBX_EINVAL: ::libc::c_uint = 22;
pub const MDBX_EACCESS: ::libc::c_uint = 13;
pub const MDBX_ENOMEM: ::libc::c_uint = 12;
pub const MDBX_EROFS: ::libc::c_uint = 30;
pub const MDBX_ENOSYS: ::libc::c_uint = 78;
pub const MDBX_EIO: ::libc::c_uint = 5;
pub const MDBX_EPERM: ::libc::c_uint = 1;
pub const MDBX_EINTR: ::libc::c_uint = 4;
pub const MDBX_ENOFILE: ::libc::c_uint = 2;
pub const MDBX_EREMOTE: ::libc::c_uint = 15;
pub const MDBX_VERSION_MAJOR: ::libc::c_uint = 0;
pub const MDBX_VERSION_MINOR: ::libc::c_uint = 7;
pub const MDBX_MAXDATASIZE: ::libc::c_uint = 2147483647;
pub const MDBX_LOG_FATAL: ::libc::c_uint = 0;
pub const MDBX_LOG_ERROR: ::libc::c_uint = 1;
pub const MDBX_LOG_WARN: ::libc::c_uint = 2;
pub const MDBX_LOG_NOTICE: ::libc::c_uint = 3;
pub const MDBX_LOG_VERBOSE: ::libc::c_uint = 4;
pub const MDBX_LOG_DEBUG: ::libc::c_uint = 5;
pub const MDBX_LOG_TRACE: ::libc::c_uint = 6;
pub const MDBX_LOG_EXTRA: ::libc::c_uint = 7;
pub const MDBX_DBG_ASSERT: ::libc::c_uint = 1;
pub const MDBX_DBG_AUDIT: ::libc::c_uint = 2;
pub const MDBX_DBG_JITTER: ::libc::c_uint = 4;
pub const MDBX_DBG_DUMP: ::libc::c_uint = 8;
pub const MDBX_DBG_LEGACY_MULTIOPEN: ::libc::c_uint = 16;
pub const MDBX_DBG_LEGACY_OVERLAP: ::libc::c_uint = 32;
pub const MDBX_LOG_DONTCHANGE: ::libc::c_int = -1;
pub const MDBX_DBG_DONTCHANGE: ::libc::c_int = -1;
pub const MDBX_LOCKNAME: &'static [u8; 10usize] = b"/mdbx.lck\0";
pub const MDBX_DATANAME: &'static [u8; 10usize] = b"/mdbx.dat\0";
pub const MDBX_LOCK_SUFFIX: &'static [u8; 5usize] = b"-lck\0";
pub const MDBX_NOSUBDIR: ::libc::c_uint = 16384;
pub const MDBX_RDONLY: ::libc::c_uint = 131072;
pub const MDBX_EXCLUSIVE: ::libc::c_uint = 4194304;
pub const MDBX_ACCEDE: ::libc::c_uint = 1073741824;
pub const MDBX_WRITEMAP: ::libc::c_uint = 524288;
pub const MDBX_NOTLS: ::libc::c_uint = 2097152;
pub const MDBX_NORDAHEAD: ::libc::c_uint = 8388608;
pub const MDBX_NOMEMINIT: ::libc::c_uint = 16777216;
pub const MDBX_COALESCE: ::libc::c_uint = 33554432;
pub const MDBX_LIFORECLAIM: ::libc::c_uint = 67108864;
pub const MDBX_PAGEPERTURB: ::libc::c_uint = 134217728;
pub const MDBX_NOMETASYNC: ::libc::c_uint = 262144;
pub const MDBX_SAFE_NOSYNC: ::libc::c_uint = 65536;
pub const MDBX_MAPASYNC: ::libc::c_uint = 1048576;
pub const MDBX_UTTERLY_NOSYNC: ::libc::c_uint = 1114112;
pub const MDBX_REVERSEKEY: ::libc::c_uint = 2;
pub const MDBX_DUPSORT: ::libc::c_uint = 4;
pub const MDBX_INTEGERKEY: ::libc::c_uint = 8;
pub const MDBX_DUPFIXED: ::libc::c_uint = 16;
pub const MDBX_INTEGERDUP: ::libc::c_uint = 32;
pub const MDBX_REVERSEDUP: ::libc::c_uint = 64;
pub const MDBX_CREATE: ::libc::c_uint = 262144;
pub const MDBX_NOOVERWRITE: ::libc::c_uint = 16;
pub const MDBX_NODUPDATA: ::libc::c_uint = 32;
pub const MDBX_CURRENT: ::libc::c_uint = 64;
pub const MDBX_RESERVE: ::libc::c_uint = 65536;
pub const MDBX_APPEND: ::libc::c_uint = 131072;
pub const MDBX_APPENDDUP: ::libc::c_uint = 262144;
pub const MDBX_MULTIPLE: ::libc::c_uint = 524288;
pub const MDBX_TRYTXN: ::libc::c_uint = 268435456;
pub const MDBX_CP_COMPACT: ::libc::c_uint = 1;
pub const MDBX_SUCCESS: ::libc::c_int = 0;
pub const MDBX_RESULT_FALSE: ::libc::c_uint = 0;
pub const MDBX_RESULT_TRUE: ::libc::c_int = -1;
pub const MDBX_KEYEXIST: ::libc::c_int = -30799;
pub const MDBX_NOTFOUND: ::libc::c_int = -30798;
pub const MDBX_PAGE_NOTFOUND: ::libc::c_int = -30797;
pub const MDBX_CORRUPTED: ::libc::c_int = -30796;
pub const MDBX_PANIC: ::libc::c_int = -30795;
pub const MDBX_VERSION_MISMATCH: ::libc::c_int = -30794;
pub const MDBX_INVALID: ::libc::c_int = -30793;
pub const MDBX_MAP_FULL: ::libc::c_int = -30792;
pub const MDBX_DBS_FULL: ::libc::c_int = -30791;
pub const MDBX_READERS_FULL: ::libc::c_int = -30790;
pub const MDBX_TXN_FULL: ::libc::c_int = -30788;
pub const MDBX_CURSOR_FULL: ::libc::c_int = -30787;
pub const MDBX_PAGE_FULL: ::libc::c_int = -30786;
pub const MDBX_UNABLE_EXTEND_MAPSIZE: ::libc::c_int = -30785;
pub const MDBX_INCOMPATIBLE: ::libc::c_int = -30784;
pub const MDBX_BAD_RSLOT: ::libc::c_int = -30783;
pub const MDBX_BAD_TXN: ::libc::c_int = -30782;
pub const MDBX_BAD_VALSIZE: ::libc::c_int = -30781;
pub const MDBX_BAD_DBI: ::libc::c_int = -30780;
pub const MDBX_PROBLEM: ::libc::c_int = -30779;
pub const MDBX_LAST_LMDB_ERRCODE: ::libc::c_int = -30779;
pub const MDBX_BUSY: ::libc::c_int = -30778;
pub const MDBX_EMULTIVAL: ::libc::c_int = -30421;
pub const MDBX_EBADSIGN: ::libc::c_int = -30420;
pub const MDBX_WANNA_RECOVERY: ::libc::c_int = -30419;
pub const MDBX_EKEYMISMATCH: ::libc::c_int = -30418;
pub const MDBX_TOO_LARGE: ::libc::c_int = -30417;
pub const MDBX_THREAD_MISMATCH: ::libc::c_int = -30416;
pub const MDBX_TXN_OVERLAPPING: ::libc::c_int = -30415;
pub const MDBX_MIN_PAGESIZE: ::libc::c_uint = 256;
pub const MDBX_MAX_PAGESIZE: ::libc::c_uint = 65536;
pub const MDBX_TBL_DIRTY: ::libc::c_uint = 1;
pub const MDBX_TBL_STALE: ::libc::c_uint = 2;
pub const MDBX_TBL_FRESH: ::libc::c_uint = 4;
pub const MDBX_TBL_CREAT: ::libc::c_uint = 8;
pub type va_list = __builtin_va_list;
pub type __uint16_t = ::libc::c_ushort;
pub type __int32_t = ::libc::c_int;
pub type __darwin_intptr_t = ::libc::c_long;
pub type __darwin_mode_t = __uint16_t;
pub type __darwin_pid_t = __int32_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __darwin_pthread_handler_rec {
    pub __routine: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::libc::c_void)>,
    pub __arg: *mut ::libc::c_void,
    pub __next: *mut __darwin_pthread_handler_rec,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct _opaque_pthread_t {
    pub __sig: ::libc::c_long,
    pub __cleanup_stack: *mut __darwin_pthread_handler_rec,
    pub __opaque: [::libc::c_char; 8176usize],
}
pub type __darwin_pthread_t = *mut _opaque_pthread_t;
pub type pthread_t = __darwin_pthread_t;
pub type pid_t = __darwin_pid_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iovec {
    pub iov_base: *mut ::libc::c_void,
    pub iov_len: usize,
}
pub type mdbx_pid_t = pid_t;
pub type mdbx_tid_t = pthread_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mdbx_version_info {
    pub major: u8,
    pub minor: u8,
    pub release: u16,
    pub revision: u32,
    pub git: mdbx_version_info__bindgen_ty_1,
    pub sourcery: *const ::libc::c_char,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mdbx_version_info__bindgen_ty_1 {
    pub datetime: *const ::libc::c_char,
    pub tree: *const ::libc::c_char,
    pub commit: *const ::libc::c_char,
    pub describe: *const ::libc::c_char,
}
extern "C" {
    pub static mdbx_version: mdbx_version_info;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mdbx_build_info {
    pub datetime: *const ::libc::c_char,
    pub target: *const ::libc::c_char,
    pub options: *const ::libc::c_char,
    pub compiler: *const ::libc::c_char,
    pub flags: *const ::libc::c_char,
}
extern "C" {
    pub static mdbx_build: mdbx_build_info;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_env {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_txn {
    _unused: [u8; 0],
}
pub type MDBX_dbi = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_cursor {
    _unused: [u8; 0],
}
pub type MDBX_val = iovec;
pub type MDBX_debug_func = ::std::option::Option<
    unsafe extern "C" fn(
        loglevel: ::libc::c_int,
        function: *const ::libc::c_char,
        line: ::libc::c_int,
        msg: *const ::libc::c_char,
        args: *mut __va_list_tag,
    ),
>;
extern "C" {
    pub fn mdbx_setup_debug(
        loglevel: ::libc::c_int,
        flags: ::libc::c_int,
        logger: MDBX_debug_func,
    ) -> ::libc::c_int;
}
pub type MDBX_assert_func = ::std::option::Option<
    unsafe extern "C" fn(
        env: *const MDBX_env,
        msg: *const ::libc::c_char,
        function: *const ::libc::c_char,
        line: ::libc::c_uint,
    ),
>;
extern "C" {
    pub fn mdbx_env_set_assert(env: *mut MDBX_env, func: MDBX_assert_func) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dump_val(
        key: *const MDBX_val,
        buf: *mut ::libc::c_char,
        bufsize: usize,
    ) -> *const ::libc::c_char;
}
#[repr(u32)]
#[doc = " CURSOR OPERATIONS ********************************************************"]
#[doc = ""]
#[doc = " This is the set of all operations for retrieving data"]
#[doc = " using a cursor."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum MDBX_cursor_op {
    MDBX_FIRST = 0,
    MDBX_FIRST_DUP = 1,
    MDBX_GET_BOTH = 2,
    MDBX_GET_BOTH_RANGE = 3,
    MDBX_GET_CURRENT = 4,
    MDBX_GET_MULTIPLE = 5,
    MDBX_LAST = 6,
    MDBX_LAST_DUP = 7,
    MDBX_NEXT = 8,
    MDBX_NEXT_DUP = 9,
    MDBX_NEXT_MULTIPLE = 10,
    MDBX_NEXT_NODUP = 11,
    MDBX_PREV = 12,
    MDBX_PREV_DUP = 13,
    MDBX_PREV_NODUP = 14,
    MDBX_SET = 15,
    MDBX_SET_KEY = 16,
    MDBX_SET_RANGE = 17,
    MDBX_PREV_MULTIPLE = 18,
}
extern "C" {
    #[doc = " FUNCTIONS & RELATED STRUCTURES"]
    pub fn mdbx_strerror(errnum: ::libc::c_int) -> *const ::libc::c_char;
}
extern "C" {
    pub fn mdbx_strerror_r(
        errnum: ::libc::c_int,
        buf: *mut ::libc::c_char,
        buflen: usize,
    ) -> *const ::libc::c_char;
}
extern "C" {
    pub fn mdbx_env_create(penv: *mut *mut MDBX_env) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_open(
        env: *mut MDBX_env,
        pathname: *const ::libc::c_char,
        flags: ::libc::c_uint,
        mode: mode_t,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_copy(
        env: *mut MDBX_env,
        dest: *const ::libc::c_char,
        flags: ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_copy2fd(
        env: *mut MDBX_env,
        fd: mdbx_filehandle_t,
        flags: ::libc::c_uint,
    ) -> ::libc::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_stat {
    pub ms_psize: u32,
    pub ms_depth: u32,
    pub ms_branch_pages: u64,
    pub ms_leaf_pages: u64,
    pub ms_overflow_pages: u64,
    pub ms_entries: u64,
    pub ms_mod_txnid: u64,
}
extern "C" {
    pub fn mdbx_env_stat_ex(
        env: *const MDBX_env,
        txn: *const MDBX_txn,
        stat: *mut MDBX_stat,
        bytes: usize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_stat(env: *mut MDBX_env, stat: *mut MDBX_stat, bytes: usize) -> ::libc::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_envinfo {
    pub mi_geo: MDBX_envinfo__bindgen_ty_1,
    pub mi_mapsize: u64,
    pub mi_last_pgno: u64,
    pub mi_recent_txnid: u64,
    pub mi_latter_reader_txnid: u64,
    pub mi_self_latter_reader_txnid: u64,
    pub mi_meta0_txnid: u64,
    pub mi_meta0_sign: u64,
    pub mi_meta1_txnid: u64,
    pub mi_meta1_sign: u64,
    pub mi_meta2_txnid: u64,
    pub mi_meta2_sign: u64,
    pub mi_maxreaders: u32,
    pub mi_numreaders: u32,
    pub mi_dxb_pagesize: u32,
    pub mi_sys_pagesize: u32,
    pub mi_bootid: MDBX_envinfo__bindgen_ty_2,
    pub mi_unsync_volume: u64,
    pub mi_autosync_threshold: u64,
    pub mi_since_sync_seconds16dot16: u32,
    pub mi_autosync_period_seconds16dot16: u32,
    pub mi_since_reader_check_seconds16dot16: u32,
    pub mi_mode: u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_envinfo__bindgen_ty_1 {
    pub lower: u64,
    pub upper: u64,
    pub current: u64,
    pub shrink: u64,
    pub grow: u64,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_envinfo__bindgen_ty_2 {
    pub current: MDBX_envinfo__bindgen_ty_2__bindgen_ty_1,
    pub meta0: MDBX_envinfo__bindgen_ty_2__bindgen_ty_1,
    pub meta1: MDBX_envinfo__bindgen_ty_2__bindgen_ty_1,
    pub meta2: MDBX_envinfo__bindgen_ty_2__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_envinfo__bindgen_ty_2__bindgen_ty_1 {
    pub l: u64,
    pub h: u64,
}
extern "C" {
    pub fn mdbx_env_info_ex(
        env: *const MDBX_env,
        txn: *const MDBX_txn,
        info: *mut MDBX_envinfo,
        bytes: usize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_info(
        env: *mut MDBX_env,
        info: *mut MDBX_envinfo,
        bytes: usize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_sync_ex(
        env: *mut MDBX_env,
        force: ::libc::c_int,
        nonblock: ::libc::c_int,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_sync(env: *mut MDBX_env) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_sync_poll(env: *mut MDBX_env) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_syncbytes(env: *mut MDBX_env, threshold: usize) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_syncperiod(
        env: *mut MDBX_env,
        seconds_16dot16: ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_close_ex(env: *mut MDBX_env, dont_sync: ::libc::c_int) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_close(env: *mut MDBX_env) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_flags(
        env: *mut MDBX_env,
        flags: ::libc::c_uint,
        onoff: ::libc::c_int,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_flags(env: *mut MDBX_env, flags: *mut ::libc::c_uint) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_path(env: *mut MDBX_env, dest: *mut *const ::libc::c_char)
        -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_fd(env: *mut MDBX_env, fd: *mut mdbx_filehandle_t) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_geometry(
        env: *mut MDBX_env,
        size_lower: isize,
        size_now: isize,
        size_upper: isize,
        growth_step: isize,
        shrink_threshold: isize,
        pagesize: isize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_mapsize(env: *mut MDBX_env, size: usize) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_is_readahead_reasonable(volume: usize, redundancy: isize) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_limits_dbsize_min(pagesize: isize) -> isize;
}
extern "C" {
    pub fn mdbx_limits_dbsize_max(pagesize: isize) -> isize;
}
extern "C" {
    pub fn mdbx_limits_keysize_max(pagesize: isize, flags: ::libc::c_uint) -> isize;
}
extern "C" {
    pub fn mdbx_limits_valsize_max(pagesize: isize, flags: ::libc::c_uint) -> isize;
}
extern "C" {
    pub fn mdbx_limits_txnsize_max(pagesize: isize) -> isize;
}
extern "C" {
    pub fn mdbx_env_set_maxreaders(env: *mut MDBX_env, readers: ::libc::c_uint) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_maxreaders(
        env: *mut MDBX_env,
        readers: *mut ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_maxdbs(env: *mut MDBX_env, dbs: MDBX_dbi) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_maxkeysize_ex(env: *mut MDBX_env, flags: ::libc::c_uint) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_maxvalsize_ex(env: *mut MDBX_env, flags: ::libc::c_uint) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_maxkeysize(env: *mut MDBX_env) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_set_userctx(env: *mut MDBX_env, ctx: *mut ::libc::c_void) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_userctx(env: *mut MDBX_env) -> *mut ::libc::c_void;
}
extern "C" {
    pub fn mdbx_txn_begin(
        env: *mut MDBX_env,
        parent: *mut MDBX_txn,
        flags: ::libc::c_uint,
        txn: *mut *mut MDBX_txn,
    ) -> ::libc::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MDBX_txn_info {
    pub txn_id: u64,
    pub txn_reader_lag: u64,
    pub txn_space_used: u64,
    pub txn_space_limit_soft: u64,
    pub txn_space_limit_hard: u64,
    pub txn_space_retired: u64,
    pub txn_space_leftover: u64,
    pub txn_space_dirty: u64,
}
extern "C" {
    pub fn mdbx_txn_info(
        txn: *mut MDBX_txn,
        info: *mut MDBX_txn_info,
        scan_rlt: ::libc::c_int,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_txn_env(txn: *mut MDBX_txn) -> *mut MDBX_env;
}
extern "C" {
    pub fn mdbx_txn_flags(txn: *mut MDBX_txn) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_txn_id(txn: *mut MDBX_txn) -> u64;
}
extern "C" {
    pub fn mdbx_txn_commit(txn: *mut MDBX_txn) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_txn_abort(txn: *mut MDBX_txn) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_txn_reset(txn: *mut MDBX_txn) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_txn_renew(txn: *mut MDBX_txn) -> ::libc::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mdbx_canary {
    pub x: u64,
    pub y: u64,
    pub z: u64,
    pub v: u64,
}
extern "C" {
    pub fn mdbx_canary_put(txn: *mut MDBX_txn, canary: *const mdbx_canary) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_canary_get(txn: *mut MDBX_txn, canary: *mut mdbx_canary) -> ::libc::c_int;
}
pub type MDBX_cmp_func = ::std::option::Option<
    unsafe extern "C" fn(a: *const MDBX_val, b: *const MDBX_val) -> ::libc::c_int,
>;
extern "C" {
    pub fn mdbx_dbi_open_ex(
        txn: *mut MDBX_txn,
        name: *const ::libc::c_char,
        flags: ::libc::c_uint,
        dbi: *mut MDBX_dbi,
        keycmp: MDBX_cmp_func,
        datacmp: MDBX_cmp_func,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dbi_open(
        txn: *mut MDBX_txn,
        name: *const ::libc::c_char,
        flags: ::libc::c_uint,
        dbi: *mut MDBX_dbi,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_key_from_jsonInteger(json_integer: i64) -> u64;
}
extern "C" {
    pub fn mdbx_key_from_double(ieee754_64bit: f64) -> u64;
}
extern "C" {
    pub fn mdbx_key_from_ptrdouble(ieee754_64bit: *const f64) -> u64;
}
extern "C" {
    pub fn mdbx_key_from_float(ieee754_32bit: f32) -> u32;
}
extern "C" {
    pub fn mdbx_key_from_ptrfloat(ieee754_32bit: *const f32) -> u32;
}
extern "C" {
    pub fn mdbx_dbi_stat(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        stat: *mut MDBX_stat,
        bytes: usize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dbi_flags_ex(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        flags: *mut ::libc::c_uint,
        state: *mut ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dbi_flags(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        flags: *mut ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dbi_close(env: *mut MDBX_env, dbi: MDBX_dbi) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_drop(txn: *mut MDBX_txn, dbi: MDBX_dbi, del: ::libc::c_int) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_get(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_get_ex(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
        values_count: *mut usize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_get_nearest(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_put(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
        flags: ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_replace(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        key: *mut MDBX_val,
        new_data: *mut MDBX_val,
        old_data: *mut MDBX_val,
        flags: ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_del(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_open(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        cursor: *mut *mut MDBX_cursor,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_close(cursor: *mut MDBX_cursor);
}
extern "C" {
    pub fn mdbx_cursor_renew(txn: *mut MDBX_txn, cursor: *mut MDBX_cursor) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_txn(cursor: *mut MDBX_cursor) -> *mut MDBX_txn;
}
extern "C" {
    pub fn mdbx_cursor_dbi(cursor: *mut MDBX_cursor) -> MDBX_dbi;
}
extern "C" {
    pub fn mdbx_cursor_get(
        cursor: *mut MDBX_cursor,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
        op: MDBX_cursor_op,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_put(
        cursor: *mut MDBX_cursor,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
        flags: ::libc::c_uint,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_del(cursor: *mut MDBX_cursor, flags: ::libc::c_uint) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_count(cursor: *mut MDBX_cursor, countp: *mut usize) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_eof(mc: *mut MDBX_cursor) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_on_first(mc: *mut MDBX_cursor) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cursor_on_last(mc: *mut MDBX_cursor) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_estimate_distance(
        first: *const MDBX_cursor,
        last: *const MDBX_cursor,
        distance_items: *mut isize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_estimate_move(
        cursor: *const MDBX_cursor,
        key: *mut MDBX_val,
        data: *mut MDBX_val,
        move_op: MDBX_cursor_op,
        distance_items: *mut isize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_estimate_range(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        begin_key: *mut MDBX_val,
        begin_data: *mut MDBX_val,
        end_key: *mut MDBX_val,
        end_data: *mut MDBX_val,
        size_items: *mut isize,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_is_dirty(txn: *const MDBX_txn, ptr: *const ::libc::c_void) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dbi_sequence(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        result: *mut u64,
        increment: u64,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_cmp(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        a: *const MDBX_val,
        b: *const MDBX_val,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_dcmp(
        txn: *mut MDBX_txn,
        dbi: MDBX_dbi,
        a: *const MDBX_val,
        b: *const MDBX_val,
    ) -> ::libc::c_int;
}
pub type MDBX_reader_list_func = ::std::option::Option<
    unsafe extern "C" fn(
        ctx: *mut ::libc::c_void,
        num: ::libc::c_int,
        slot: ::libc::c_int,
        pid: mdbx_pid_t,
        thread: mdbx_tid_t,
        txnid: u64,
        lag: u64,
        bytes_used: usize,
        bytes_retained: usize,
    ) -> ::libc::c_int,
>;
extern "C" {
    pub fn mdbx_reader_list(
        env: *mut MDBX_env,
        func: MDBX_reader_list_func,
        ctx: *mut ::libc::c_void,
    ) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_reader_check(env: *mut MDBX_env, dead: *mut ::libc::c_int) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_txn_straggler(txn: *mut MDBX_txn, percent: *mut ::libc::c_int) -> ::libc::c_int;
}
pub type MDBX_oom_func = ::std::option::Option<
    unsafe extern "C" fn(
        env: *mut MDBX_env,
        pid: mdbx_pid_t,
        tid: mdbx_tid_t,
        txn: u64,
        gap: ::libc::c_uint,
        space: usize,
        retry: ::libc::c_int,
    ) -> ::libc::c_int,
>;
extern "C" {
    pub fn mdbx_env_set_oomfunc(env: *mut MDBX_env, oom_func: MDBX_oom_func) -> ::libc::c_int;
}
extern "C" {
    pub fn mdbx_env_get_oomfunc(env: *mut MDBX_env) -> MDBX_oom_func;
}
#[repr(u32)]
#[doc = " B-tree Traversal *********************************************************"]
#[doc = " This is internal API for mdbx_chk tool. You should avoid to use it, except"]
#[doc = " some extremal special cases."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum MDBX_page_type_t {
    MDBX_page_void = 0,
    MDBX_page_meta = 1,
    MDBX_page_large = 2,
    MDBX_page_branch = 3,
    MDBX_page_leaf = 4,
    MDBX_page_dupfixed_leaf = 5,
    MDBX_subpage_leaf = 6,
    MDBX_subpage_dupfixed_leaf = 7,
}
pub type MDBX_pgvisitor_func = ::std::option::Option<
    unsafe extern "C" fn(
        pgno: u64,
        number: ::libc::c_uint,
        ctx: *mut ::libc::c_void,
        deep: ::libc::c_int,
        dbi: *const ::libc::c_char,
        page_size: usize,
        type_: MDBX_page_type_t,
        nentries: usize,
        payload_bytes: usize,
        header_bytes: usize,
        unused_bytes: usize,
    ) -> ::libc::c_int,
>;
extern "C" {
    pub fn mdbx_env_pgwalk(
        txn: *mut MDBX_txn,
        visitor: MDBX_pgvisitor_func,
        ctx: *mut ::libc::c_void,
    ) -> ::libc::c_int;
}
pub type __builtin_va_list = [__va_list_tag; 1usize];
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __va_list_tag {
    pub gp_offset: ::libc::c_uint,
    pub fp_offset: ::libc::c_uint,
    pub overflow_arg_area: *mut ::libc::c_void,
    pub reg_save_area: *mut ::libc::c_void,
}