File indexing completed on 2025-01-17 09:55:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef _DB_H_
0021 #define _DB_H_
0022
0023 #ifndef __NO_SYSTEM_INCLUDES
0024 #include <sys/types.h>
0025 #include <inttypes.h>
0026 #include <stdint.h>
0027 #include <stddef.h>
0028 #include <stdio.h>
0029 #include <unistd.h>
0030 #include <pthread.h>
0031 #endif
0032
0033
0034 #if defined(__cplusplus)
0035 extern "C" {
0036 #endif
0037
0038
0039 #undef __P
0040 #define __P(protos) protos
0041
0042
0043
0044
0045 #define DB_VERSION_MAJOR 18
0046 #define DB_VERSION_MINOR 1
0047 #define DB_VERSION_PATCH 40
0048 #define DB_VERSION_STRING "Berkeley DB 18.1.40: (May 29, 2020)"
0049 #define DB_VERSION_FULL_STRING "Berkeley DB Release 18.1, library version 18.1.40: (May 29, 2020)"
0050
0051
0052
0053
0054
0055 #define DB_VERSION_FAMILY 18
0056 #define DB_VERSION_RELEASE 1
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071 #ifndef __BIT_TYPES_DEFINED__
0072 #define __BIT_TYPES_DEFINED__
0073
0074
0075
0076
0077
0078
0079
0080 #endif
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110 typedef long db_off_t;
0111 #define DB_OFF_T_MAX INT64_MAX
0112
0113
0114 #ifdef HAVE_MIXED_SIZE_ADDRESSING
0115 typedef u_int32_t db_size_t;
0116 #else
0117 typedef size_t db_size_t;
0118 #endif
0119
0120 #ifdef HAVE_MIXED_SIZE_ADDRESSING
0121 typedef int32_t db_ssize_t;
0122 #else
0123 typedef ssize_t db_ssize_t;
0124 #endif
0125
0126
0127
0128
0129
0130 typedef long db_seq_t;
0131
0132
0133 typedef pthread_t db_threadid_t;
0134
0135
0136 typedef u_int32_t db_pgno_t;
0137 typedef u_int16_t db_indx_t;
0138 #define DB_MAX_PAGES 0xffffffff
0139
0140 typedef u_int32_t db_recno_t;
0141 #define DB_MAX_RECORDS 0xffffffff
0142
0143 typedef u_int32_t db_timeout_t;
0144
0145
0146
0147
0148
0149
0150
0151
0152 typedef db_size_t roff_t;
0153
0154
0155
0156
0157
0158 struct __channel; typedef struct __channel CHANNEL;
0159 struct __db; typedef struct __db DB;
0160 struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT;
0161 struct __db_channel; typedef struct __db_channel DB_CHANNEL;
0162 struct __db_cipher; typedef struct __db_cipher DB_CIPHER;
0163 struct __db_compact; typedef struct __db_compact DB_COMPACT;
0164 struct __db_dbt; typedef struct __db_dbt DBT;
0165 struct __db_distab; typedef struct __db_distab DB_DISTAB;
0166 struct __db_env; typedef struct __db_env DB_ENV;
0167 struct __db_event_mutex_died_info;
0168 typedef struct __db_event_mutex_died_info DB_EVENT_MUTEX_DIED_INFO;
0169 struct __db_event_failchk_info;
0170 typedef struct __db_event_failchk_info DB_EVENT_FAILCHK_INFO;
0171 struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT;
0172 struct __db_heap_rid; typedef struct __db_heap_rid DB_HEAP_RID;
0173 struct __db_heap_stat; typedef struct __db_heap_stat DB_HEAP_STAT;
0174 struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK;
0175 struct __db_lock_hstat; typedef struct __db_lock_hstat DB_LOCK_HSTAT;
0176 struct __db_lock_pstat; typedef struct __db_lock_pstat DB_LOCK_PSTAT;
0177 struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT;
0178 struct __db_lock_u; typedef struct __db_lock_u DB_LOCK;
0179 struct __db_locker; typedef struct __db_locker DB_LOCKER;
0180 struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ;
0181 struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB;
0182 struct __db_log; typedef struct __db_log DB_LOG;
0183 struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC;
0184 struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT;
0185 struct __db_lsn; typedef struct __db_lsn DB_LSN;
0186 struct __db_mpool; typedef struct __db_mpool DB_MPOOL;
0187 struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT;
0188 struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT;
0189 struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE;
0190 struct __db_mutex_stat; typedef struct __db_mutex_stat DB_MUTEX_STAT;
0191 struct __db_mutex_t; typedef struct __db_mutex_t DB_MUTEX;
0192 struct __db_mutexmgr; typedef struct __db_mutexmgr DB_MUTEXMGR;
0193 struct __db_preplist; typedef struct __db_preplist DB_PREPLIST;
0194 struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT;
0195 struct __db_rep; typedef struct __db_rep DB_REP;
0196 struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT;
0197 struct __db_repmgr_conn_err;
0198 typedef struct __db_repmgr_conn_err DB_REPMGR_CONN_ERR;
0199 struct __db_repmgr_site;typedef struct __db_repmgr_site DB_REPMGR_SITE;
0200 struct __db_repmgr_stat;typedef struct __db_repmgr_stat DB_REPMGR_STAT;
0201 struct __db_seq_record; typedef struct __db_seq_record DB_SEQ_RECORD;
0202 struct __db_seq_stat; typedef struct __db_seq_stat DB_SEQUENCE_STAT;
0203 struct __db_stream; typedef struct __db_stream DB_STREAM;
0204 struct __db_site; typedef struct __db_site DB_SITE;
0205 struct __db_sequence; typedef struct __db_sequence DB_SEQUENCE;
0206 struct __db_thread_info;typedef struct __db_thread_info DB_THREAD_INFO;
0207 struct __db_txn; typedef struct __db_txn DB_TXN;
0208 struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE;
0209 struct __db_txn_active_slice;
0210 typedef struct __db_txn_active_slice DB_TXN_ACTIVE_SLICE;
0211 struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT;
0212 struct __db_txn_token; typedef struct __db_txn_token DB_TXN_TOKEN;
0213 struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR;
0214 struct __dbc; typedef struct __dbc DBC;
0215 struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL;
0216 struct __env; typedef struct __env ENV;
0217 struct __fh_t; typedef struct __fh_t DB_FH;
0218 struct __fname; typedef struct __fname FNAME;
0219 struct __key_range; typedef struct __key_range DB_KEY_RANGE;
0220 struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE;
0221 struct __db_logvrfy_config;
0222 typedef struct __db_logvrfy_config DB_LOG_VERIFY_CONFIG;
0223
0224
0225
0226
0227
0228 #define DB_DEGREE_2 DB_READ_COMMITTED
0229 #define DB_DIRTY_READ DB_READ_UNCOMMITTED
0230 #define DB_JOINENV 0x0
0231
0232
0233 struct __db_dbt {
0234 void *data;
0235 u_int32_t size;
0236
0237 u_int32_t ulen;
0238 u_int32_t dlen;
0239 u_int32_t doff;
0240
0241 void *app_data;
0242
0243 #define DB_DBT_APPMALLOC 0x0001
0244 #define DB_DBT_BULK 0x0002
0245 #define DB_DBT_DUPOK 0x0004
0246 #define DB_DBT_ISSET 0x0008
0247 #define DB_DBT_MALLOC 0x0010
0248 #define DB_DBT_MULTIPLE 0x0020
0249 #define DB_DBT_PARTIAL 0x0040
0250 #define DB_DBT_REALLOC 0x0080
0251 #define DB_DBT_READONLY 0x0100
0252 #define DB_DBT_STREAMING 0x0200
0253 #define DB_DBT_USERCOPY 0x0400
0254 #define DB_DBT_USERMEM 0x0800
0255 #define DB_DBT_BLOB 0x1000
0256 #define DB_DBT_EXT_FILE 0x1000
0257 #define DB_DBT_BLOB_REC 0x2000
0258 u_int32_t flags;
0259 };
0260
0261
0262
0263
0264
0265
0266
0267
0268 #ifdef HAVE_MIXED_SIZE_ADDRESSING
0269 typedef db_size_t db_mutex_t;
0270 #else
0271 typedef uintptr_t db_mutex_t;
0272 #endif
0273
0274 struct __db_mutex_stat {
0275
0276 u_int32_t st_mutex_align;
0277 u_int32_t st_mutex_tas_spins;
0278 u_int32_t st_mutex_init;
0279 u_int32_t st_mutex_cnt;
0280 u_int32_t st_mutex_max;
0281 u_int32_t st_mutex_free;
0282 u_int32_t st_mutex_inuse;
0283 u_int32_t st_mutex_inuse_max;
0284
0285
0286 #ifndef __TEST_DB_NO_STATISTICS
0287 uintmax_t st_region_wait;
0288 uintmax_t st_region_nowait;
0289 roff_t st_regsize;
0290 roff_t st_regmax;
0291 #endif
0292 };
0293
0294
0295 #define DB_MUTEX_DESCRIBE_STRLEN 128
0296
0297
0298 struct __db_event_mutex_died_info {
0299 pid_t pid;
0300 db_threadid_t tid;
0301 db_mutex_t mutex;
0302 char desc[DB_MUTEX_DESCRIBE_STRLEN];
0303 };
0304
0305
0306 #define DB_FAILURE_SYMPTOM_SIZE 120
0307 struct __db_event_failchk_info {
0308 int error;
0309 char symptom[DB_FAILURE_SYMPTOM_SIZE];
0310 };
0311
0312 #define DB_THREADID_STRLEN 128
0313
0314
0315
0316
0317
0318 typedef u_int32_t db_slice_t;
0319
0320
0321
0322
0323 #define DB_LOCKVERSION 1
0324
0325 #define DB_FILE_ID_LEN 20
0326
0327
0328
0329
0330
0331 #define DB_LOCK_NORUN 0
0332 #define DB_LOCK_DEFAULT 1
0333 #define DB_LOCK_EXPIRE 2
0334 #define DB_LOCK_MAXLOCKS 3
0335 #define DB_LOCK_MAXWRITE 4
0336 #define DB_LOCK_MINLOCKS 5
0337 #define DB_LOCK_MINWRITE 6
0338 #define DB_LOCK_OLDEST 7
0339 #define DB_LOCK_RANDOM 8
0340 #define DB_LOCK_YOUNGEST 9
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350 typedef enum {
0351 DB_LOCK_NG=0,
0352 DB_LOCK_READ=1,
0353 DB_LOCK_WRITE=2,
0354 DB_LOCK_WAIT=3,
0355 DB_LOCK_IWRITE=4,
0356 DB_LOCK_IREAD=5,
0357 DB_LOCK_IWR=6,
0358 DB_LOCK_READ_UNCOMMITTED=7,
0359 DB_LOCK_WWRITE=8
0360 } db_lockmode_t;
0361
0362
0363
0364
0365 typedef enum {
0366 DB_LOCK_DUMP=0,
0367 DB_LOCK_GET=1,
0368 DB_LOCK_GET_TIMEOUT=2,
0369 DB_LOCK_INHERIT=3,
0370 DB_LOCK_PUT=4,
0371 DB_LOCK_PUT_ALL=5,
0372 DB_LOCK_PUT_OBJ=6,
0373 DB_LOCK_PUT_READ=7,
0374 DB_LOCK_TIMEOUT=8,
0375 DB_LOCK_TRADE=9,
0376 DB_LOCK_UPGRADE_WRITE=10
0377 } db_lockop_t;
0378
0379
0380
0381
0382 typedef enum {
0383 DB_LSTAT_ABORTED=1,
0384 DB_LSTAT_EXPIRED=2,
0385 DB_LSTAT_FREE=3,
0386 DB_LSTAT_HELD=4,
0387 DB_LSTAT_PENDING=5,
0388
0389
0390 DB_LSTAT_WAITING=6
0391 }db_status_t;
0392
0393
0394 struct __db_lock_stat {
0395 u_int32_t st_id;
0396 u_int32_t st_cur_maxid;
0397 u_int32_t st_initlocks;
0398 u_int32_t st_initlockers;
0399 u_int32_t st_initobjects;
0400 u_int32_t st_locks;
0401 u_int32_t st_lockers;
0402 u_int32_t st_objects;
0403 u_int32_t st_maxlocks;
0404 u_int32_t st_maxlockers;
0405 u_int32_t st_maxobjects;
0406 u_int32_t st_partitions;
0407 u_int32_t st_tablesize;
0408 int32_t st_nmodes;
0409 u_int32_t st_nlockers;
0410 #ifndef __TEST_DB_NO_STATISTICS
0411 u_int32_t st_nlocks;
0412 u_int32_t st_maxnlocks;
0413 u_int32_t st_maxhlocks;
0414 uintmax_t st_locksteals;
0415 uintmax_t st_maxlsteals;
0416 u_int32_t st_maxnlockers;
0417 u_int32_t st_nobjects;
0418 u_int32_t st_maxnobjects;
0419 u_int32_t st_maxhobjects;
0420 uintmax_t st_objectsteals;
0421 uintmax_t st_maxosteals;
0422 uintmax_t st_nrequests;
0423 uintmax_t st_nreleases;
0424 uintmax_t st_nupgrade;
0425 uintmax_t st_ndowngrade;
0426 uintmax_t st_lock_wait;
0427 uintmax_t st_lock_nowait;
0428 uintmax_t st_ndeadlocks;
0429 db_timeout_t st_locktimeout;
0430 uintmax_t st_nlocktimeouts;
0431 db_timeout_t st_txntimeout;
0432 uintmax_t st_ntxntimeouts;
0433 uintmax_t st_part_wait;
0434 uintmax_t st_part_nowait;
0435 uintmax_t st_part_max_wait;
0436 uintmax_t st_part_max_nowait;
0437 uintmax_t st_objs_wait;
0438 uintmax_t st_objs_nowait;
0439 uintmax_t st_lockers_wait;
0440 uintmax_t st_lockers_nowait;
0441 uintmax_t st_region_wait;
0442 uintmax_t st_region_nowait;
0443 uintmax_t st_nlockers_hit;
0444 uintmax_t st_nlockers_reused;
0445 u_int32_t st_hash_len;
0446 roff_t st_regsize;
0447 #endif
0448 };
0449
0450 struct __db_lock_hstat {
0451 uintmax_t st_nrequests;
0452 uintmax_t st_nreleases;
0453 uintmax_t st_nupgrade;
0454 uintmax_t st_ndowngrade;
0455 u_int32_t st_nlocks;
0456 u_int32_t st_maxnlocks;
0457 u_int32_t st_nobjects;
0458 u_int32_t st_maxnobjects;
0459 uintmax_t st_lock_wait;
0460 uintmax_t st_lock_nowait;
0461 uintmax_t st_nlocktimeouts;
0462 uintmax_t st_ntxntimeouts;
0463 u_int32_t st_hash_len;
0464 };
0465
0466 struct __db_lock_pstat {
0467 u_int32_t st_nlocks;
0468 u_int32_t st_maxnlocks;
0469 u_int32_t st_nobjects;
0470 u_int32_t st_maxnobjects;
0471 uintmax_t st_locksteals;
0472 uintmax_t st_objectsteals;
0473 };
0474
0475
0476
0477
0478
0479 struct __db_ilock {
0480 db_pgno_t pgno;
0481 u_int8_t fileid[DB_FILE_ID_LEN];
0482 #define DB_HANDLE_LOCK 1
0483 #define DB_RECORD_LOCK 2
0484 #define DB_PAGE_LOCK 3
0485 #define DB_DATABASE_LOCK 4
0486 u_int32_t type;
0487 };
0488
0489
0490
0491
0492
0493
0494 struct __db_lock_u {
0495 roff_t off;
0496 u_int32_t ndx;
0497
0498 u_int32_t gen;
0499 db_lockmode_t mode;
0500 };
0501
0502
0503 struct __db_lockreq {
0504 db_lockop_t op;
0505 db_lockmode_t mode;
0506 db_timeout_t timeout;
0507 DBT *obj;
0508 DB_LOCK lock;
0509 };
0510
0511
0512
0513
0514 #define DB_LOGVERSION 23
0515 #define DB_LOGVERSION_LATCHING 15
0516 #define DB_LOGCHKSUM 12
0517 #define DB_LOGOLDVER 8
0518 #define DB_LOGMAGIC 0x040988
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529 struct __db_lsn {
0530 u_int32_t file;
0531 u_int32_t offset;
0532 };
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543 #define DB_user_BEGIN 10000
0544 #define DB_debug_FLAG 0x80000000
0545
0546
0547
0548
0549
0550 struct __db_log_cursor {
0551 ENV *env;
0552
0553 DB_FH *fhp;
0554 DB_LSN lsn;
0555 u_int32_t len;
0556 u_int32_t prev;
0557
0558 DBT dbt;
0559 DB_LSN p_lsn;
0560 u_int32_t p_version;
0561
0562 u_int8_t *bp;
0563 u_int32_t bp_size;
0564 u_int32_t bp_rlen;
0565 DB_LSN bp_lsn;
0566
0567 u_int32_t bp_maxrec;
0568
0569
0570 int (*close) __P((DB_LOGC *, u_int32_t));
0571 int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, u_int32_t));
0572 int (*version) __P((DB_LOGC *, u_int32_t *, u_int32_t));
0573
0574
0575 #define DB_LOG_DISK 0x01
0576 #define DB_LOG_LOCKED 0x02
0577 #define DB_LOG_SILENT_ERR 0x04
0578 u_int32_t flags;
0579 };
0580
0581
0582 struct __db_log_stat {
0583 u_int32_t st_magic;
0584 u_int32_t st_version;
0585 int32_t st_mode;
0586 u_int32_t st_lg_bsize;
0587 u_int32_t st_lg_size;
0588 u_int32_t st_wc_bytes;
0589 u_int32_t st_wc_mbytes;
0590 u_int32_t st_fileid_init;
0591 #ifndef __TEST_DB_NO_STATISTICS
0592 u_int32_t st_nfileid;
0593 u_int32_t st_maxnfileid;
0594 uintmax_t st_record;
0595 u_int32_t st_w_bytes;
0596 u_int32_t st_w_mbytes;
0597 uintmax_t st_wcount;
0598 uintmax_t st_wcount_fill;
0599 uintmax_t st_rcount;
0600 uintmax_t st_scount;
0601 uintmax_t st_region_wait;
0602 uintmax_t st_region_nowait;
0603 u_int32_t st_cur_file;
0604 u_int32_t st_cur_offset;
0605 u_int32_t st_disk_file;
0606 u_int32_t st_disk_offset;
0607 u_int32_t st_maxcommitperflush;
0608 u_int32_t st_mincommitperflush;
0609 roff_t st_regsize;
0610 #endif
0611 };
0612
0613
0614
0615
0616
0617
0618
0619
0620 #define DB_SET_TXN_LSNP(txn, blsnp, llsnp) \
0621 ((txn)->set_txn_lsnp(txn, blsnp, llsnp))
0622
0623
0624
0625
0626 typedef enum {
0627 LOGREC_Done,
0628 LOGREC_ARG,
0629 LOGREC_HDR,
0630 LOGREC_DATA,
0631 LOGREC_DB,
0632 LOGREC_DBOP,
0633 LOGREC_DBT,
0634 LOGREC_LOCKS,
0635 LOGREC_OP,
0636 LOGREC_PGDBT,
0637 LOGREC_PGDDBT,
0638 LOGREC_PGLIST,
0639 LOGREC_POINTER,
0640 LOGREC_TIME,
0641 LOGREC_LONGARG
0642 } log_rec_type_t;
0643
0644 typedef const struct __log_rec_spec {
0645 log_rec_type_t type;
0646 u_int32_t offset;
0647 const char *name;
0648 const char fmt[4];
0649 } DB_LOG_RECSPEC;
0650
0651
0652
0653
0654 #define LOG_DBT_SIZE(dbt) \
0655 (sizeof(u_int32_t) + ((dbt) == NULL ? 0 : (dbt)->size))
0656
0657
0658
0659
0660
0661 typedef enum {
0662 DB_PRIORITY_UNCHANGED=0,
0663 DB_PRIORITY_VERY_LOW=1,
0664 DB_PRIORITY_LOW=2,
0665 DB_PRIORITY_DEFAULT=3,
0666 DB_PRIORITY_HIGH=4,
0667 DB_PRIORITY_VERY_HIGH=5
0668 } DB_CACHE_PRIORITY;
0669
0670
0671 struct __db_mpoolfile {
0672 DB_FH *fhp;
0673
0674
0675
0676
0677
0678 u_int32_t ref;
0679
0680 u_int32_t pinref;
0681
0682
0683
0684
0685
0686
0687 struct {
0688 struct __db_mpoolfile *tqe_next;
0689 struct __db_mpoolfile **tqe_prev;
0690 } q;
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702 ENV *env;
0703 MPOOLFILE *mfp;
0704
0705 u_int32_t clear_len;
0706 u_int8_t
0707 fileid[DB_FILE_ID_LEN];
0708 int ftype;
0709 int32_t lsn_offset;
0710 u_int32_t gbytes, bytes;
0711 DBT *pgcookie;
0712 int32_t priority;
0713
0714 void *addr;
0715 size_t len;
0716
0717 u_int32_t config_flags;
0718
0719
0720 int (*close) __P((DB_MPOOLFILE *, u_int32_t));
0721 int (*get)
0722 __P((DB_MPOOLFILE *, db_pgno_t *, DB_TXN *, u_int32_t, void *));
0723 int (*get_clear_len) __P((DB_MPOOLFILE *, u_int32_t *));
0724 int (*get_fileid) __P((DB_MPOOLFILE *, u_int8_t *));
0725 int (*get_flags) __P((DB_MPOOLFILE *, u_int32_t *));
0726 int (*get_ftype) __P((DB_MPOOLFILE *, int *));
0727 int (*get_last_pgno) __P((DB_MPOOLFILE *, db_pgno_t *));
0728 int (*get_lsn_offset) __P((DB_MPOOLFILE *, int32_t *));
0729 int (*get_maxsize) __P((DB_MPOOLFILE *, u_int32_t *, u_int32_t *));
0730 int (*get_pgcookie) __P((DB_MPOOLFILE *, DBT *));
0731 int (*get_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY *));
0732 int (*open) __P((DB_MPOOLFILE *, const char *, u_int32_t, int, size_t));
0733 int (*put) __P((DB_MPOOLFILE *, void *, DB_CACHE_PRIORITY, u_int32_t));
0734 int (*set_clear_len) __P((DB_MPOOLFILE *, u_int32_t));
0735 int (*set_fileid) __P((DB_MPOOLFILE *, u_int8_t *));
0736 int (*set_flags) __P((DB_MPOOLFILE *, u_int32_t, int));
0737 int (*set_ftype) __P((DB_MPOOLFILE *, int));
0738 int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t));
0739 int (*set_maxsize) __P((DB_MPOOLFILE *, u_int32_t, u_int32_t));
0740 int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *));
0741 int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY));
0742 int (*sync) __P((DB_MPOOLFILE *));
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753 #define MP_FILEID_SET 0x001
0754 #define MP_FLUSH 0x002
0755 #define MP_FOR_FLUSH 0x004
0756 #define MP_MULTIVERSION 0x008
0757 #define MP_OPEN_CALLED 0x010
0758 #define MP_READONLY 0x020
0759 #define MP_DUMMY 0x040
0760 u_int32_t flags;
0761 };
0762
0763
0764 struct __db_mpool_stat {
0765 u_int32_t st_gbytes;
0766 u_int32_t st_bytes;
0767 u_int32_t st_ncache;
0768 u_int32_t st_max_ncache;
0769 db_size_t st_mmapsize;
0770 int32_t st_maxopenfd;
0771 int32_t st_maxwrite;
0772 db_timeout_t st_maxwrite_sleep;
0773 u_int32_t st_pages;
0774 #ifndef __TEST_DB_NO_STATISTICS
0775 u_int32_t st_map;
0776 uintmax_t st_cache_hit;
0777 uintmax_t st_cache_miss;
0778 uintmax_t st_page_create;
0779 uintmax_t st_page_in;
0780 uintmax_t st_page_out;
0781 uintmax_t st_ro_evict;
0782 uintmax_t st_rw_evict;
0783 uintmax_t st_page_trickle;
0784 u_int32_t st_page_clean;
0785 u_int32_t st_page_dirty;
0786 u_int32_t st_hash_buckets;
0787 u_int32_t st_hash_mutexes;
0788 u_int32_t st_pagesize;
0789 u_int32_t st_hash_searches;
0790 u_int32_t st_hash_longest;
0791 uintmax_t st_hash_examined;
0792 uintmax_t st_hash_nowait;
0793 uintmax_t st_hash_wait;
0794 uintmax_t st_hash_max_nowait;
0795 uintmax_t st_hash_max_wait;
0796 uintmax_t st_region_nowait;
0797 uintmax_t st_region_wait;
0798 uintmax_t st_mvcc_frozen;
0799 uintmax_t st_mvcc_thawed;
0800 uintmax_t st_mvcc_freed;
0801 uintmax_t st_mvcc_reused;
0802 uintmax_t st_alloc;
0803 uintmax_t st_alloc_buckets;
0804 uintmax_t st_alloc_max_buckets;
0805 uintmax_t st_alloc_pages;
0806 uintmax_t st_alloc_max_pages;
0807 uintmax_t st_io_wait;
0808 uintmax_t st_sync_interrupted;
0809 u_int32_t st_oddfsize_detect;
0810 u_int32_t st_oddfsize_resolve;
0811 roff_t st_regsize;
0812 roff_t st_regmax;
0813 #endif
0814 };
0815
0816
0817
0818
0819
0820
0821 struct __db_mpool_fstat {
0822 u_int32_t st_pagesize;
0823 #ifndef __TEST_DB_NO_STATISTICS
0824 u_int32_t st_map;
0825 uintmax_t st_cache_hit;
0826 uintmax_t st_cache_miss;
0827 uintmax_t st_page_create;
0828 uintmax_t st_page_in;
0829 uintmax_t st_page_out;
0830 uintmax_t st_backup_spins;
0831 #endif
0832 char *file_name;
0833 };
0834
0835
0836
0837
0838 #define DB_TXNVERSION 1
0839
0840 typedef enum {
0841 DB_TXN_ABORT=0,
0842 DB_TXN_APPLY=1,
0843 DB_TXN_BACKWARD_ROLL=3,
0844 DB_TXN_FORWARD_ROLL=4,
0845 DB_TXN_OPENFILES=5,
0846 DB_TXN_POPENFILES=6,
0847 DB_TXN_PRINT=7,
0848 DB_TXN_LOG_VERIFY=8
0849 } db_recops;
0850
0851
0852
0853
0854
0855
0856
0857 #define DB_UNDO(op) ((op) == DB_TXN_ABORT || (op) == DB_TXN_BACKWARD_ROLL)
0858 #define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY)
0859
0860 struct __db_txn {
0861 DB_TXNMGR *mgrp;
0862 DB_TXN *parent;
0863 DB_THREAD_INFO *thread_info;
0864
0865 u_int32_t cursors;
0866
0867 u_int32_t txnid;
0868 char *name;
0869 DB_LOCKER *locker;
0870
0871 void *td;
0872 db_timeout_t lock_timeout;
0873 void *txn_list;
0874
0875
0876
0877
0878
0879
0880
0881 DB_TXN **txn_slices;
0882 DB_TXN *txn_container;
0883
0884
0885
0886
0887
0888
0889 struct {
0890 struct __db_txn *tqe_next;
0891 struct __db_txn **tqe_prev;
0892 } links;
0893
0894
0895
0896
0897
0898
0899
0900
0901 struct {
0902 db_ssize_t stqe_next;
0903 db_ssize_t stqe_prev;
0904 } xa_links;
0905
0906
0907
0908
0909
0910
0911 struct __kids {
0912 struct __db_txn *tqh_first;
0913 struct __db_txn **tqh_last;
0914 } kids;
0915
0916
0917
0918
0919
0920
0921 struct {
0922 struct __txn_event *tqh_first;
0923 struct __txn_event **tqh_last;
0924 } events;
0925
0926
0927
0928
0929
0930
0931 struct {
0932 struct __txn_logrec *stqh_first;
0933 struct __txn_logrec **stqh_last;
0934 } logs;
0935
0936
0937
0938
0939
0940
0941 struct {
0942 struct __db_txn *tqe_next;
0943 struct __db_txn **tqe_prev;
0944 } klinks;
0945
0946
0947
0948
0949
0950
0951 struct __my_cursors {
0952 struct __dbc *tqh_first;
0953 struct __dbc **tqh_last;
0954 } my_cursors;
0955
0956
0957
0958
0959
0960
0961
0962
0963 struct __femfs {
0964 DB *tqh_first;
0965 DB **tqh_last;
0966 } femfs;
0967
0968 DB_TXN_TOKEN *token_buffer;
0969 void *api_internal;
0970 void *xml_internal;
0971
0972
0973 int (*abort) __P((DB_TXN *));
0974 int (*commit) __P((DB_TXN *, u_int32_t));
0975 int (*discard) __P((DB_TXN *, u_int32_t));
0976 int (*get_name) __P((DB_TXN *, const char **));
0977 int (*get_priority) __P((DB_TXN *, u_int32_t *));
0978 u_int32_t (*id) __P((DB_TXN *));
0979 int (*prepare) __P((DB_TXN *, u_int8_t *));
0980 int (*set_commit_token) __P((DB_TXN *, DB_TXN_TOKEN *));
0981 int (*set_name) __P((DB_TXN *, const char *));
0982 int (*set_priority) __P((DB_TXN *, u_int32_t));
0983 int (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t));
0984
0985
0986
0987 void (*set_txn_lsnp) __P((DB_TXN *txn, DB_LSN **, DB_LSN **));
0988
0989
0990 #define TXN_XA_THREAD_NOTA 0
0991 #define TXN_XA_THREAD_ASSOCIATED 1
0992 #define TXN_XA_THREAD_SUSPENDED 2
0993 #define TXN_XA_THREAD_UNASSOCIATED 3
0994 u_int32_t xa_thr_status;
0995
0996 #define TXN_CHILDCOMMIT 0x00001
0997 #define TXN_DISPATCH 0x00002
0998 #define TXN_DEADLOCK 0x00004
0999 #define TXN_FAMILY 0x00008
1000 #define TXN_IGNORE_LEASE 0x00010
1001 #define TXN_INFAMILY 0x00020
1002 #define TXN_LOCKTIMEOUT 0x00040
1003 #define TXN_MALLOC 0x00080
1004 #define TXN_NOSYNC 0x00100
1005 #define TXN_NOWAIT 0x00200
1006 #define TXN_PRIVATE 0x00400
1007 #define TXN_READONLY 0x00800
1008 #define TXN_READ_COMMITTED 0x01000
1009 #define TXN_READ_UNCOMMITTED 0x02000
1010 #define TXN_RESTORED 0x04000
1011 #define TXN_SNAPSHOT 0x08000
1012 #define TXN_SYNC 0x10000
1013 #define TXN_WRITE_NOSYNC 0x20000
1014 #define TXN_BULK 0x40000
1015 u_int32_t flags;
1016
1017 u_int32_t begin_flags;
1018 };
1019
1020 #define TXN_SYNC_FLAGS (TXN_SYNC | TXN_NOSYNC | TXN_WRITE_NOSYNC)
1021
1022
1023
1024
1025
1026
1027 #define DB_GID_SIZE 128
1028 struct __db_preplist {
1029 DB_TXN *txn;
1030 u_int8_t gid[DB_GID_SIZE];
1031 };
1032
1033
1034
1035
1036
1037
1038
1039
1040 struct __db_txn_active_slice {
1041 u_int32_t txnid;
1042 };
1043
1044
1045 struct __db_txn_active {
1046 u_int32_t txnid;
1047 u_int32_t parentid;
1048 pid_t pid;
1049 db_threadid_t tid;
1050
1051 DB_LSN lsn;
1052
1053 DB_LSN read_lsn;
1054 u_int32_t mvcc_ref;
1055
1056 u_int32_t priority;
1057
1058 #define TXN_ABORTED 1
1059 #define TXN_COMMITTED 2
1060 #define TXN_NEED_ABORT 3
1061 #define TXN_PREPARED 4
1062 #define TXN_RUNNING 5
1063 u_int32_t status;
1064
1065 #define TXN_XA_ACTIVE 1
1066 #define TXN_XA_DEADLOCKED 2
1067 #define TXN_XA_IDLE 3
1068 #define TXN_XA_PREPARED 4
1069 #define TXN_XA_ROLLEDBACK 5
1070 u_int32_t xa_status;
1071
1072 u_int8_t gid[DB_GID_SIZE];
1073 char name[51];
1074
1075
1076
1077
1078
1079
1080 DB_TXN_ACTIVE_SLICE *slice_txns;
1081 };
1082
1083 struct __db_txn_stat {
1084 u_int32_t st_nrestores;
1085
1086 #ifndef __TEST_DB_NO_STATISTICS
1087 DB_LSN st_last_ckp;
1088 time_t st_time_ckp;
1089 u_int32_t st_last_txnid;
1090 u_int32_t st_inittxns;
1091 u_int32_t st_maxtxns;
1092 uintmax_t st_naborts;
1093 uintmax_t st_nbegins;
1094 uintmax_t st_ncommits;
1095 u_int32_t st_nactive;
1096 u_int32_t st_nsnapshot;
1097 u_int32_t st_maxnactive;
1098 u_int32_t st_maxnsnapshot;
1099 uintmax_t st_region_wait;
1100 uintmax_t st_region_nowait;
1101 roff_t st_regsize;
1102 DB_TXN_ACTIVE *st_txnarray;
1103 #endif
1104 };
1105
1106 #define DB_TXN_TOKEN_SIZE 20
1107 struct __db_txn_token {
1108 u_int8_t buf[DB_TXN_TOKEN_SIZE];
1109 };
1110
1111
1112
1113
1114
1115 #define DB_EID_BROADCAST -1
1116 #define DB_EID_INVALID -2
1117 #define DB_EID_MASTER -3
1118
1119 #define DB_REP_DEFAULT_PRIORITY 100
1120
1121
1122 #define DB_REPMGR_ACKS_ALL 1
1123 #define DB_REPMGR_ACKS_ALL_AVAILABLE 2
1124 #define DB_REPMGR_ACKS_ALL_PEERS 3
1125 #define DB_REPMGR_ACKS_NONE 4
1126 #define DB_REPMGR_ACKS_ONE 5
1127 #define DB_REPMGR_ACKS_ONE_PEER 6
1128 #define DB_REPMGR_ACKS_QUORUM 7
1129
1130
1131 #define DB_REPMGR_SSL_CA_CERT 1
1132 #define DB_REPMGR_SSL_CA_DIR 2
1133 #define DB_REPMGR_SSL_REPNODE_CERT 3
1134 #define DB_REPMGR_SSL_REPNODE_PRIVATE_KEY 4
1135 #define DB_REPMGR_SSL_REPNODE_KEY_PASSWD 5
1136 #define DB_REPMGR_SSL_VERIFY_DEPTH 6
1137
1138
1139 #define DB_REP_ACK_TIMEOUT 1
1140 #define DB_REP_CHECKPOINT_DELAY 2
1141 #define DB_REP_CONNECTION_RETRY 3
1142 #define DB_REP_ELECTION_RETRY 4
1143 #define DB_REP_ELECTION_TIMEOUT 5
1144 #define DB_REP_FULL_ELECTION_TIMEOUT 6
1145 #define DB_REP_HEARTBEAT_MONITOR 7
1146 #define DB_REP_HEARTBEAT_SEND 8
1147 #define DB_REP_LEASE_TIMEOUT 9
1148 #define DB_REP_WRITE_FORWARD_TIMEOUT 10
1149
1150
1151
1152
1153
1154 #define DB_EVENT_PANIC 0
1155 #define DB_EVENT_REG_ALIVE 1
1156 #define DB_EVENT_REG_PANIC 2
1157 #define DB_EVENT_REP_AUTOTAKEOVER 3
1158 #define DB_EVENT_REP_AUTOTAKEOVER_FAILED 4
1159 #define DB_EVENT_REP_CLIENT 5
1160 #define DB_EVENT_REP_CONNECT_BROKEN 6
1161 #define DB_EVENT_REP_CONNECT_ESTD 7
1162 #define DB_EVENT_REP_CONNECT_TRY_FAILED 8
1163 #define DB_EVENT_REP_DUPMASTER 9
1164 #define DB_EVENT_REP_ELECTED 10
1165 #define DB_EVENT_REP_ELECTION_FAILED 11
1166 #define DB_EVENT_REP_INIT_DONE 12
1167 #define DB_EVENT_REP_INQUEUE_FULL 13
1168 #define DB_EVENT_REP_JOIN_FAILURE 14
1169 #define DB_EVENT_REP_LOCAL_SITE_REMOVED 15
1170 #define DB_EVENT_REP_MASTER 16
1171 #define DB_EVENT_REP_MASTER_FAILURE 17
1172 #define DB_EVENT_REP_NEWMASTER 18
1173 #define DB_EVENT_REP_PERM_FAILED 19
1174 #define DB_EVENT_REP_SITE_ADDED 20
1175 #define DB_EVENT_REP_SITE_REMOVED 21
1176 #define DB_EVENT_REP_STARTUPDONE 22
1177 #define DB_EVENT_REP_WOULD_ROLLBACK 23
1178 #define DB_EVENT_WRITE_FAILED 24
1179 #define DB_EVENT_MUTEX_DIED 25
1180 #define DB_EVENT_FAILCHK_PANIC 26
1181 #define DB_EVENT_NO_SUCH_EVENT 0xffffffff
1182
1183
1184 typedef enum {
1185 SELECT=1,
1186 POLL=2,
1187 EPOLL=3
1188 } poll_method_t;
1189
1190 #if defined(HAVE_EPOLL_CREATE) && defined(HAVE_EPOLL_CTL) && defined(HAVE_EPOLL_WAIT)
1191 #define HAVE_EPOLL 1
1192 #endif
1193
1194
1195 struct __db_repmgr_site {
1196 int eid;
1197 char *host;
1198 u_int port;
1199 DB_LSN max_ack_lsn;
1200
1201 #define DB_REPMGR_CONNECTED 1
1202 #define DB_REPMGR_DISCONNECTED 2
1203 u_int32_t status;
1204
1205 #define DB_REPMGR_ISELECTABLE 0x01
1206 #define DB_REPMGR_ISPEER 0x02
1207 #define DB_REPMGR_ISVIEW 0x04
1208 u_int32_t flags;
1209 };
1210
1211
1212 struct __db_rep_stat {
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222 u_int32_t st_startup_complete;
1223 u_int32_t st_view;
1224 #ifndef __TEST_DB_NO_STATISTICS
1225 uintmax_t st_log_queued;
1226 u_int32_t st_status;
1227 DB_LSN st_next_lsn;
1228 DB_LSN st_waiting_lsn;
1229 DB_LSN st_max_perm_lsn;
1230 db_pgno_t st_next_pg;
1231 db_pgno_t st_waiting_pg;
1232
1233 u_int32_t st_dupmasters;
1234
1235 db_ssize_t st_env_id;
1236 u_int32_t st_env_priority;
1237 uintmax_t st_ext_duplicated;
1238 uintmax_t st_ext_records;
1239 uintmax_t st_ext_rereq;
1240 uintmax_t st_ext_update_rereq;
1241 uintmax_t st_bulk_fills;
1242 uintmax_t st_bulk_overflows;
1243 uintmax_t st_bulk_records;
1244 uintmax_t st_bulk_transfers;
1245 uintmax_t st_client_rerequests;
1246 uintmax_t st_client_svc_req;
1247
1248 uintmax_t st_client_svc_miss;
1249
1250 u_int32_t st_gen;
1251 u_int32_t st_egen;
1252 uintmax_t st_lease_chk;
1253 uintmax_t st_lease_chk_misses;
1254 uintmax_t st_lease_chk_refresh;
1255 uintmax_t st_lease_sends;
1256
1257 uintmax_t st_log_duplicated;
1258 uintmax_t st_log_queued_max;
1259 uintmax_t st_log_queued_total;
1260 uintmax_t st_log_records;
1261 uintmax_t st_log_requested;
1262 db_ssize_t st_master;
1263 uintmax_t st_master_changes;
1264 uintmax_t st_msgs_badgen;
1265 uintmax_t st_msgs_processed;
1266 uintmax_t st_msgs_recover;
1267
1268 uintmax_t st_msgs_send_failures;
1269 uintmax_t st_msgs_sent;
1270 uintmax_t st_newsites;
1271 u_int32_t st_nsites;
1272
1273 uintmax_t st_nthrottles;
1274 uintmax_t st_outdated;
1275
1276 uintmax_t st_pg_duplicated;
1277 uintmax_t st_pg_records;
1278 uintmax_t st_pg_requested;
1279 uintmax_t st_txns_applied;
1280 uintmax_t st_startsync_delayed;
1281
1282
1283 uintmax_t st_elections;
1284 uintmax_t st_elections_won;
1285
1286
1287 db_ssize_t st_election_cur_winner;
1288 u_int32_t st_election_gen;
1289 u_int32_t st_election_datagen;
1290 DB_LSN st_election_lsn;
1291 u_int32_t st_election_nsites;
1292 u_int32_t st_election_nvotes;
1293 u_int32_t st_election_priority;
1294 int32_t st_election_status;
1295 u_int32_t st_election_tiebreaker;
1296 u_int32_t st_election_votes;
1297 u_int32_t st_election_sec;
1298 u_int32_t st_election_usec;
1299 u_int32_t st_max_lease_sec;
1300 u_int32_t st_max_lease_usec;
1301
1302
1303 #ifdef CONFIG_TEST
1304 uintmax_t st_ext_deleted;
1305 uintmax_t st_ext_truncated;
1306 u_int32_t st_filefail_cleanups;
1307 uintmax_t st_log_futuredup;
1308 #endif
1309 #endif
1310 };
1311
1312
1313 struct __db_repmgr_stat {
1314 uintmax_t st_perm_failed;
1315 uintmax_t st_msgs_queued;
1316 uintmax_t st_msgs_dropped;
1317
1318 u_int32_t st_incoming_queue_gbytes;
1319 u_int32_t st_incoming_queue_bytes;
1320 uintmax_t st_incoming_msgs_dropped;
1321
1322 uintmax_t st_connection_drop;
1323 uintmax_t st_connect_fail;
1324 u_int32_t st_elect_threads;
1325 u_int32_t st_group_stable_log_file;
1326
1327 u_int32_t st_max_elect_threads;
1328 u_int32_t st_site_participants;
1329 u_int32_t st_site_total;
1330 u_int32_t st_site_views;
1331 u_int32_t st_polling_method;
1332 uintmax_t st_takeovers;
1333 uintmax_t st_write_ops_forwarded;
1334
1335 uintmax_t st_write_ops_received;
1336
1337 };
1338
1339
1340 struct __db_repmgr_conn_err {
1341 int eid;
1342 int error;
1343 };
1344
1345
1346 typedef int DB_REPMGR_SOCKET;
1347
1348
1349
1350
1351
1352
1353
1354 struct __db_seq_record {
1355 u_int32_t seq_version;
1356 u_int32_t flags;
1357 db_seq_t seq_value;
1358 db_seq_t seq_max;
1359 db_seq_t seq_min;
1360 };
1361
1362
1363
1364
1365 struct __db_sequence {
1366 DB *seq_dbp;
1367 db_mutex_t mtx_seq;
1368 DB_SEQ_RECORD *seq_rp;
1369 DB_SEQ_RECORD seq_record;
1370 u_int32_t seq_cache_size;
1371 db_seq_t seq_last_value;
1372 db_seq_t seq_prev_value;
1373 DBT seq_key;
1374 DBT seq_data;
1375
1376
1377 void *api_internal;
1378
1379
1380 int (*close) __P((DB_SEQUENCE *, u_int32_t));
1381 int (*get) __P((DB_SEQUENCE *,
1382 DB_TXN *, u_int32_t, db_seq_t *, u_int32_t));
1383 int (*get_cachesize) __P((DB_SEQUENCE *, u_int32_t *));
1384 int (*get_db) __P((DB_SEQUENCE *, DB **));
1385 int (*get_flags) __P((DB_SEQUENCE *, u_int32_t *));
1386 int (*get_key) __P((DB_SEQUENCE *, DBT *));
1387 int (*get_range) __P((DB_SEQUENCE *,
1388 db_seq_t *, db_seq_t *));
1389 int (*initial_value) __P((DB_SEQUENCE *, db_seq_t));
1390 int (*open) __P((DB_SEQUENCE *,
1391 DB_TXN *, DBT *, u_int32_t));
1392 int (*remove) __P((DB_SEQUENCE *, DB_TXN *, u_int32_t));
1393 int (*set_cachesize) __P((DB_SEQUENCE *, u_int32_t));
1394 int (*set_flags) __P((DB_SEQUENCE *, u_int32_t));
1395 int (*set_range) __P((DB_SEQUENCE *, db_seq_t, db_seq_t));
1396 int (*stat) __P((DB_SEQUENCE *,
1397 DB_SEQUENCE_STAT **, u_int32_t));
1398 int (*stat_print) __P((DB_SEQUENCE *, u_int32_t));
1399
1400 };
1401
1402 struct __db_seq_stat {
1403 uintmax_t st_wait;
1404 uintmax_t st_nowait;
1405 db_seq_t st_current;
1406 db_seq_t st_value;
1407 db_seq_t st_last_value;
1408 db_seq_t st_min;
1409 db_seq_t st_max;
1410 u_int32_t st_cache_size;
1411 u_int32_t st_flags;
1412 };
1413
1414
1415
1416
1417
1418
1419
1420
1421 typedef enum {
1422 DB_BTREE=1,
1423 DB_HASH=2,
1424 DB_HEAP=6,
1425 DB_RECNO=3,
1426 DB_QUEUE=4,
1427 DB_UNKNOWN=5
1428 } DBTYPE;
1429
1430 #define DB_RENAMEMAGIC 0x030800
1431
1432 #define DB_BTREEVERSION 10
1433 #define DB_BTREEOLDVER 8
1434 #define DB_BTREEMAGIC 0x053162
1435
1436 #define DB_HASHVERSION 10
1437 #define DB_HASHOLDVER 7
1438 #define DB_HASHMAGIC 0x061561
1439
1440 #define DB_HEAPVERSION 2
1441 #define DB_HEAPOLDVER 1
1442 #define DB_HEAPMAGIC 0x074582
1443
1444 #define DB_QAMVERSION 4
1445 #define DB_QAMOLDVER 3
1446 #define DB_QAMMAGIC 0x042253
1447
1448 #define DB_SEQUENCE_VERSION 2
1449 #define DB_SEQUENCE_OLDVER 1
1450
1451
1452
1453
1454
1455 #define DB_AFTER 1
1456 #define DB_APPEND 2
1457 #define DB_BEFORE 3
1458 #define DB_CONSUME 4
1459 #define DB_CONSUME_WAIT 5
1460 #define DB_CURRENT 6
1461 #define DB_FIRST 7
1462 #define DB_GET_BOTH 8
1463 #define DB_GET_BOTHC 9
1464 #define DB_GET_BOTH_RANGE 10
1465 #define DB_GET_RECNO 11
1466 #define DB_JOIN_ITEM 12
1467 #define DB_KEYFIRST 13
1468 #define DB_KEYLAST 14
1469 #define DB_LAST 15
1470 #define DB_NEXT 16
1471 #define DB_NEXT_DUP 17
1472 #define DB_NEXT_NODUP 18
1473 #define DB_NODUPDATA 19
1474 #define DB_NOOVERWRITE 20
1475 #define DB_OVERWRITE_DUP 21
1476 #define DB_POSITION 22
1477 #define DB_PREV 23
1478 #define DB_PREV_DUP 24
1479 #define DB_PREV_NODUP 25
1480 #define DB_SET 26
1481 #define DB_SET_RANGE 27
1482 #define DB_SET_RECNO 28
1483 #define DB_UPDATE_SECONDARY 29
1484 #define DB_SET_LTE 30
1485 #define DB_GET_BOTH_LTE 31
1486
1487
1488 #define DB_OPFLAGS_MASK 0x000000ff
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499 #define DB_BUFFER_SMALL (-30999)
1500 #define DB_DONOTINDEX (-30998)
1501 #define DB_FOREIGN_CONFLICT (-30997)
1502 #define DB_HEAP_FULL (-30996)
1503 #define DB_KEYEMPTY (-30995)
1504 #define DB_KEYEXIST (-30994)
1505 #define DB_LOCK_DEADLOCK (-30993)
1506 #define DB_LOCK_NOTGRANTED (-30992)
1507 #define DB_LOG_BUFFER_FULL (-30991)
1508 #define DB_LOG_VERIFY_BAD (-30990)
1509 #define DB_META_CHKSUM_FAIL (-30989)
1510 #define DB_NOSERVER (-30988)
1511 #define DB_NOTFOUND (-30987)
1512 #define DB_OLD_VERSION (-30986)
1513 #define DB_PAGE_NOTFOUND (-30985)
1514 #define DB_REP_DUPMASTER (-30984)
1515 #define DB_REP_HANDLE_DEAD (-30983)
1516 #define DB_REP_HOLDELECTION (-30982)
1517 #define DB_REP_IGNORE (-30981)
1518 #define DB_REP_INELECT (-30980)
1519 #define DB_REP_ISPERM (-30979)
1520 #define DB_REP_JOIN_FAILURE (-30978)
1521 #define DB_REP_LEASE_EXPIRED (-30977)
1522 #define DB_REP_LOCKOUT (-30976)
1523 #define DB_REP_NEWSITE (-30975)
1524 #define DB_REP_NOTPERM (-30974)
1525 #define DB_REP_UNAVAIL (-30973)
1526 #define DB_REP_WOULDROLLBACK (-30972)
1527 #define DB_RUNRECOVERY (-30971)
1528 #define DB_SECONDARY_BAD (-30970)
1529 #define DB_SLICE_CORRUPT (-30969)
1530 #define DB_TIMEOUT (-30968)
1531 #define DB_VERIFY_BAD (-30967)
1532 #define DB_VERSION_MISMATCH (-30966)
1533 #define DB_SYSTEM_MEM_MISSING (-30965)
1534
1535
1536 #define DB_ALREADY_ABORTED (-30899)
1537
1538 #define DB_DELETED (-30897)
1539 #define DB_EVENT_NOT_HANDLED (-30896)
1540 #define DB_NEEDSPLIT (-30895)
1541 #define DB_NOINTMP (-30886)
1542
1543 #define DB_REP_BULKOVF (-30894)
1544 #define DB_REP_LOGREADY (-30893)
1545 #define DB_REP_NEWMASTER (-30892)
1546 #define DB_REP_PAGEDONE (-30891)
1547 #define DB_SURPRISE_KID (-30890)
1548
1549 #define DB_SWAPBYTES (-30889)
1550 #define DB_TXN_CKP (-30888)
1551 #define DB_VERIFY_FATAL (-30887)
1552
1553
1554
1555
1556
1557
1558 #define DB_EXIT_FAILCHK 3
1559
1560
1561 struct __db {
1562
1563
1564
1565 u_int32_t pgsize;
1566 DB_CACHE_PRIORITY priority;
1567
1568
1569 int (*db_append_recno) __P((DB *, DBT *, db_recno_t));
1570 void (*db_feedback) __P((DB *, int, int));
1571 int (*dup_compare) __P((DB *, const DBT *, const DBT *, size_t *));
1572
1573 void *app_private;
1574
1575
1576
1577
1578 DB_ENV *dbenv;
1579 ENV *env;
1580
1581 DB_MPOOLFILE *mpf;
1582
1583 DB **db_slices;
1584
1585 DB *db_container;
1586
1587 db_slice_t db_slice_index;
1588 DBTYPE type;
1589
1590 db_mutex_t mutex;
1591
1592 char *fname, *dname;
1593 const char *dirname;
1594 u_int32_t open_flags;
1595
1596 u_int8_t fileid[DB_FILE_ID_LEN];
1597
1598 u_int32_t adj_fileid;
1599
1600 u_int32_t blob_threshold;
1601
1602 #define DB_LOGFILEID_INVALID -1
1603 FNAME *log_filename;
1604
1605 db_pgno_t meta_pgno;
1606 DB_LOCKER *locker;
1607 DB_LOCKER *cur_locker;
1608 DB_TXN *cur_txn;
1609 DB_LOCKER *associate_locker;
1610 DB_LOCK handle_lock;
1611
1612 time_t timestamp;
1613 u_int32_t fid_gen;
1614
1615
1616
1617
1618 DBT my_rskey;
1619 DBT my_rkey;
1620 DBT my_rdata;
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635 DB_FH *saved_open_fhp;
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645 struct {
1646 struct __db *tqe_next;
1647 struct __db **tqe_prev;
1648 } dblistlinks;
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659 struct __cq_fq {
1660 struct __dbc *tqh_first;
1661 struct __dbc **tqh_last;
1662 } free_queue;
1663 struct __cq_aq {
1664 struct __dbc *tqh_first;
1665 struct __dbc **tqh_last;
1666 } active_queue;
1667 struct __cq_jq {
1668 struct __dbc *tqh_first;
1669 struct __dbc **tqh_last;
1670 } join_queue;
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681 struct {
1682 struct __db *lh_first;
1683 } s_secondaries;
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697 struct {
1698 struct __db *le_next;
1699 struct __db **le_prev;
1700 } s_links;
1701 u_int32_t s_refcnt;
1702
1703
1704 int (*s_callback) __P((DB *, const DBT *, const DBT *, DBT *));
1705
1706
1707 DB *s_primary;
1708
1709 #define DB_ASSOC_IMMUTABLE_KEY 0x00000001
1710 #define DB_ASSOC_CREATE 0x00000002
1711
1712
1713 u_int32_t s_assoc_flags;
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724 struct {
1725 struct __db_foreign_info *lh_first;
1726 } f_primaries;
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737 struct {
1738 struct __db *tqe_next;
1739 struct __db **tqe_prev;
1740 } felink;
1741
1742
1743 DB *s_foreign;
1744
1745 DB *blob_meta_db;
1746 DB_SEQUENCE *blob_seq;
1747 char *blob_sub_dir;
1748 db_seq_t blob_file_id;
1749 db_seq_t blob_sdb_id;
1750
1751
1752 void *api_internal;
1753
1754
1755 void *bt_internal;
1756 void *h_internal;
1757 void *heap_internal;
1758 void *p_internal;
1759 void *q_internal;
1760
1761
1762 int (*associate) __P((DB *, DB_TXN *, DB *,
1763 int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t));
1764 int (*associate_foreign) __P((DB *, DB *,
1765 int (*)(DB *, const DBT *, DBT *, const DBT *, int *),
1766 u_int32_t));
1767 int (*close) __P((DB *, u_int32_t));
1768 int (*compact) __P((DB *,
1769 DB_TXN *, DBT *, DBT *, DB_COMPACT *, u_int32_t, DBT *));
1770 int (*convert) __P((DB *, const char *, u_int32_t));
1771 int (*cursor) __P((DB *, DB_TXN *, DBC **, u_int32_t));
1772 int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t));
1773 void (*err) __P((DB *, int, const char *, ...));
1774 void (*errx) __P((DB *, const char *, ...));
1775 int (*exists) __P((DB *, DB_TXN *, DBT *, u_int32_t));
1776 int (*fd) __P((DB *, int *));
1777 int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
1778 int (*get_alloc) __P((DB *, void *(**)(size_t),
1779 void *(**)(void *, size_t), void (**)(void *)));
1780 int (*get_append_recno) __P((DB *, int (**)(DB *, DBT *, db_recno_t)));
1781 int (*get_assoc_flags) __P((DB *, u_int32_t *));
1782 int (*get_blob_dir) __P((DB *, const char **));
1783 int (*get_blob_sub_dir) __P((DB *, const char **));
1784 int (*get_blob_threshold) __P((DB *, u_int32_t *));
1785 int (*get_bt_compare)
1786 __P((DB *, int (**)(DB *, const DBT *, const DBT *, size_t *)));
1787 int (*get_bt_compress) __P((DB *,
1788 int (**)(DB *,
1789 const DBT *, const DBT *, const DBT *, const DBT *, DBT *),
1790 int (**)(DB *, const DBT *, const DBT *, DBT *, DBT *, DBT *)));
1791 int (*get_bt_minkey) __P((DB *, u_int32_t *));
1792 int (*get_bt_prefix)
1793 __P((DB *, size_t (**)(DB *, const DBT *, const DBT *)));
1794 int (*get_byteswapped) __P((DB *, int *));
1795 int (*get_cachesize) __P((DB *, u_int32_t *, u_int32_t *, int *));
1796 int (*get_create_dir) __P((DB *, const char **));
1797 int (*get_dbname) __P((DB *, const char **, const char **));
1798 int (*get_dup_compare)
1799 __P((DB *, int (**)(DB *, const DBT *, const DBT *, size_t *)));
1800 int (*get_encrypt_flags) __P((DB *, u_int32_t *));
1801 DB_ENV *(*get_env) __P((DB *));
1802 void (*get_errcall) __P((DB *,
1803 void (**)(const DB_ENV *, const char *, const char *)));
1804 void (*get_errfile) __P((DB *, FILE **));
1805 void (*get_errpfx) __P((DB *, const char **));
1806 int (*get_ext_file_dir) __P((DB *, const char **));
1807 int (*get_ext_file_threshold) __P((DB *, u_int32_t *));
1808 int (*get_feedback) __P((DB *, void (**)(DB *, int, int)));
1809 int (*get_flags) __P((DB *, u_int32_t *));
1810 int (*get_h_compare)
1811 __P((DB *, int (**)(DB *, const DBT *, const DBT *, size_t *)));
1812 int (*get_h_ffactor) __P((DB *, u_int32_t *));
1813 int (*get_h_hash)
1814 __P((DB *, u_int32_t (**)(DB *, const void *, u_int32_t)));
1815 int (*get_h_nelem) __P((DB *, u_int32_t *));
1816 int (*get_heapsize) __P((DB *, u_int32_t *, u_int32_t *));
1817 int (*get_heap_regionsize) __P((DB *, u_int32_t *));
1818 int (*get_lk_exclusive) __P((DB *, int *, int *));
1819 int (*get_lorder) __P((DB *, int *));
1820 DB_MPOOLFILE *(*get_mpf) __P((DB *));
1821 void (*get_msgcall) __P((DB *,
1822 void (**)(const DB_ENV *, const char *, const char *)));
1823 void (*get_msgfile) __P((DB *, FILE **));
1824 void (*get_msgpfx) __P((DB *, const char **));
1825 int (*get_multiple) __P((DB *));
1826 int (*get_open_flags) __P((DB *, u_int32_t *));
1827 int (*get_pagesize) __P((DB *, u_int32_t *));
1828 int (*get_partition_callback) __P((DB *,
1829 u_int32_t *, u_int32_t (**)(DB *, DBT *key)));
1830 int (*get_partition_dirs) __P((DB *, const char ***));
1831 int (*get_partition_keys) __P((DB *, u_int32_t *, DBT **));
1832 int (*get_priority) __P((DB *, DB_CACHE_PRIORITY *));
1833 int (*get_q_extentsize) __P((DB *, u_int32_t *));
1834 int (*get_re_delim) __P((DB *, int *));
1835 int (*get_re_len) __P((DB *, u_int32_t *));
1836 int (*get_re_pad) __P((DB *, int *));
1837 int (*get_re_source) __P((DB *, const char **));
1838 int (*get_slices) __P((DB *, DB ***));
1839 int (*get_transactional) __P((DB *));
1840 int (*get_type) __P((DB *, DBTYPE *));
1841 int (*join) __P((DB *, DBC **, DBC **, u_int32_t));
1842 int (*key_range)
1843 __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t));
1844 void (*msg) __P((DB *, const char *, ...));
1845 int (*open) __P((DB *,
1846 DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int));
1847 int (*pget) __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t));
1848 int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
1849 int (*remove) __P((DB *, const char *, const char *, u_int32_t));
1850 int (*rename) __P((DB *,
1851 const char *, const char *, const char *, u_int32_t));
1852 int (*set_alloc) __P((DB *, void *(*)(size_t),
1853 void *(*)(void *, size_t), void (*)(void *)));
1854 int (*set_append_recno) __P((DB *, int (*)(DB *, DBT *, db_recno_t)));
1855 int (*set_blob_dir) __P((DB *, const char *));
1856 int (*set_blob_threshold) __P((DB *, u_int32_t, u_int32_t));
1857 int (*set_bt_compare)
1858 __P((DB *, int (*)(DB *, const DBT *, const DBT *, size_t *)));
1859 int (*set_bt_compress) __P((DB *,
1860 int (*)(DB *, const DBT *, const DBT *, const DBT *, const DBT *, DBT *),
1861 int (*)(DB *, const DBT *, const DBT *, DBT *, DBT *, DBT *)));
1862 int (*set_bt_minkey) __P((DB *, u_int32_t));
1863 int (*set_bt_prefix)
1864 __P((DB *, size_t (*)(DB *, const DBT *, const DBT *)));
1865 int (*set_cachesize) __P((DB *, u_int32_t, u_int32_t, int));
1866 int (*set_create_dir) __P((DB *, const char *));
1867 int (*set_dup_compare)
1868 __P((DB *, int (*)(DB *, const DBT *, const DBT *, size_t *)));
1869 int (*set_encrypt) __P((DB *, const char *, u_int32_t));
1870 void (*set_errcall) __P((DB *,
1871 void (*)(const DB_ENV *, const char *, const char *)));
1872 void (*set_errfile) __P((DB *, FILE *));
1873 void (*set_errpfx) __P((DB *, const char *));
1874 int (*set_ext_file_dir) __P((DB *, const char *));
1875 int (*set_ext_file_threshold) __P((DB *, u_int32_t, u_int32_t));
1876 int (*set_feedback) __P((DB *, void (*)(DB *, int, int)));
1877 int (*set_flags) __P((DB *, u_int32_t));
1878 int (*set_h_compare)
1879 __P((DB *, int (*)(DB *, const DBT *, const DBT *, size_t *)));
1880 int (*set_h_ffactor) __P((DB *, u_int32_t));
1881 int (*set_h_hash)
1882 __P((DB *, u_int32_t (*)(DB *, const void *, u_int32_t)));
1883 int (*set_h_nelem) __P((DB *, u_int32_t));
1884 int (*set_heapsize) __P((DB *, u_int32_t, u_int32_t, u_int32_t));
1885 int (*set_heap_regionsize) __P((DB *, u_int32_t));
1886 int (*set_lk_exclusive) __P((DB *, int));
1887 int (*set_lorder) __P((DB *, int));
1888 int (*set_slice_callback)
1889 __P((DB *, int (*)(const DB *, const DBT *, DBT *)));
1890 void (*set_msgcall) __P((DB *,
1891 void (*)(const DB_ENV *, const char *, const char *)));
1892 void (*set_msgfile) __P((DB *, FILE *));
1893 void (*set_msgpfx) __P((DB *, const char *));
1894 int (*set_pagesize) __P((DB *, u_int32_t));
1895 int (*set_paniccall) __P((DB *, void (*)(DB_ENV *, int)));
1896 int (*set_partition) __P((DB *,
1897 u_int32_t, DBT *, u_int32_t (*)(DB *, DBT *key)));
1898 int (*set_partition_dirs) __P((DB *, const char **));
1899 int (*set_priority) __P((DB *, DB_CACHE_PRIORITY));
1900 int (*set_q_extentsize) __P((DB *, u_int32_t));
1901 int (*set_re_delim) __P((DB *, int));
1902 int (*set_re_len) __P((DB *, u_int32_t));
1903 int (*set_re_pad) __P((DB *, int));
1904 int (*set_re_source) __P((DB *, const char *));
1905 int (*slice_lookup) __P((DB *, const DBT *, DB **, u_int32_t));
1906 int (*sort_multiple) __P((DB *, DBT *, DBT *, u_int32_t));
1907 int (*stat) __P((DB *, DB_TXN *, void *, u_int32_t));
1908 int (*stat_print) __P((DB *, u_int32_t));
1909 int (*sync) __P((DB *, u_int32_t));
1910 int (*truncate) __P((DB *, DB_TXN *, u_int32_t *, u_int32_t));
1911 int (*upgrade) __P((DB *, const char *, u_int32_t));
1912 int (*verify)
1913 __P((DB *, const char *, const char *, FILE *, u_int32_t));
1914
1915
1916
1917 int (*slice_callback)(const DB *db, const DBT *key, DBT *slice);
1918 int (*dump) __P((DB *, const char *,
1919 int (*)(void *, const void *), void *, int, int));
1920 int (*db_am_remove) __P((DB *, DB_THREAD_INFO *,
1921 DB_TXN *, const char *, const char *, u_int32_t));
1922 int (*db_am_rename) __P((DB *, DB_THREAD_INFO *,
1923 DB_TXN *, const char *, const char *, const char *));
1924
1925
1926
1927
1928
1929
1930 int (*stored_get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
1931 int (*stored_close) __P((DB *, u_int32_t));
1932
1933
1934 int (*alt_close) __P((DB *, u_int32_t));
1935
1936 #define DB_OK_BTREE 0x01
1937 #define DB_OK_HASH 0x02
1938 #define DB_OK_HEAP 0x04
1939 #define DB_OK_QUEUE 0x08
1940 #define DB_OK_RECNO 0x10
1941 u_int32_t am_ok;
1942
1943
1944
1945
1946
1947
1948 int preserve_fid;
1949
1950
1951
1952
1953
1954 u_int32_t orig_flags;
1955
1956 #define DB_AM_CHKSUM 0x00000001
1957 #define DB_AM_COMPENSATE 0x00000002
1958 #define DB_AM_COMPRESS 0x00000004
1959 #define DB_AM_CREATED 0x00000008
1960 #define DB_AM_CREATED_MSTR 0x00000010
1961 #define DB_AM_DBM_ERROR 0x00000020
1962 #define DB_AM_DELIMITER 0x00000040
1963 #define DB_AM_DISCARD 0x00000080
1964 #define DB_AM_DUP 0x00000100
1965 #define DB_AM_DUPSORT 0x00000200
1966 #define DB_AM_ENCRYPT 0x00000400
1967 #define DB_AM_FIXEDLEN 0x00000800
1968 #define DB_AM_INMEM 0x00001000
1969 #define DB_AM_INORDER 0x00002000
1970 #define DB_AM_IN_RENAME 0x00004000
1971 #define DB_AM_NOT_DURABLE 0x00008000
1972 #define DB_AM_OPEN_CALLED 0x00010000
1973 #define DB_AM_PAD 0x00020000
1974 #define DB_AM_PARTDB 0x00040000
1975 #define DB_AM_PGDEF 0x00080000
1976 #define DB_AM_RDONLY 0x00100000
1977 #define DB_AM_READ_UNCOMMITTED 0x00200000
1978 #define DB_AM_RECNUM 0x00400000
1979 #define DB_AM_RECOVER 0x00800000
1980 #define DB_AM_RENUMBER 0x01000000
1981 #define DB_AM_REVSPLITOFF 0x02000000
1982 #define DB_AM_SECONDARY 0x04000000
1983 #define DB_AM_SNAPSHOT 0x08000000
1984 #define DB_AM_SUBDB 0x10000000
1985 #define DB_AM_SWAP 0x20000000
1986 #define DB_AM_TXN 0x40000000
1987 #define DB_AM_VERIFYING 0x80000000
1988 u_int32_t flags;
1989
1990 #define DB2_AM_EXCL 0x00000001
1991 #define DB2_AM_INTEXCL 0x00000002
1992 #define DB2_AM_MPOOL_OPENED 0x00000004
1993 #define DB2_AM_NOWAIT 0x00000008
1994 u_int32_t flags2;
1995 };
1996
1997
1998
1999
2000 struct __db_stream {
2001 DBC *dbc;
2002 DB_FH *fhp;
2003
2004
2005 int (*close) __P((DB_STREAM *, u_int32_t));
2006 int (*read) __P((DB_STREAM *, DBT *, db_off_t, u_int32_t, u_int32_t));
2007 int (*size) __P((DB_STREAM *, db_off_t *, u_int32_t));
2008 int (*write) __P((DB_STREAM *, DBT *, db_off_t, u_int32_t));
2009
2010
2011 u_int32_t flags;
2012 #define DB_STREAM_READ 0x00000001
2013 #define DB_STREAM_WRITE 0x00000002
2014 #define DB_STREAM_SYNC_WRITE 0x00000004
2015 db_seq_t blob_id;
2016 db_off_t file_size;
2017 };
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043 #define DB_MULTIPLE_INIT(pointer, dbt) \
2044 (pointer = (u_int8_t *)(dbt)->data + \
2045 (dbt)->ulen - sizeof(u_int32_t))
2046
2047 #define DB_MULTIPLE_NEXT(pointer, dbt, retdata, retdlen) \
2048 do { \
2049 u_int32_t *__p = (u_int32_t *)(pointer); \
2050 if (*__p == (u_int32_t)-1) { \
2051 retdata = NULL; \
2052 pointer = NULL; \
2053 break; \
2054 } \
2055 retdata = (u_int8_t *)(dbt)->data + *__p--; \
2056 retdlen = *__p--; \
2057 pointer = __p; \
2058 if (retdlen == 0 && retdata == (u_int8_t *)(dbt)->data) \
2059 retdata = NULL; \
2060 } while (0)
2061
2062 #define DB_MULTIPLE_KEY_NEXT(pointer, dbt, retkey, retklen, retdata, retdlen) \
2063 do { \
2064 u_int32_t *__p = (u_int32_t *)(pointer); \
2065 if (*__p == (u_int32_t)-1) { \
2066 retdata = NULL; \
2067 retkey = NULL; \
2068 pointer = NULL; \
2069 break; \
2070 } \
2071 retkey = (u_int8_t *)(dbt)->data + *__p--; \
2072 retklen = *__p--; \
2073 retdata = (u_int8_t *)(dbt)->data + *__p--; \
2074 retdlen = *__p--; \
2075 pointer = __p; \
2076 } while (0)
2077
2078 #define DB_MULTIPLE_RECNO_NEXT(pointer, dbt, recno, retdata, retdlen) \
2079 do { \
2080 u_int32_t *__p = (u_int32_t *)(pointer); \
2081 if (*__p == (u_int32_t)0) { \
2082 recno = 0; \
2083 retdata = NULL; \
2084 pointer = NULL; \
2085 break; \
2086 } \
2087 recno = *__p--; \
2088 retdata = (u_int8_t *)(dbt)->data + *__p--; \
2089 retdlen = *__p--; \
2090 pointer = __p; \
2091 } while (0)
2092
2093 #define DB_MULTIPLE_WRITE_INIT(pointer, dbt) \
2094 do { \
2095 (dbt)->flags |= DB_DBT_BULK; \
2096 pointer = (u_int8_t *)(dbt)->data + \
2097 (dbt)->ulen - sizeof(u_int32_t); \
2098 *(u_int32_t *)(pointer) = (u_int32_t)-1; \
2099 } while (0)
2100
2101 #define DB_MULTIPLE_RESERVE_NEXT(pointer, dbt, writedata, writedlen) \
2102 do { \
2103 u_int32_t *__p = (u_int32_t *)(pointer); \
2104 u_int32_t __off = ((pointer) == (u_int8_t *)(dbt)->data +\
2105 (dbt)->ulen - sizeof(u_int32_t)) ? 0 : __p[1] + __p[2];\
2106 if ((u_int8_t *)(dbt)->data + __off + (writedlen) > \
2107 (u_int8_t *)(__p - 2)) \
2108 writedata = NULL; \
2109 else { \
2110 writedata = (u_int8_t *)(dbt)->data + __off; \
2111 __p[0] = __off; \
2112 __p[-1] = (u_int32_t)(writedlen); \
2113 __p[-2] = (u_int32_t)-1; \
2114 pointer = __p - 2; \
2115 } \
2116 } while (0)
2117
2118 #define DB_MULTIPLE_WRITE_NEXT(pointer, dbt, writedata, writedlen) \
2119 do { \
2120 void *__destd; \
2121 DB_MULTIPLE_RESERVE_NEXT((pointer), (dbt), \
2122 __destd, (writedlen)); \
2123 if (__destd == NULL) \
2124 pointer = NULL; \
2125 else \
2126 memcpy(__destd, (writedata), (writedlen)); \
2127 } while (0)
2128
2129 #define DB_MULTIPLE_KEY_RESERVE_NEXT(pointer, dbt, writekey, writeklen, writedata, writedlen) \
2130 do { \
2131 u_int32_t *__p = (u_int32_t *)(pointer); \
2132 u_int32_t __off = ((pointer) == (u_int8_t *)(dbt)->data +\
2133 (dbt)->ulen - sizeof(u_int32_t)) ? 0 : __p[1] + __p[2];\
2134 if ((u_int8_t *)(dbt)->data + __off + (writeklen) + \
2135 (writedlen) > (u_int8_t *)(__p - 4)) { \
2136 writekey = NULL; \
2137 writedata = NULL; \
2138 } else { \
2139 writekey = (u_int8_t *)(dbt)->data + __off; \
2140 __p[0] = __off; \
2141 __p[-1] = (u_int32_t)(writeklen); \
2142 __p -= 2; \
2143 __off += (u_int32_t)(writeklen); \
2144 writedata = (u_int8_t *)(dbt)->data + __off; \
2145 __p[0] = __off; \
2146 __p[-1] = (u_int32_t)(writedlen); \
2147 __p[-2] = (u_int32_t)-1; \
2148 pointer = __p - 2; \
2149 } \
2150 } while (0)
2151
2152 #define DB_MULTIPLE_KEY_WRITE_NEXT(pointer, dbt, writekey, writeklen, writedata, writedlen) \
2153 do { \
2154 void *__destk, *__destd; \
2155 DB_MULTIPLE_KEY_RESERVE_NEXT((pointer), (dbt), \
2156 __destk, (writeklen), __destd, (writedlen)); \
2157 if (__destk == NULL) \
2158 pointer = NULL; \
2159 else { \
2160 memcpy(__destk, (writekey), (writeklen)); \
2161 if (__destd != NULL) \
2162 memcpy(__destd, (writedata), (writedlen));\
2163 } \
2164 } while (0)
2165
2166 #define DB_MULTIPLE_RECNO_WRITE_INIT(pointer, dbt) \
2167 do { \
2168 (dbt)->flags |= DB_DBT_BULK; \
2169 pointer = (u_int8_t *)(dbt)->data + \
2170 (dbt)->ulen - sizeof(u_int32_t); \
2171 *(u_int32_t *)(pointer) = 0; \
2172 } while (0)
2173
2174 #define DB_MULTIPLE_RECNO_RESERVE_NEXT(pointer, dbt, recno, writedata, writedlen) \
2175 do { \
2176 u_int32_t *__p = (u_int32_t *)(pointer); \
2177 u_int32_t __off = ((pointer) == (u_int8_t *)(dbt)->data +\
2178 (dbt)->ulen - sizeof(u_int32_t)) ? 0 : __p[1] + __p[2]; \
2179 if (((u_int8_t *)(dbt)->data + __off) + (writedlen) > \
2180 (u_int8_t *)(__p - 3)) \
2181 writedata = NULL; \
2182 else { \
2183 writedata = (u_int8_t *)(dbt)->data + __off; \
2184 __p[0] = (u_int32_t)(recno); \
2185 __p[-1] = __off; \
2186 __p[-2] = (u_int32_t)(writedlen); \
2187 __p[-3] = 0; \
2188 pointer = __p - 3; \
2189 } \
2190 } while (0)
2191
2192 #define DB_MULTIPLE_RECNO_WRITE_NEXT(pointer, dbt, recno, writedata, writedlen)\
2193 do { \
2194 void *__destd; \
2195 DB_MULTIPLE_RECNO_RESERVE_NEXT((pointer), (dbt), \
2196 (recno), __destd, (writedlen)); \
2197 if (__destd == NULL) \
2198 pointer = NULL; \
2199 else if ((writedlen) != 0) \
2200 memcpy(__destd, (writedata), (writedlen)); \
2201 } while (0)
2202
2203 struct __db_heap_rid {
2204 db_pgno_t pgno;
2205 db_indx_t indx;
2206 };
2207 #define DB_HEAP_RID_SZ (sizeof(db_pgno_t) + sizeof(db_indx_t))
2208
2209
2210
2211
2212 struct __dbc {
2213 DB *dbp;
2214 DB_ENV *dbenv;
2215 ENV *env;
2216
2217 DB_THREAD_INFO *thread_info;
2218 DB_TXN *txn;
2219 DB_CACHE_PRIORITY priority;
2220
2221 db_slice_t dbc_curslice;
2222 DBC *dbc_slices[1];
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232 struct {
2233 DBC *tqe_next;
2234 DBC **tqe_prev;
2235 } links;
2236
2237
2238
2239
2240
2241
2242
2243
2244 struct {
2245 DBC *tqe_next;
2246 DBC **tqe_prev;
2247 } txn_cursors;
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260 DBT *rskey;
2261 DBT *rkey;
2262 DBT *rdata;
2263
2264 DBT my_rskey;
2265 DBT my_rkey;
2266 DBT my_rdata;
2267
2268 DBT *cur_key;
2269
2270 DB_LOCKER *lref;
2271 DB_LOCKER *locker;
2272 DBT lock_dbt;
2273 DB_LOCK_ILOCK lock;
2274 DB_LOCK mylock;
2275
2276 DBTYPE dbtype;
2277
2278 DBC_INTERNAL *internal;
2279
2280
2281 int (*close) __P((DBC *));
2282 int (*cmp) __P((DBC *, DBC *, int *, u_int32_t));
2283 int (*count) __P((DBC *, db_recno_t *, u_int32_t));
2284 int (*db_stream) __P((DBC *, DB_STREAM **, u_int32_t));
2285 int (*del) __P((DBC *, u_int32_t));
2286 int (*dup) __P((DBC *, DBC **, u_int32_t));
2287 int (*get) __P((DBC *, DBT *, DBT *, u_int32_t));
2288 int (*get_priority) __P((DBC *, DB_CACHE_PRIORITY *));
2289 int (*pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t));
2290 int (*put) __P((DBC *, DBT *, DBT *, u_int32_t));
2291 int (*set_priority) __P((DBC *, DB_CACHE_PRIORITY));
2292
2293
2294
2295 int (*c_close) __P((DBC *));
2296 int (*c_count) __P((DBC *, db_recno_t *, u_int32_t));
2297 int (*c_del) __P((DBC *, u_int32_t));
2298 int (*c_dup) __P((DBC *, DBC **, u_int32_t));
2299 int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t));
2300 int (*c_pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t));
2301 int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t));
2302
2303
2304 int (*am_bulk) __P((DBC *, DBT *, u_int32_t));
2305 int (*am_close) __P((DBC *, db_pgno_t, int *));
2306 int (*am_del) __P((DBC *, u_int32_t));
2307 int (*am_destroy) __P((DBC *));
2308 int (*am_get) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *));
2309 int (*am_put) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *));
2310 int (*am_writelock) __P((DBC *));
2311
2312
2313 u_int32_t open_flags;
2314
2315
2316
2317
2318
2319
2320
2321
2322 #define DBC_ACTIVE 0x00001
2323 #define DBC_BULK 0x00002
2324 #define DBC_DONTLOCK 0x00004
2325 #define DBC_DOWNREV 0x00008
2326 #define DBC_DUPLICATE 0x00010
2327 #define DBC_ERROR 0x00020
2328 #define DBC_FAMILY 0x00040
2329 #define DBC_FROM_DB_GET 0x00080
2330 #define DBC_MULTIPLE 0x00100
2331 #define DBC_MULTIPLE_KEY 0x00200
2332 #define DBC_OPD 0x00400
2333 #define DBC_OWN_LID 0x00800
2334 #define DBC_PARTITIONED 0x01000
2335 #define DBC_READ_COMMITTED 0x02000
2336 #define DBC_READ_UNCOMMITTED 0x04000
2337 #define DBC_RECOVER 0x08000
2338 #define DBC_RMW 0x10000
2339 #define DBC_TRANSIENT 0x20000
2340 #define DBC_WAS_READ_COMMITTED 0x40000
2341 #define DBC_WRITECURSOR 0x80000
2342 #define DBC_WRITER 0x100000
2343 u_int32_t flags;
2344 };
2345
2346
2347 struct __key_range {
2348 double less;
2349 double equal;
2350 double greater;
2351 };
2352
2353
2354 struct __db_bt_stat {
2355 u_int32_t bt_magic;
2356 u_int32_t bt_version;
2357 u_int32_t bt_metaflags;
2358 u_int32_t bt_nkeys;
2359 u_int32_t bt_ndata;
2360 u_int32_t bt_pagecnt;
2361 u_int32_t bt_pagesize;
2362 u_int32_t bt_minkey;
2363 u_int32_t bt_ext_files;
2364 u_int32_t bt_nblobs;
2365 u_int32_t bt_re_len;
2366 u_int32_t bt_re_pad;
2367 u_int32_t bt_levels;
2368 u_int32_t bt_int_pg;
2369 u_int32_t bt_leaf_pg;
2370 u_int32_t bt_dup_pg;
2371 u_int32_t bt_over_pg;
2372 u_int32_t bt_empty_pg;
2373 u_int32_t bt_free;
2374 uintmax_t bt_int_pgfree;
2375 uintmax_t bt_leaf_pgfree;
2376 uintmax_t bt_dup_pgfree;
2377 uintmax_t bt_over_pgfree;
2378 };
2379
2380 struct __db_compact {
2381
2382 u_int32_t compact_fillpercent;
2383 db_timeout_t compact_timeout;
2384 u_int32_t compact_pages;
2385
2386 u_int32_t compact_empty_buckets;
2387 u_int32_t compact_pages_free;
2388 u_int32_t compact_pages_examine;
2389 u_int32_t compact_levels;
2390 u_int32_t compact_deadlock;
2391 db_pgno_t compact_pages_truncated;
2392
2393 db_pgno_t compact_truncate;
2394 };
2395
2396
2397 struct __db_h_stat {
2398 u_int32_t hash_magic;
2399 u_int32_t hash_version;
2400 u_int32_t hash_metaflags;
2401 u_int32_t hash_nkeys;
2402 u_int32_t hash_ndata;
2403 u_int32_t hash_ext_files;
2404 u_int32_t hash_nblobs;
2405 u_int32_t hash_pagecnt;
2406 u_int32_t hash_pagesize;
2407 u_int32_t hash_ffactor;
2408 u_int32_t hash_buckets;
2409 u_int32_t hash_free;
2410 uintmax_t hash_bfree;
2411 u_int32_t hash_bigpages;
2412 uintmax_t hash_big_bfree;
2413 u_int32_t hash_overflows;
2414 uintmax_t hash_ovfl_free;
2415 u_int32_t hash_dup;
2416 uintmax_t hash_dup_free;
2417 };
2418
2419
2420 struct __db_heap_stat {
2421 u_int32_t heap_magic;
2422 u_int32_t heap_version;
2423 u_int32_t heap_metaflags;
2424 u_int32_t heap_ext_files;
2425 u_int32_t heap_nblobs;
2426 u_int32_t heap_nrecs;
2427 u_int32_t heap_pagecnt;
2428 u_int32_t heap_pagesize;
2429 u_int32_t heap_nregions;
2430 u_int32_t heap_regionsize;
2431 };
2432
2433
2434 struct __db_qam_stat {
2435 u_int32_t qs_magic;
2436 u_int32_t qs_version;
2437 u_int32_t qs_metaflags;
2438 u_int32_t qs_nkeys;
2439 u_int32_t qs_ndata;
2440 u_int32_t qs_pagesize;
2441 u_int32_t qs_extentsize;
2442 u_int32_t qs_pages;
2443 u_int32_t qs_re_len;
2444 u_int32_t qs_re_pad;
2445 u_int32_t qs_pgfree;
2446 u_int32_t qs_first_recno;
2447 u_int32_t qs_cur_recno;
2448 };
2449
2450
2451
2452
2453 #define DB_REGION_MAGIC 0x120897
2454 #define DB_REGION_MAGIC_RECOVER 0xeeeccc
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473 typedef enum {
2474 DB_MEM_DATABASE=1,
2475 DB_MEM_DATABASE_LENGTH=2,
2476 DB_MEM_EXTFILE_DATABASE=3,
2477 DB_MEM_LOCK=4,
2478 DB_MEM_LOCKOBJECT=5,
2479 DB_MEM_LOCKER=6,
2480 DB_MEM_LOGID=7,
2481 DB_MEM_REP_SITE=8,
2482 DB_MEM_TRANSACTION=9,
2483 DB_MEM_THREAD=10
2484 } DB_MEM_CONFIG;
2485
2486
2487
2488
2489 typedef enum {
2490 DB_BACKUP_READ_COUNT=1,
2491 DB_BACKUP_READ_SLEEP=2,
2492 DB_BACKUP_SIZE=3,
2493 DB_BACKUP_WRITE_DIRECT=4
2494 } DB_BACKUP_CONFIG;
2495
2496 struct __db_env {
2497 ENV *env;
2498
2499
2500 void (*db_errcall) __P((const DB_ENV *, const char *, const char *));
2501 FILE *db_errfile;
2502 const char *db_errpfx;
2503
2504
2505 void (*db_msgcall) __P((const DB_ENV *, const char *, const char *));
2506 FILE *db_msgfile;
2507 const char *db_msgpfx;
2508
2509
2510 int (*app_dispatch) __P((DB_ENV *, DBT *, DB_LSN *, db_recops));
2511 void (*db_event_func) __P((DB_ENV *, u_int32_t, void *));
2512 void (*db_feedback) __P((DB_ENV *, int, int));
2513 void (*db_free) __P((void *));
2514 void (*db_paniccall) __P((DB_ENV *, int));
2515 void *(*db_malloc) __P((size_t));
2516 void *(*db_realloc) __P((void *, size_t));
2517 int (*is_alive) __P((DB_ENV *, pid_t, db_threadid_t, u_int32_t));
2518 void (*thread_id) __P((DB_ENV *, pid_t *, db_threadid_t *));
2519 char *(*thread_id_string) __P((DB_ENV *, pid_t, db_threadid_t, char *));
2520
2521
2522 char *db_blob_dir;
2523 char *db_log_dir;
2524 char *db_md_dir;
2525 char *db_reg_dir;
2526 char *db_tmp_dir;
2527
2528 char *db_create_dir;
2529 char **db_data_dir;
2530
2531 int data_cnt;
2532 int data_next;
2533
2534 char *intermediate_dir_mode;
2535
2536 long shm_key;
2537
2538 char *passwd;
2539 size_t passwd_len;
2540 u_int32_t encrypt_flags;
2541
2542
2543 void *app_private;
2544 void *api1_internal;
2545 void *api2_internal;
2546
2547 u_int32_t verbose;
2548
2549 u_int32_t blob_threshold;
2550
2551
2552 u_int32_t db_init_databases;
2553 u_int32_t db_init_db_len;
2554 u_int32_t db_init_extfile_dbs;
2555
2556
2557
2558
2559
2560
2561 u_int32_t mutex_align;
2562 u_int32_t mutex_cnt;
2563 u_int32_t mutex_inc;
2564 u_int32_t mutex_max;
2565 u_int32_t mutex_tas_spins;
2566
2567
2568 u_int8_t *lk_conflicts;
2569 int lk_modes;
2570 u_int32_t lk_detect;
2571 u_int32_t lk_max;
2572 u_int32_t lk_max_lockers;
2573 u_int32_t lk_max_objects;
2574 u_int32_t lk_init;
2575 u_int32_t lk_init_lockers;
2576 u_int32_t lk_init_objects;
2577 u_int32_t lk_partitions ;
2578 db_timeout_t lk_timeout;
2579
2580 u_int32_t locker_t_size;
2581 u_int32_t object_t_size;
2582
2583
2584 u_int32_t lg_bsize;
2585 u_int32_t lg_fileid_init;
2586 int lg_filemode;
2587 u_int32_t lg_regionmax;
2588 u_int32_t lg_size;
2589 u_int32_t lg_flags;
2590
2591
2592 u_int32_t mp_gbytes;
2593 u_int32_t mp_bytes;
2594 u_int32_t mp_max_gbytes;
2595 u_int32_t mp_max_bytes;
2596 size_t mp_mmapsize;
2597 int mp_maxopenfd;
2598 int mp_maxwrite;
2599 u_int mp_ncache;
2600 u_int32_t mp_pagesize;
2601 u_int32_t mp_tablesize;
2602 u_int32_t mp_mtxcount;
2603
2604 db_timeout_t mp_maxwrite_sleep;
2605
2606
2607 u_int32_t rep_init_sites;
2608
2609
2610 u_int32_t tx_init;
2611 u_int32_t tx_max;
2612 time_t tx_timestamp;
2613 db_timeout_t tx_timeout;
2614
2615
2616 u_int32_t thr_init;
2617 u_int32_t thr_max;
2618 roff_t memory_max;
2619
2620
2621
2622
2623
2624 DB_FH *registry;
2625 u_int32_t registry_off;
2626
2627
2628
2629
2630 db_timeout_t envreg_timeout;
2631
2632
2633
2634
2635
2636 db_timeout_t mutex_failchk_timeout;
2637
2638
2639 db_slice_t slice_cnt;
2640
2641 #define DB_ENV_AUTO_COMMIT 0x00000001
2642 #define DB_ENV_CDB_ALLDB 0x00000002
2643 #define DB_ENV_FAILCHK 0x00000004
2644 #define DB_ENV_DIRECT_DB 0x00000008
2645 #define DB_ENV_DSYNC_DB 0x00000010
2646 #define DB_ENV_DATABASE_LOCKING 0x00000020
2647 #define DB_ENV_MULTIVERSION 0x00000040
2648 #define DB_ENV_NOLOCKING 0x00000080
2649 #define DB_ENV_NOMMAP 0x00000100
2650 #define DB_ENV_NOPANIC 0x00000200
2651 #define DB_ENV_OVERWRITE 0x00000400
2652 #define DB_ENV_REGION_INIT 0x00000800
2653 #define DB_ENV_TIME_NOTGRANTED 0x00001000
2654 #define DB_ENV_TXN_NOSYNC 0x00002000
2655 #define DB_ENV_TXN_NOWAIT 0x00004000
2656 #define DB_ENV_TXN_SNAPSHOT 0x00008000
2657 #define DB_ENV_TXN_WRITE_NOSYNC 0x00010000
2658 #define DB_ENV_YIELDCPU 0x00020000
2659 #define DB_ENV_HOTBACKUP 0x00040000
2660 #define DB_ENV_NOFLUSH 0x00080000
2661 u_int32_t flags;
2662
2663
2664 int (*add_data_dir) __P((DB_ENV *, const char *));
2665 int (*backup) __P((DB_ENV *, const char *, u_int32_t));
2666 int (*cdsgroup_begin) __P((DB_ENV *, DB_TXN **));
2667 int (*close) __P((DB_ENV *, u_int32_t));
2668 int (*dbbackup) __P((DB_ENV *, const char *, const char *, u_int32_t));
2669 int (*dbremove) __P((DB_ENV *,
2670 DB_TXN *, const char *, const char *, u_int32_t));
2671 int (*dbrename) __P((DB_ENV *,
2672 DB_TXN *, const char *, const char *, const char *, u_int32_t));
2673 void (*err) __P((const DB_ENV *, int, const char *, ...));
2674 void (*errx) __P((const DB_ENV *, const char *, ...));
2675 int (*failchk) __P((DB_ENV *, u_int32_t));
2676 int (*fileid_reset) __P((DB_ENV *, const char *, u_int32_t));
2677 int (*get_alloc) __P((DB_ENV *, void *(**)(size_t),
2678 void *(**)(void *, size_t), void (**)(void *)));
2679 int (*get_app_dispatch)
2680 __P((DB_ENV *, int (**)(DB_ENV *, DBT *, DB_LSN *, db_recops)));
2681 int (*get_blob_dir) __P((DB_ENV *, const char **));
2682 int (*get_blob_threshold) __P((DB_ENV*, u_int32_t *));
2683 int (*get_cache_max) __P((DB_ENV *, u_int32_t *, u_int32_t *));
2684 int (*get_cachesize) __P((DB_ENV *, u_int32_t *, u_int32_t *, int *));
2685 int (*get_create_dir) __P((DB_ENV *, const char **));
2686 int (*get_data_dirs) __P((DB_ENV *, const char ***));
2687 int (*get_data_len) __P((DB_ENV *, u_int32_t *));
2688 int (*get_backup_callbacks) __P((DB_ENV *,
2689 int (**)(DB_ENV *, const char *, const char *, void **),
2690 int (**)(DB_ENV *, u_int32_t, u_int32_t, u_int32_t, u_int8_t *, void *),
2691 int (**)(DB_ENV *, const char *, void *)));
2692 int (*get_backup_config) __P((DB_ENV *, DB_BACKUP_CONFIG, u_int32_t *));
2693 int (*get_encrypt_flags) __P((DB_ENV *, u_int32_t *));
2694 void (*get_errcall) __P((DB_ENV *,
2695 void (**)(const DB_ENV *, const char *, const char *)));
2696 void (*get_errfile) __P((DB_ENV *, FILE **));
2697 void (*get_errpfx) __P((DB_ENV *, const char **));
2698 int (*get_ext_file_dir) __P((DB_ENV *, const char **));
2699 int (*get_ext_file_threshold) __P((DB_ENV*, u_int32_t *));
2700 int (*get_feedback) __P((DB_ENV *, void (**)(DB_ENV *, int, int)));
2701 int (*get_flags) __P((DB_ENV *, u_int32_t *));
2702 int (*get_home) __P((DB_ENV *, const char **));
2703 int (*get_intermediate_dir_mode) __P((DB_ENV *, const char **));
2704 int (*get_isalive) __P((DB_ENV *,
2705 int (**)(DB_ENV *, pid_t, db_threadid_t, u_int32_t)));
2706 int (*get_lg_bsize) __P((DB_ENV *, u_int32_t *));
2707 int (*get_lg_dir) __P((DB_ENV *, const char **));
2708 int (*get_lg_filemode) __P((DB_ENV *, int *));
2709 int (*get_lg_max) __P((DB_ENV *, u_int32_t *));
2710 int (*get_lg_regionmax) __P((DB_ENV *, u_int32_t *));
2711 int (*get_lk_conflicts) __P((DB_ENV *, const u_int8_t **, int *));
2712 int (*get_lk_detect) __P((DB_ENV *, u_int32_t *));
2713 int (*get_lk_max_lockers) __P((DB_ENV *, u_int32_t *));
2714 int (*get_lk_max_locks) __P((DB_ENV *, u_int32_t *));
2715 int (*get_lk_max_objects) __P((DB_ENV *, u_int32_t *));
2716 int (*get_lk_partitions) __P((DB_ENV *, u_int32_t *));
2717 int (*get_lk_priority) __P((DB_ENV *, u_int32_t, u_int32_t *));
2718 int (*get_lk_tablesize) __P((DB_ENV *, u_int32_t *));
2719 int (*get_memory_init) __P((DB_ENV *, DB_MEM_CONFIG, u_int32_t *));
2720 int (*get_memory_max) __P((DB_ENV *, u_int32_t *, u_int32_t *));
2721 int (*get_metadata_dir) __P((DB_ENV *, const char **));
2722 int (*get_mp_max_openfd) __P((DB_ENV *, int *));
2723 int (*get_mp_max_write) __P((DB_ENV *, int *, db_timeout_t *));
2724 int (*get_mp_mmapsize) __P((DB_ENV *, size_t *));
2725 int (*get_mp_mtxcount) __P((DB_ENV *, u_int32_t *));
2726 int (*get_mp_pagesize) __P((DB_ENV *, u_int32_t *));
2727 int (*get_mp_tablesize) __P((DB_ENV *, u_int32_t *));
2728 void (*get_msgcall) __P((DB_ENV *,
2729 void (**)(const DB_ENV *, const char *, const char *)));
2730 void (*get_msgfile) __P((DB_ENV *, FILE **));
2731 void (*get_msgpfx) __P((DB_ENV *, const char **));
2732 int (*get_open_flags) __P((DB_ENV *, u_int32_t *));
2733 int (*get_region_dir) __P((DB_ENV *, const char **));
2734 int (*get_slice_count) __P((DB_ENV *, u_int32_t *));
2735 int (*get_slices) __P((DB_ENV *, DB_ENV ***));
2736 int (*get_shm_key) __P((DB_ENV *, long *));
2737 int (*get_thread_count) __P((DB_ENV *, u_int32_t *));
2738 int (*get_thread_id_fn)
2739 __P((DB_ENV *, void (**)(DB_ENV *, pid_t *, db_threadid_t *)));
2740 int (*get_thread_id_string_fn) __P((DB_ENV *,
2741 char *(**)(DB_ENV *, pid_t, db_threadid_t, char *)));
2742 int (*get_timeout) __P((DB_ENV *, db_timeout_t *, u_int32_t));
2743 int (*get_tmp_dir) __P((DB_ENV *, const char **));
2744 int (*get_tx_max) __P((DB_ENV *, u_int32_t *));
2745 int (*get_tx_timestamp) __P((DB_ENV *, time_t *));
2746 int (*get_verbose) __P((DB_ENV *, u_int32_t, int *));
2747 int (*is_bigendian) __P((void));
2748 int (*lock_detect) __P((DB_ENV *, u_int32_t, u_int32_t, int *));
2749 int (*lock_get) __P((DB_ENV *,
2750 u_int32_t, u_int32_t, DBT *, db_lockmode_t, DB_LOCK *));
2751 int (*lock_id) __P((DB_ENV *, u_int32_t *));
2752 int (*lock_id_free) __P((DB_ENV *, u_int32_t));
2753 int (*lock_put) __P((DB_ENV *, DB_LOCK *));
2754 int (*lock_stat) __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t));
2755 int (*lock_stat_print) __P((DB_ENV *, u_int32_t));
2756 int (*lock_vec) __P((DB_ENV *,
2757 u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **));
2758 int (*log_archive) __P((DB_ENV *, char **[], u_int32_t));
2759 int (*log_cursor) __P((DB_ENV *, DB_LOGC **, u_int32_t));
2760 int (*log_file) __P((DB_ENV *, const DB_LSN *, char *, size_t));
2761 int (*log_flush) __P((DB_ENV *, const DB_LSN *));
2762 int (*log_get_config) __P((DB_ENV *, u_int32_t, int *));
2763 int (*log_printf) __P((DB_ENV *, DB_TXN *, const char *, ...));
2764 int (*log_put) __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t));
2765 int (*log_put_record) __P((DB_ENV *, DB *, DB_TXN *, DB_LSN *,
2766 u_int32_t, u_int32_t, u_int32_t, u_int32_t,
2767 DB_LOG_RECSPEC *, ...));
2768 int (*log_read_record) __P((DB_ENV *, DB **,
2769 void *, void *, DB_LOG_RECSPEC *, u_int32_t, void **));
2770 int (*log_set_config) __P((DB_ENV *, u_int32_t, int));
2771 int (*log_stat) __P((DB_ENV *, DB_LOG_STAT **, u_int32_t));
2772 int (*log_stat_print) __P((DB_ENV *, u_int32_t));
2773 int (*log_verify) __P((DB_ENV *, const DB_LOG_VERIFY_CONFIG *));
2774 int (*lsn_reset) __P((DB_ENV *, const char *, u_int32_t));
2775 int (*memp_fcreate) __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t));
2776 int (*memp_register) __P((DB_ENV *, int, int (*)(DB_ENV *, db_pgno_t,
2777 void *, DBT *), int (*)(DB_ENV *, db_pgno_t, void *, DBT *)));
2778 int (*memp_stat) __P((DB_ENV *,
2779 DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t));
2780 int (*memp_stat_print) __P((DB_ENV *, u_int32_t));
2781 int (*memp_sync) __P((DB_ENV *, DB_LSN *));
2782 int (*memp_trickle) __P((DB_ENV *, int, int *));
2783 void (*msg) __P((const DB_ENV *, const char *, ...));
2784 int (*mutex_alloc) __P((DB_ENV *, u_int32_t, db_mutex_t *));
2785 int (*mutex_free) __P((DB_ENV *, db_mutex_t));
2786 int (*mutex_get_align) __P((DB_ENV *, u_int32_t *));
2787 int (*mutex_get_increment) __P((DB_ENV *, u_int32_t *));
2788 int (*mutex_get_init) __P((DB_ENV *, u_int32_t *));
2789 int (*mutex_get_max) __P((DB_ENV *, u_int32_t *));
2790 int (*mutex_get_tas_spins) __P((DB_ENV *, u_int32_t *));
2791 int (*mutex_lock) __P((DB_ENV *, db_mutex_t));
2792 int (*mutex_set_align) __P((DB_ENV *, u_int32_t));
2793 int (*mutex_set_increment) __P((DB_ENV *, u_int32_t));
2794 int (*mutex_set_init) __P((DB_ENV *, u_int32_t));
2795 int (*mutex_set_max) __P((DB_ENV *, u_int32_t));
2796 int (*mutex_set_tas_spins) __P((DB_ENV *, u_int32_t));
2797 int (*mutex_stat) __P((DB_ENV *, DB_MUTEX_STAT **, u_int32_t));
2798 int (*mutex_stat_print) __P((DB_ENV *, u_int32_t));
2799 int (*mutex_unlock) __P((DB_ENV *, db_mutex_t));
2800 int (*open) __P((DB_ENV *, const char *, u_int32_t, int));
2801 int (*remove) __P((DB_ENV *, const char *, u_int32_t));
2802 int (*rep_elect) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t));
2803 int (*rep_flush) __P((DB_ENV *));
2804 int (*rep_get_clockskew) __P((DB_ENV *, u_int32_t *, u_int32_t *));
2805 int (*rep_get_config) __P((DB_ENV *, u_int32_t, int *));
2806 int (*rep_get_limit) __P((DB_ENV *, u_int32_t *, u_int32_t *));
2807 int (*rep_get_nsites) __P((DB_ENV *, u_int32_t *));
2808 int (*rep_get_priority) __P((DB_ENV *, u_int32_t *));
2809 int (*rep_get_request) __P((DB_ENV *, u_int32_t *, u_int32_t *));
2810 int (*rep_get_timeout) __P((DB_ENV *, int, u_int32_t *));
2811 int (*rep_process_message)
2812 __P((DB_ENV *, DBT *, DBT *, int, DB_LSN *));
2813 int (*rep_set_clockskew) __P((DB_ENV *, u_int32_t, u_int32_t));
2814 int (*rep_set_config) __P((DB_ENV *, u_int32_t, int));
2815 int (*rep_set_limit) __P((DB_ENV *, u_int32_t, u_int32_t));
2816 int (*rep_set_nsites) __P((DB_ENV *, u_int32_t));
2817 int (*rep_set_priority) __P((DB_ENV *, u_int32_t));
2818 int (*rep_set_request) __P((DB_ENV *, u_int32_t, u_int32_t));
2819 int (*rep_set_timeout) __P((DB_ENV *, int, db_timeout_t));
2820 int (*rep_set_transport) __P((DB_ENV *, int, int (*)(DB_ENV *,
2821 const DBT *, const DBT *, const DB_LSN *, int, u_int32_t)));
2822 int (*rep_set_view) __P((DB_ENV *, int (*)(DB_ENV *,
2823 const char *, int *, u_int32_t)));
2824 int (*rep_start) __P((DB_ENV *, DBT *, u_int32_t));
2825 int (*rep_stat) __P((DB_ENV *, DB_REP_STAT **, u_int32_t));
2826 int (*rep_stat_print) __P((DB_ENV *, u_int32_t));
2827 int (*rep_sync) __P((DB_ENV *, u_int32_t));
2828 int (*repmgr_channel) __P((DB_ENV *, int, DB_CHANNEL **, u_int32_t));
2829 int (*repmgr_get_ack_policy) __P((DB_ENV *, int *));
2830 int (*repmgr_get_incoming_queue_max)
2831 __P((DB_ENV *, u_int32_t *, u_int32_t *));
2832 int (*repmgr_local_site) __P((DB_ENV *, DB_SITE **));
2833 int (*repmgr_msg_dispatch) __P((DB_ENV *,
2834 void (*)(DB_ENV *, DB_CHANNEL *, DBT *, u_int32_t, u_int32_t),
2835 u_int32_t));
2836 int (*repmgr_set_ack_policy) __P((DB_ENV *, int));
2837 int (*repmgr_set_incoming_queue_max)
2838 __P((DB_ENV *, u_int32_t, u_int32_t));
2839 int (*repmgr_set_socket) __P((DB_ENV *, int (*)(DB_ENV *,
2840 DB_REPMGR_SOCKET, int *, u_int32_t)));
2841 int (*repmgr_set_ssl_config) __P((DB_ENV *, int, char *));
2842 int (*repmgr_site)
2843 __P((DB_ENV *, const char *, u_int, DB_SITE**, u_int32_t));
2844 int (*repmgr_site_by_eid) __P((DB_ENV *, int, DB_SITE**));
2845 int (*repmgr_site_list) __P((DB_ENV *, u_int *, DB_REPMGR_SITE **));
2846 int (*repmgr_start) __P((DB_ENV *, int, u_int32_t));
2847 int (*repmgr_stat) __P((DB_ENV *, DB_REPMGR_STAT **, u_int32_t));
2848 int (*repmgr_stat_print) __P((DB_ENV *, u_int32_t));
2849 int (*set_alloc) __P((DB_ENV *, void *(*)(size_t),
2850 void *(*)(void *, size_t), void (*)(void *)));
2851 int (*set_app_dispatch)
2852 __P((DB_ENV *, int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops)));
2853 int (*set_blob_dir) __P((DB_ENV *, const char *));
2854 int (*set_blob_threshold) __P((DB_ENV *, u_int32_t, u_int32_t));
2855 int (*set_cache_max) __P((DB_ENV *, u_int32_t, u_int32_t));
2856 int (*set_cachesize) __P((DB_ENV *, u_int32_t, u_int32_t, int));
2857 int (*set_create_dir) __P((DB_ENV *, const char *));
2858 int (*set_data_dir) __P((DB_ENV *, const char *));
2859 int (*set_data_len) __P((DB_ENV *, u_int32_t));
2860 int (*set_backup_callbacks) __P((DB_ENV *,
2861 int (*)(DB_ENV *, const char *, const char *, void **),
2862 int (*)(DB_ENV *, u_int32_t,
2863 u_int32_t, u_int32_t, u_int8_t *, void *),
2864 int (*)(DB_ENV *, const char *, void *)));
2865 int (*set_backup_config) __P((DB_ENV *, DB_BACKUP_CONFIG, u_int32_t));
2866 int (*set_encrypt) __P((DB_ENV *, const char *, u_int32_t));
2867 void (*set_errcall) __P((DB_ENV *,
2868 void (*)(const DB_ENV *, const char *, const char *)));
2869 void (*set_errfile) __P((DB_ENV *, FILE *));
2870 void (*set_errpfx) __P((DB_ENV *, const char *));
2871 int (*set_event_notify)
2872 __P((DB_ENV *, void (*)(DB_ENV *, u_int32_t, void *)));
2873 int (*set_ext_file_dir) __P((DB_ENV *, const char *));
2874 int (*set_ext_file_threshold) __P((DB_ENV *, u_int32_t, u_int32_t));
2875 int (*set_feedback) __P((DB_ENV *, void (*)(DB_ENV *, int, int)));
2876 int (*set_flags) __P((DB_ENV *, u_int32_t, int));
2877 int (*set_intermediate_dir_mode) __P((DB_ENV *, const char *));
2878 int (*set_isalive) __P((DB_ENV *,
2879 int (*)(DB_ENV *, pid_t, db_threadid_t, u_int32_t)));
2880 int (*set_lg_bsize) __P((DB_ENV *, u_int32_t));
2881 int (*set_lg_dir) __P((DB_ENV *, const char *));
2882 int (*set_lg_filemode) __P((DB_ENV *, int));
2883 int (*set_lg_max) __P((DB_ENV *, u_int32_t));
2884 int (*set_lg_regionmax) __P((DB_ENV *, u_int32_t));
2885 int (*set_lk_conflicts) __P((DB_ENV *, u_int8_t *, int));
2886 int (*set_lk_detect) __P((DB_ENV *, u_int32_t));
2887 int (*set_lk_max_lockers) __P((DB_ENV *, u_int32_t));
2888 int (*set_lk_max_locks) __P((DB_ENV *, u_int32_t));
2889 int (*set_lk_max_objects) __P((DB_ENV *, u_int32_t));
2890 int (*set_lk_partitions) __P((DB_ENV *, u_int32_t));
2891 int (*set_lk_priority) __P((DB_ENV *, u_int32_t, u_int32_t));
2892 int (*set_lk_tablesize) __P((DB_ENV *, u_int32_t));
2893 int (*set_memory_init) __P((DB_ENV *, DB_MEM_CONFIG, u_int32_t));
2894 int (*set_memory_max) __P((DB_ENV *, u_int32_t, u_int32_t));
2895 int (*set_metadata_dir) __P((DB_ENV *, const char *));
2896 int (*set_mp_max_openfd) __P((DB_ENV *, int));
2897 int (*set_mp_max_write) __P((DB_ENV *, int, db_timeout_t));
2898 int (*set_mp_mmapsize) __P((DB_ENV *, size_t));
2899 int (*set_mp_mtxcount) __P((DB_ENV *, u_int32_t));
2900 int (*set_mp_pagesize) __P((DB_ENV *, u_int32_t));
2901 int (*set_mp_tablesize) __P((DB_ENV *, u_int32_t));
2902 void (*set_msgcall) __P((DB_ENV *,
2903 void (*)(const DB_ENV *, const char *, const char *)));
2904 void (*set_msgfile) __P((DB_ENV *, FILE *));
2905 void (*set_msgpfx) __P((DB_ENV *, const char *));
2906 int (*set_paniccall) __P((DB_ENV *, void (*)(DB_ENV *, int)));
2907 int (*set_region_dir) __P((DB_ENV *, const char *));
2908 int (*set_shm_key) __P((DB_ENV *, long));
2909 int (*set_thread_count) __P((DB_ENV *, u_int32_t));
2910 int (*set_thread_id)
2911 __P((DB_ENV *, void (*)(DB_ENV *, pid_t *, db_threadid_t *)));
2912 int (*set_thread_id_string) __P((DB_ENV *,
2913 char *(*)(DB_ENV *, pid_t, db_threadid_t, char *)));
2914 int (*set_timeout) __P((DB_ENV *, db_timeout_t, u_int32_t));
2915 int (*set_tmp_dir) __P((DB_ENV *, const char *));
2916 int (*set_tx_max) __P((DB_ENV *, u_int32_t));
2917 int (*set_tx_timestamp) __P((DB_ENV *, time_t *));
2918 int (*set_verbose) __P((DB_ENV *, u_int32_t, int));
2919 int (*txn_applied) __P((DB_ENV *,
2920 DB_TXN_TOKEN *, db_timeout_t, u_int32_t));
2921 int (*stat_print) __P((DB_ENV *, u_int32_t));
2922 int (*txn_begin) __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t));
2923 int (*txn_checkpoint) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t));
2924 int (*txn_recover) __P((DB_ENV *,
2925 DB_PREPLIST *, long, long *, u_int32_t));
2926 int (*txn_stat) __P((DB_ENV *, DB_TXN_STAT **, u_int32_t));
2927 int (*txn_stat_print) __P((DB_ENV *, u_int32_t));
2928
2929
2930
2931 int (*prdbt) __P((DBT *, int, const char *, void *,
2932 int (*)(void *, const void *), int, int, int));
2933
2934 };
2935
2936
2937
2938
2939
2940
2941
2942
2943 struct __db_distab {
2944 int (**int_dispatch) __P((ENV *, DBT *, DB_LSN *, db_recops, void *));
2945 int (**ext_dispatch) __P((DB_ENV *, DBT *, DB_LSN *, db_recops));
2946 size_t int_size;
2947 size_t ext_size;
2948 };
2949
2950
2951
2952
2953 struct __db_logvrfy_config {
2954 int continue_after_fail;
2955 int verbose;
2956 u_int32_t cachesize;
2957 const char *temp_envhome;
2958 const char *dbfile;
2959 const char *dbname;
2960 DB_LSN start_lsn;
2961 DB_LSN end_lsn;
2962 time_t start_time;
2963 time_t end_time;
2964 };
2965
2966 struct __db_channel {
2967 CHANNEL *channel;
2968 int eid;
2969 db_timeout_t timeout;
2970
2971
2972 int (*close) __P((DB_CHANNEL *, u_int32_t));
2973 int (*send_msg) __P((DB_CHANNEL *, DBT *, u_int32_t, u_int32_t));
2974 int (*send_request) __P((DB_CHANNEL *,
2975 DBT *, u_int32_t, DBT *, db_timeout_t, u_int32_t));
2976 int (*set_timeout) __P((DB_CHANNEL *, db_timeout_t));
2977
2978 };
2979
2980 struct __db_site {
2981 ENV *env;
2982 int eid;
2983 const char *host;
2984 u_int port;
2985 u_int32_t flags;
2986
2987
2988 int (*get_address) __P((DB_SITE *, const char **, u_int *));
2989 int (*get_config) __P((DB_SITE *, u_int32_t, u_int32_t *));
2990 int (*get_eid) __P((DB_SITE *, int *));
2991 int (*set_config) __P((DB_SITE *, u_int32_t, u_int32_t));
2992 int (*remove) __P((DB_SITE *));
2993 int (*close) __P((DB_SITE *));
2994
2995 };
2996
2997 #if DB_DBM_HSEARCH != 0
2998
2999
3000
3001 typedef struct __db DBM;
3002
3003 #define DBM_INSERT 0
3004 #define DBM_REPLACE 1
3005
3006
3007
3008
3009
3010 #define DBM_SUFFIX ".db"
3011
3012 #if defined(_XPG4_2)
3013 typedef struct {
3014 char *dptr;
3015 size_t dsize;
3016 } datum;
3017 #else
3018 typedef struct {
3019 char *dptr;
3020 int dsize;
3021 } datum;
3022 #endif
3023
3024
3025
3026
3027
3028 #define dbm_clearerr(a) __db_ndbm_clearerr(a)
3029 #define dbm_close(a) __db_ndbm_close(a)
3030 #define dbm_delete(a, b) __db_ndbm_delete(a, b)
3031 #define dbm_dirfno(a) __db_ndbm_dirfno(a)
3032 #define dbm_error(a) __db_ndbm_error(a)
3033 #define dbm_fetch(a, b) __db_ndbm_fetch(a, b)
3034 #define dbm_firstkey(a) __db_ndbm_firstkey(a)
3035 #define dbm_nextkey(a) __db_ndbm_nextkey(a)
3036 #define dbm_open(a, b, c) __db_ndbm_open(a, b, c)
3037 #define dbm_pagfno(a) __db_ndbm_pagfno(a)
3038 #define dbm_rdonly(a) __db_ndbm_rdonly(a)
3039 #define dbm_store(a, b, c, d) \
3040 __db_ndbm_store(a, b, c, d)
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052 #define dbminit(a) __db_dbm_init(a)
3053 #define dbmclose __db_dbm_close
3054 #if !defined(__cplusplus)
3055 #define delete(a) __db_dbm_delete(a)
3056 #define store(a, b) __db_dbm_store(a, b)
3057 #endif
3058 #define fetch(a) __db_dbm_fetch(a)
3059 #define firstkey __db_dbm_firstkey
3060 #define nextkey(a) __db_dbm_nextkey(a)
3061
3062
3063
3064
3065 typedef enum {
3066 FIND, ENTER
3067 } ACTION;
3068
3069 typedef struct entry {
3070 char *key;
3071 char *data;
3072 } ENTRY;
3073
3074 #define hcreate(a) __db_hcreate(a)
3075 #define hdestroy __db_hdestroy
3076 #define hsearch(a, b) __db_hsearch(a, b)
3077
3078 #endif
3079
3080 #if defined(__cplusplus)
3081 }
3082 #endif
3083
3084
3085 #endif
3086
3087 #define DB_AGGRESSIVE 0x00000001
3088 #define DB_ARCH_ABS 0x00000001
3089 #define DB_ARCH_DATA 0x00000002
3090 #define DB_ARCH_LOG 0x00000004
3091 #define DB_ARCH_REMOVE 0x00000008
3092 #define DB_AUTO_COMMIT 0x00000100
3093 #define DB_BACKUP_CLEAN 0x00000002
3094 #define DB_BACKUP_DEEP_COPY 0x00000008
3095 #define DB_BACKUP_FILES 0x00000010
3096 #define DB_BACKUP_NO_LOGS 0x00000020
3097 #define DB_BACKUP_SINGLE_DIR 0x00000040
3098 #define DB_BACKUP_UPDATE 0x00000080
3099 #define DB_BOOTSTRAP_HELPER 0x00000001
3100 #define DB_CDB_ALLDB 0x00000040
3101 #define DB_CHKSUM 0x00000008
3102 #define DB_CKP_INTERNAL 0x00000002
3103 #define DB_CONVERT 0x00000001
3104 #define DB_CREATE 0x00000001
3105 #define DB_CURSOR_BULK 0x00000001
3106 #define DB_CURSOR_TRANSIENT 0x00000008
3107 #define DB_CXX_NO_EXCEPTIONS 0x00000002
3108 #define DB_DATABASE_LOCKING 0x00000080
3109 #define DB_DIRECT 0x00000020
3110 #define DB_DIRECT_DB 0x00000200
3111 #define DB_DSYNC_DB 0x00000400
3112 #define DB_DUP 0x00000010
3113 #define DB_DUPSORT 0x00000002
3114 #define DB_DURABLE_UNKNOWN 0x00000040
3115 #define DB_ENCRYPT 0x00000001
3116 #define DB_ENCRYPT_AES 0x00000001
3117 #define DB_EXCL 0x00000004
3118 #define DB_EXTENT 0x00000100
3119 #define DB_FAILCHK 0x00000010
3120 #define DB_FAILCHK_ISALIVE 0x00000040
3121 #define DB_FAST_STAT 0x00000001
3122 #define DB_FCNTL_LOCKING 0x00001000
3123 #define DB_FLUSH 0x00000002
3124 #define DB_FORCE 0x00000001
3125 #define DB_FORCESYNC 0x00000001
3126 #define DB_FORCESYNCENV 0x00000002
3127 #define DB_FOREIGN_ABORT 0x00000001
3128 #define DB_FOREIGN_CASCADE 0x00000002
3129 #define DB_FOREIGN_NULLIFY 0x00000004
3130 #define DB_FREELIST_ONLY 0x00000001
3131 #define DB_FREE_SPACE 0x00000002
3132 #define DB_GROUP_CREATOR 0x00000002
3133 #define DB_HOTBACKUP_IN_PROGRESS 0x00000800
3134 #define DB_IGNORE_LEASE 0x00001000
3135 #define DB_IMMUTABLE_KEY 0x00000002
3136 #define DB_INIT_CDB 0x00000080
3137 #define DB_INIT_LOCK 0x00000100
3138 #define DB_INIT_LOG 0x00000200
3139 #define DB_INIT_MPOOL 0x00000400
3140 #define DB_INIT_MUTEX 0x00000800
3141 #define DB_INIT_REP 0x00001000
3142 #define DB_INIT_TXN 0x00002000
3143 #define DB_INORDER 0x00000020
3144 #define DB_INTERNAL_BLOB_DB 0x00002000
3145 #define DB_INTERNAL_PERSISTENT_DB 0x00004000
3146 #define DB_INTERNAL_TEMPORARY_DB 0x00008000
3147 #define DB_JOIN_NOSORT 0x00000001
3148 #define DB_LEGACY 0x00000004
3149 #define DB_LOCAL_SITE 0x00000008
3150 #define DB_LOCKDOWN 0x00004000
3151 #define DB_LOCK_CHECK 0x00000001
3152 #define DB_LOCK_IGNORE_REC 0x00000002
3153 #define DB_LOCK_NOWAIT 0x00000004
3154 #define DB_LOCK_RECORD 0x00000008
3155 #define DB_LOCK_SET_TIMEOUT 0x00000010
3156 #define DB_LOCK_SWITCH 0x00000020
3157 #define DB_LOCK_UPGRADE 0x00000040
3158 #define DB_LOG_AUTO_REMOVE 0x00000001
3159 #define DB_LOG_CHKPNT 0x00000001
3160 #define DB_LOG_COMMIT 0x00000004
3161 #define DB_LOG_DIRECT 0x00000002
3162 #define DB_LOG_DSYNC 0x00000004
3163 #define DB_LOG_EXT_FILE 0x00000008
3164 #define DB_LOG_BLOB 0x00000008
3165 #define DB_LOG_IN_MEMORY 0x00000010
3166 #define DB_LOG_NOCOPY 0x00000008
3167 #define DB_LOG_NOSYNC 0x00000020
3168 #define DB_LOG_NOT_DURABLE 0x00000010
3169 #define DB_LOG_NO_DATA 0x00000002
3170 #define DB_LOG_VERIFY_CAF 0x00000001
3171 #define DB_LOG_VERIFY_DBFILE 0x00000002
3172 #define DB_LOG_VERIFY_ERR 0x00000004
3173 #define DB_LOG_VERIFY_FORWARD 0x00000008
3174 #define DB_LOG_VERIFY_INTERR 0x00000010
3175 #define DB_LOG_VERIFY_PARTIAL 0x00000020
3176 #define DB_LOG_VERIFY_VERBOSE 0x00000040
3177 #define DB_LOG_VERIFY_WARNING 0x00000080
3178 #define DB_LOG_WRNOSYNC 0x00000020
3179 #define DB_LOG_ZERO 0x00000040
3180 #define DB_MPOOL_CREATE 0x00000001
3181 #define DB_MPOOL_DIRTY 0x00000002
3182 #define DB_MPOOL_DISCARD 0x00000001
3183 #define DB_MPOOL_EDIT 0x00000004
3184 #define DB_MPOOL_FREE 0x00000008
3185 #define DB_MPOOL_LAST 0x00000010
3186 #define DB_MPOOL_NEW 0x00000020
3187 #define DB_MPOOL_NOFILE 0x00000001
3188 #define DB_MPOOL_NOLOCK 0x00000004
3189 #define DB_MPOOL_TRY 0x00000040
3190 #define DB_MPOOL_UNLINK 0x00000002
3191 #define DB_MULTIPLE 0x00000800
3192 #define DB_MULTIPLE_KEY 0x00004000
3193 #define DB_MULTIVERSION 0x00000008
3194 #define DB_MUTEX_ALLOCATED 0x00000001
3195 #define DB_MUTEX_LOCKED 0x00000002
3196 #define DB_MUTEX_LOGICAL_LOCK 0x00000004
3197 #define DB_MUTEX_OWNER_DEAD 0x00000020
3198 #define DB_MUTEX_PROCESS_ONLY 0x00000008
3199 #define DB_MUTEX_SELF_BLOCK 0x00000010
3200 #define DB_MUTEX_SHARED 0x00000040
3201 #define DB_NOERROR 0x00010000
3202 #define DB_NOFLUSH 0x00001000
3203 #define DB_NOLOCKING 0x00002000
3204 #define DB_NOMMAP 0x00000010
3205 #define DB_NOORDERCHK 0x00000002
3206 #define DB_NOPANIC 0x00004000
3207 #define DB_NOSYNC 0x00000001
3208 #define DB_NO_AUTO_COMMIT 0x00020000
3209 #define DB_NO_CHECKPOINT 0x00008000
3210 #define DB_ODDFILESIZE 0x00000080
3211 #define DB_ORDERCHKONLY 0x00000004
3212 #define DB_OVERWRITE 0x00008000
3213 #define DB_PANIC_ENVIRONMENT 0x00010000
3214 #define DB_PRINTABLE 0x00000008
3215 #define DB_PRIVATE 0x00010000
3216 #define DB_PR_PAGE 0x00000010
3217 #define DB_PR_RECOVERYTEST 0x00000020
3218 #define DB_RDONLY 0x00000400
3219 #define DB_RDWRMASTER 0x00040000
3220 #define DB_READ_COMMITTED 0x00000400
3221 #define DB_READ_UNCOMMITTED 0x00000200
3222 #define DB_RECNUM 0x00000040
3223 #define DB_RECOVER 0x00000002
3224 #define DB_RECOVER_FATAL 0x00020000
3225 #define DB_REGION_INIT 0x00020000
3226 #define DB_REGISTER 0x00040000
3227 #define DB_RENUMBER 0x00000080
3228 #define DB_REPMGR_CONF_2SITE_STRICT 0x00000001
3229 #define DB_REPMGR_CONF_DISABLE_POLL 0x00000002
3230 #define DB_REPMGR_CONF_DISABLE_SSL 0x00000004
3231 #define DB_REPMGR_CONF_ELECTIONS 0x00000008
3232 #define DB_REPMGR_CONF_ENABLE_EPOLL 0x00000010
3233 #define DB_REPMGR_CONF_FORWARD_WRITES 0x00000020
3234 #define DB_REPMGR_CONF_PREFMAS_CLIENT 0x00000040
3235 #define DB_REPMGR_CONF_PREFMAS_MASTER 0x00000080
3236 #define DB_REPMGR_NEED_RESPONSE 0x00000001
3237 #define DB_REPMGR_PEER 0x00000010
3238 #define DB_REP_ANYWHERE 0x00000001
3239 #define DB_REP_CLIENT 0x00000001
3240 #define DB_REP_CONF_AUTOINIT 0x00000100
3241 #define DB_REP_CONF_AUTOROLLBACK 0x00000200
3242 #define DB_REP_CONF_BULK 0x00000400
3243 #define DB_REP_CONF_DELAYCLIENT 0x00000800
3244 #define DB_REP_CONF_ELECT_LOGLENGTH 0x00001000
3245 #define DB_REP_CONF_INMEM 0x00002000
3246 #define DB_REP_CONF_LEASE 0x00004000
3247 #define DB_REP_CONF_NOWAIT 0x00008000
3248 #define DB_REP_ELECTION 0x00000004
3249 #define DB_REP_MASTER 0x00000002
3250 #define DB_REP_NOBUFFER 0x00000002
3251 #define DB_REP_PERMANENT 0x00000004
3252 #define DB_REP_REREQUEST 0x00000008
3253 #define DB_REVSPLITOFF 0x00000100
3254 #define DB_RMW 0x00002000
3255 #define DB_SALVAGE 0x00000040
3256 #define DB_SA_SKIPFIRSTKEY 0x00000080
3257 #define DB_SA_UNKNOWNKEY 0x00000100
3258 #define DB_SEQ_DEC 0x00000001
3259 #define DB_SEQ_INC 0x00000002
3260 #define DB_SEQ_RANGE_SET 0x00000004
3261 #define DB_SEQ_WRAP 0x00000008
3262 #define DB_SEQ_WRAPPED 0x00000010
3263 #define DB_SET_LOCK_TIMEOUT 0x00000001
3264 #define DB_SET_MUTEX_FAILCHK_TIMEOUT 0x00000004
3265 #define DB_SET_REG_TIMEOUT 0x00000008
3266 #define DB_SET_TXN_NOW 0x00000010
3267 #define DB_SET_TXN_TIMEOUT 0x00000002
3268 #define DB_SHALLOW_DUP 0x00000100
3269 #define DB_SLICED 0x00000800
3270 #define DB_SNAPSHOT 0x00000200
3271 #define DB_STAT_ALL 0x00000004
3272 #define DB_STAT_ALLOC 0x00000008
3273 #define DB_STAT_CLEAR 0x00000001
3274 #define DB_STAT_LOCK_CONF 0x00000010
3275 #define DB_STAT_LOCK_LOCKERS 0x00000020
3276 #define DB_STAT_LOCK_OBJECTS 0x00000040
3277 #define DB_STAT_LOCK_PARAMS 0x00000080
3278 #define DB_STAT_MEMP_HASH 0x00000010
3279 #define DB_STAT_MEMP_NOERROR 0x00000020
3280 #define DB_STAT_SUBSYSTEM 0x00000002
3281 #define DB_STAT_SUMMARY 0x00000010
3282 #define DB_ST_DUPOK 0x00000200
3283 #define DB_ST_DUPSET 0x00000400
3284 #define DB_ST_DUPSORT 0x00000800
3285 #define DB_ST_IS_RECNO 0x00001000
3286 #define DB_ST_OVFL_LEAF 0x00002000
3287 #define DB_ST_RECNUM 0x00004000
3288 #define DB_ST_RELEN 0x00008000
3289 #define DB_ST_TOPLEVEL 0x00010000
3290 #define DB_SYSTEM_MEM 0x00080000
3291 #define DB_THREAD 0x00000020
3292 #define DB_TIME_NOTGRANTED 0x00040000
3293 #define DB_TRUNCATE 0x00080000
3294 #define DB_TXN_BULK 0x00000010
3295 #define DB_TXN_DISPATCH 0x00000040
3296 #define DB_TXN_FAMILY 0x00000080
3297 #define DB_TXN_NOSYNC 0x00000001
3298 #define DB_TXN_NOT_DURABLE 0x00000004
3299 #define DB_TXN_NOWAIT 0x00000002
3300 #define DB_TXN_SNAPSHOT 0x00000004
3301 #define DB_TXN_SYNC 0x00000008
3302 #define DB_TXN_WAIT 0x00000100
3303 #define DB_TXN_WRITE_NOSYNC 0x00000020
3304 #define DB_UNREF 0x00020000
3305 #define DB_UPGRADE 0x00000002
3306 #define DB_USE_ENVIRON 0x00000004
3307 #define DB_USE_ENVIRON_ROOT 0x00000008
3308 #define DB_VERB_BACKUP 0x00000001
3309 #define DB_VERB_DEADLOCK 0x00000002
3310 #define DB_VERB_FILEOPS 0x00000004
3311 #define DB_VERB_FILEOPS_ALL 0x00000008
3312 #define DB_VERB_MVCC 0x00000010
3313 #define DB_VERB_RECOVERY 0x00000020
3314 #define DB_VERB_REGISTER 0x00000040
3315 #define DB_VERB_REPLICATION 0x00000080
3316 #define DB_VERB_REPMGR_CONNFAIL 0x00000100
3317 #define DB_VERB_REPMGR_MISC 0x00000200
3318 #define DB_VERB_REPMGR_SSL_ALL 0x00000400
3319 #define DB_VERB_REPMGR_SSL_CONN 0x00000800
3320 #define DB_VERB_REPMGR_SSL_IO 0x00001000
3321 #define DB_VERB_REP_ELECT 0x00002000
3322 #define DB_VERB_REP_LEASE 0x00004000
3323 #define DB_VERB_REP_MISC 0x00008000
3324 #define DB_VERB_REP_MSGS 0x00010000
3325 #define DB_VERB_REP_SYNC 0x00020000
3326 #define DB_VERB_REP_SYSTEM 0x00040000
3327 #define DB_VERB_REP_TEST 0x00080000
3328 #define DB_VERB_SLICE 0x00100000
3329 #define DB_VERB_WAITSFOR 0x00200000
3330 #define DB_VERIFY 0x00000004
3331 #define DB_VERIFY_PARTITION 0x00040000
3332 #define DB_WRITECURSOR 0x00000010
3333 #define DB_WRITELOCK 0x00000020
3334 #define DB_WRITEOPEN 0x00100000
3335 #define DB_XA_CREATE 0x00000001
3336 #define DB_YIELDCPU 0x00080000
3337
3338
3339 #ifndef _DB_EXT_PROT_IN_
3340 #define _DB_EXT_PROT_IN_
3341
3342 #if defined(__cplusplus)
3343 extern "C" {
3344 #endif
3345
3346 int db_copy __P((DB_ENV *, const char *, const char *, const char *));
3347 int db_create __P((DB **, DB_ENV *, u_int32_t));
3348 char *db_strerror __P((int));
3349 int db_env_set_func_assert __P((void (*)(const char *, const char *, int)));
3350 int db_env_set_func_close __P((int (*)(int)));
3351 int db_env_set_func_dirfree __P((void (*)(char **, int)));
3352 int db_env_set_func_dirlist __P((int (*)(const char *, char ***, int *)));
3353 int db_env_set_func_exists __P((int (*)(const char *, int *)));
3354 int db_env_set_func_free __P((void (*)(void *)));
3355 int db_env_set_func_fsync __P((int (*)(int)));
3356 int db_env_set_func_ftruncate __P((int (*)(int, off_t)));
3357 int db_env_set_func_ioinfo __P((int (*)(const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)));
3358 int db_env_set_func_malloc __P((void *(*)(size_t)));
3359 int db_env_set_func_file_map __P((int (*)(DB_ENV *, char *, size_t, int, void **), int (*)(DB_ENV *, void *)));
3360 int db_env_set_func_region_map __P((int (*)(DB_ENV *, char *, size_t, int *, void **), int (*)(DB_ENV *, void *)));
3361 int db_env_set_func_pread __P((ssize_t (*)(int, void *, size_t, off_t)));
3362 int db_env_set_func_pwrite __P((ssize_t (*)(int, const void *, size_t, off_t)));
3363 int db_env_set_func_open __P((int (*)(const char *, int, ...)));
3364 int db_env_set_func_read __P((ssize_t (*)(int, void *, size_t)));
3365 int db_env_set_func_realloc __P((void *(*)(void *, size_t)));
3366 int db_env_set_func_rename __P((int (*)(const char *, const char *)));
3367 int db_env_set_func_seek __P((int (*)(int, off_t, int)));
3368 int db_env_set_func_unlink __P((int (*)(const char *)));
3369 int db_env_set_func_write __P((ssize_t (*)(int, const void *, size_t)));
3370 int db_env_set_func_yield __P((int (*)(u_long, u_long)));
3371 int db_env_create __P((DB_ENV **, u_int32_t));
3372 char *db_version __P((int *, int *, int *));
3373 char *db_full_version __P((int *, int *, int *, int *, int *));
3374 int log_compare __P((const DB_LSN *, const DB_LSN *));
3375 #if defined(DB_WIN32) && !defined(DB_WINCE)
3376 int db_env_set_win_security __P((SECURITY_ATTRIBUTES *sa));
3377 #endif
3378 int db_sequence_create __P((DB_SEQUENCE **, DB *, u_int32_t));
3379 #if DB_DBM_HSEARCH != 0
3380 int __db_ndbm_clearerr __P((DBM *));
3381 void __db_ndbm_close __P((DBM *));
3382 int __db_ndbm_delete __P((DBM *, datum));
3383 int __db_ndbm_dirfno __P((DBM *));
3384 int __db_ndbm_error __P((DBM *));
3385 datum __db_ndbm_fetch __P((DBM *, datum));
3386 datum __db_ndbm_firstkey __P((DBM *));
3387 datum __db_ndbm_nextkey __P((DBM *));
3388 DBM *__db_ndbm_open __P((const char *, int, int));
3389 int __db_ndbm_pagfno __P((DBM *));
3390 int __db_ndbm_rdonly __P((DBM *));
3391 int __db_ndbm_store __P((DBM *, datum, datum, int));
3392 int __db_dbm_close __P((void));
3393 int __db_dbm_delete __P((datum));
3394 datum __db_dbm_fetch __P((datum));
3395 datum __db_dbm_firstkey __P((void));
3396 int __db_dbm_init __P((char *));
3397 datum __db_dbm_nextkey __P((datum));
3398 int __db_dbm_store __P((datum, datum));
3399 #endif
3400 #if DB_DBM_HSEARCH != 0
3401 int __db_hcreate __P((size_t));
3402 ENTRY *__db_hsearch __P((ENTRY, ACTION));
3403 void __db_hdestroy __P((void));
3404 #endif
3405
3406 #if defined(__cplusplus)
3407 }
3408 #endif
3409 #endif