00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _DB_H_
00023 #define _DB_H_
00024
00025 #ifndef __NO_SYSTEM_INCLUDES
00026 #include <sys/types.h>
00027 #include <stddef.h>
00028 #include <stdio.h>
00029 #endif
00030
00031 #if defined(__cplusplus)
00032 extern "C" {
00033 #endif
00034
00035
00036 #undef __P
00037 #define __P(protos) protos
00038
00039
00040
00041
00042 #define DB_VERSION_MAJOR 4
00043 #define DB_VERSION_MINOR 4
00044 #define DB_VERSION_PATCH 16
00045 #define DB_VERSION_STRING "Sleepycat Software: Berkeley DB 4.4.16: (November 12, 2005)"
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #ifndef __BIT_TYPES_DEFINED__
00061 #define __BIT_TYPES_DEFINED__
00062 typedef unsigned char u_int8_t;
00063 typedef short int16_t;
00064 typedef unsigned short u_int16_t;
00065 typedef int int32_t;
00066 typedef unsigned int u_int32_t;
00067 typedef __int64 int64_t;
00068 typedef unsigned __int64 u_int64_t;
00069 #endif
00070
00071 #ifndef _WINSOCKAPI_
00072 typedef unsigned char u_char;
00073 typedef unsigned short u_short;
00074 typedef unsigned int u_int;
00075 typedef unsigned long u_long;
00076 #endif
00077 #ifdef _WIN64
00078 typedef int64_t ssize_t;
00079 #else
00080 typedef int32_t ssize_t;
00081 #endif
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 typedef u_int64_t uintmax_t;
00100 #ifdef _WIN64
00101 typedef u_int64_t uintptr_t;
00102 #else
00103 typedef u_int32_t uintptr_t;
00104 #endif
00105
00106
00107
00108
00109 typedef int64_t db_seq_t;
00110
00111
00112 typedef u_int32_t db_threadid_t;
00113 typedef int pid_t;
00114
00115
00116 typedef u_int32_t db_pgno_t;
00117 typedef u_int16_t db_indx_t;
00118 #define DB_MAX_PAGES 0xffffffff
00119
00120 typedef u_int32_t db_recno_t;
00121 #define DB_MAX_RECORDS 0xffffffff
00122
00123 typedef u_int32_t db_timeout_t;
00124
00125
00126
00127
00128
00129
00130
00131
00132 typedef uintptr_t roff_t;
00133
00134
00135
00136
00137
00138 struct __db; typedef struct __db DB;
00139 struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT;
00140 struct __db_cipher; typedef struct __db_cipher DB_CIPHER;
00141 struct __db_compact; typedef struct __db_compact DB_COMPACT;
00142 struct __db_dbt; typedef struct __db_dbt DBT;
00143 struct __db_env; typedef struct __db_env DB_ENV;
00144 struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT;
00145 struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK;
00146 struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT;
00147 struct __db_lock_u; typedef struct __db_lock_u DB_LOCK;
00148 struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ;
00149 struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC;
00150 struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT;
00151 struct __db_lsn; typedef struct __db_lsn DB_LSN;
00152 struct __db_mpool; typedef struct __db_mpool DB_MPOOL;
00153 struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT;
00154 struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT;
00155 struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE;
00156 struct __db_mutex_stat; typedef struct __db_mutex_stat DB_MUTEX_STAT;
00157 struct __db_preplist; typedef struct __db_preplist DB_PREPLIST;
00158 struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT;
00159 struct __db_rep; typedef struct __db_rep DB_REP;
00160 struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT;
00161 struct __db_seq_record; typedef struct __db_seq_record DB_SEQ_RECORD;
00162 struct __db_seq_stat; typedef struct __db_seq_stat DB_SEQUENCE_STAT;
00163 struct __db_sequence; typedef struct __db_sequence DB_SEQUENCE;
00164 struct __db_txn; typedef struct __db_txn DB_TXN;
00165 struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE;
00166 struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT;
00167 struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR;
00168 struct __dbc; typedef struct __dbc DBC;
00169 struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL;
00170 struct __fh_t; typedef struct __fh_t DB_FH;
00171 struct __fname; typedef struct __fname FNAME;
00172 struct __key_range; typedef struct __key_range DB_KEY_RANGE;
00173 struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE;
00174
00175
00176 struct __db_dbt {
00177 void *data;
00178 u_int32_t size;
00179
00180 u_int32_t ulen;
00181 u_int32_t dlen;
00182 u_int32_t doff;
00183
00184 #define DB_DBT_APPMALLOC 0x001
00185 #define DB_DBT_ISSET 0x002
00186 #define DB_DBT_MALLOC 0x004
00187 #define DB_DBT_PARTIAL 0x008
00188 #define DB_DBT_REALLOC 0x010
00189 #define DB_DBT_USERMEM 0x020
00190 #define DB_DBT_DUPOK 0x040
00191 u_int32_t flags;
00192 };
00193
00194
00195
00196
00197
00198
00199 #define DB_CREATE 0x0000001
00200 #define DB_DURABLE_UNKNOWN 0x0000002
00201 #define DB_FORCE 0x0000004
00202 #define DB_NOMMAP 0x0000008
00203 #define DB_RDONLY 0x0000010
00204 #define DB_RECOVER 0x0000020
00205 #define DB_THREAD 0x0000040
00206 #define DB_TRUNCATE 0x0000080
00207 #define DB_TXN_NOSYNC 0x0000100
00208 #define DB_TXN_NOT_DURABLE 0x0000200
00209 #define DB_TXN_WRITE_NOSYNC 0x0000400
00210 #define DB_USE_ENVIRON 0x0000800
00211 #define DB_USE_ENVIRON_ROOT 0x0001000
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 #define DB_AUTO_COMMIT 0x01000000
00234
00235 #define DB_READ_COMMITTED 0x02000000
00236 #define DB_DEGREE_2 0x02000000
00237
00238 #define DB_READ_UNCOMMITTED 0x04000000
00239 #define DB_DIRTY_READ 0x04000000
00240
00241
00242
00243
00244 #define DB_CXX_NO_EXCEPTIONS 0x0000001
00245
00246
00247
00248
00249 #define DB_RPCCLIENT 0x0000002
00250
00251
00252
00253
00254 #define DB_XA_CREATE 0x0000002
00255
00256
00257
00258
00259 #define DB_INIT_CDB 0x0002000
00260 #define DB_INIT_LOCK 0x0004000
00261 #define DB_INIT_LOG 0x0008000
00262 #define DB_INIT_MPOOL 0x0010000
00263 #define DB_INIT_REP 0x0020000
00264 #define DB_INIT_TXN 0x0040000
00265 #define DB_LOCKDOWN 0x0080000
00266 #define DB_PRIVATE 0x0100000
00267 #define DB_RECOVER_FATAL 0x0200000
00268 #define DB_REGISTER 0x0400000
00269 #define DB_SYSTEM_MEM 0x0800000
00270
00271 #define DB_JOINENV 0x0
00272
00273
00274
00275
00276 #define DB_EXCL 0x0002000
00277 #define DB_FCNTL_LOCKING 0x0004000
00278 #define DB_NO_AUTO_COMMIT 0x0008000
00279 #define DB_RDWRMASTER 0x0010000
00280 #define DB_WRITEOPEN 0x0020000
00281
00282
00283
00284
00285 #define DB_IMMUTABLE_KEY 0x0002000
00286
00287
00288
00289
00290
00291 #define DB_TXN_NOWAIT 0x0002000
00292 #define DB_TXN_SYNC 0x0004000
00293
00294
00295
00296
00297 #define DB_ENCRYPT_AES 0x0000001
00298
00299
00300
00301
00302 #define DB_CDB_ALLDB 0x00002000
00303 #define DB_DIRECT_DB 0x00004000
00304 #define DB_DIRECT_LOG 0x00008000
00305 #define DB_DSYNC_DB 0x00010000
00306 #define DB_DSYNC_LOG 0x00020000
00307 #define DB_LOG_AUTOREMOVE 0x00040000
00308 #define DB_LOG_INMEMORY 0x00080000
00309 #define DB_NOLOCKING 0x00100000
00310 #define DB_NOPANIC 0x00200000
00311 #define DB_OVERWRITE 0x00400000
00312 #define DB_PANIC_ENVIRONMENT 0x00800000
00313
00314
00315
00316 #define DB_REGION_INIT 0x08000000
00317 #define DB_TIME_NOTGRANTED 0x10000000
00318 #define DB_YIELDCPU 0x20000000
00319
00320
00321
00322
00323 #define DB_UPGRADE 0x0000001
00324 #define DB_VERIFY 0x0000002
00325
00326
00327
00328
00329
00330 #define DB_FREELIST_ONLY 0x00002000
00331 #define DB_FREE_SPACE 0x00004000
00332 #define DB_COMPACT_FLAGS \
00333 (DB_FREELIST_ONLY | DB_FREE_SPACE)
00334
00335
00336
00337
00338 #define DB_DIRECT 0x0002000
00339 #define DB_EXTENT 0x0004000
00340 #define DB_ODDFILESIZE 0x0008000
00341
00342
00343
00344
00345 #define DB_CHKSUM 0x00002000
00346 #define DB_DUP 0x00004000
00347 #define DB_DUPSORT 0x00008000
00348 #define DB_ENCRYPT 0x00010000
00349 #define DB_INORDER 0x00020000
00350 #define DB_RECNUM 0x00040000
00351 #define DB_RENUMBER 0x00080000
00352 #define DB_REVSPLITOFF 0x00100000
00353 #define DB_SNAPSHOT 0x00200000
00354
00355
00356
00357
00358 #define DB_STAT_ALL 0x0000001
00359 #define DB_STAT_CLEAR 0x0000002
00360 #define DB_STAT_LOCK_CONF 0x0000004
00361 #define DB_STAT_LOCK_LOCKERS 0x0000008
00362 #define DB_STAT_LOCK_OBJECTS 0x0000010
00363 #define DB_STAT_LOCK_PARAMS 0x0000020
00364 #define DB_STAT_MEMP_HASH 0x0000040
00365 #define DB_STAT_SUBSYSTEM 0x0000080
00366
00367
00368
00369
00370 #define DB_JOIN_NOSORT 0x0000001
00371
00372
00373
00374
00375 #define DB_AGGRESSIVE 0x0000001
00376 #define DB_NOORDERCHK 0x0000002
00377 #define DB_ORDERCHKONLY 0x0000004
00378 #define DB_PR_PAGE 0x0000008
00379 #define DB_PR_RECOVERYTEST 0x0000010
00380 #define DB_PRINTABLE 0x0000020
00381 #define DB_SALVAGE 0x0000040
00382 #define DB_UNREF 0x0000080
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392 #define DB_REP_ANYWHERE 0x0000001
00393 #define DB_REP_NOBUFFER 0x0000002
00394 #define DB_REP_PERMANENT 0x0000004
00395 #define DB_REP_REREQUEST 0x0000008
00396
00397
00398
00399
00400 typedef u_int32_t db_mutex_t;
00401
00402
00403
00404
00405 #define DB_MUTEX_ALLOCATED 0x01
00406 #define DB_MUTEX_LOCKED 0x02
00407 #define DB_MUTEX_LOGICAL_LOCK 0x04
00408 #define DB_MUTEX_SELF_BLOCK 0x08
00409 #define DB_MUTEX_THREAD 0x10
00410
00411 struct __db_mutex_stat {
00412
00413 u_int32_t st_mutex_align;
00414 u_int32_t st_mutex_tas_spins;
00415 u_int32_t st_mutex_cnt;
00416 u_int32_t st_mutex_free;
00417 u_int32_t st_mutex_inuse;
00418 u_int32_t st_mutex_inuse_max;
00419
00420
00421 u_int32_t st_region_wait;
00422 u_int32_t st_region_nowait;
00423 roff_t st_regsize;
00424 };
00425
00426
00427 #define DB_THREADID_STRLEN 128
00428
00429
00430
00431
00432 #define DB_LOCKVERSION 1
00433
00434 #define DB_FILE_ID_LEN 20
00435
00436
00437
00438
00439
00440 #define DB_LOCK_NORUN 0
00441 #define DB_LOCK_DEFAULT 1
00442 #define DB_LOCK_EXPIRE 2
00443 #define DB_LOCK_MAXLOCKS 3
00444 #define DB_LOCK_MAXWRITE 4
00445 #define DB_LOCK_MINLOCKS 5
00446 #define DB_LOCK_MINWRITE 6
00447 #define DB_LOCK_OLDEST 7
00448 #define DB_LOCK_RANDOM 8
00449 #define DB_LOCK_YOUNGEST 9
00450
00451
00452 #define DB_LOCK_ABORT 0x001
00453 #define DB_LOCK_NOWAIT 0x002
00454 #define DB_LOCK_RECORD 0x004
00455 #define DB_LOCK_SET_TIMEOUT 0x008
00456 #define DB_LOCK_SWITCH 0x010
00457 #define DB_LOCK_UPGRADE 0x020
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467 typedef enum {
00468 DB_LOCK_NG=0,
00469 DB_LOCK_READ=1,
00470 DB_LOCK_WRITE=2,
00471 DB_LOCK_WAIT=3,
00472 DB_LOCK_IWRITE=4,
00473 DB_LOCK_IREAD=5,
00474 DB_LOCK_IWR=6,
00475 DB_LOCK_READ_UNCOMMITTED=7,
00476 DB_LOCK_WWRITE=8
00477 } db_lockmode_t;
00478
00479
00480
00481
00482 typedef enum {
00483 DB_LOCK_DUMP=0,
00484 DB_LOCK_GET=1,
00485 DB_LOCK_GET_TIMEOUT=2,
00486 DB_LOCK_INHERIT=3,
00487 DB_LOCK_PUT=4,
00488 DB_LOCK_PUT_ALL=5,
00489 DB_LOCK_PUT_OBJ=6,
00490 DB_LOCK_PUT_READ=7,
00491 DB_LOCK_TIMEOUT=8,
00492 DB_LOCK_TRADE=9,
00493 DB_LOCK_UPGRADE_WRITE=10
00494 } db_lockop_t;
00495
00496
00497
00498
00499 typedef enum {
00500 DB_LSTAT_ABORTED=1,
00501 DB_LSTAT_EXPIRED=2,
00502 DB_LSTAT_FREE=3,
00503 DB_LSTAT_HELD=4,
00504 DB_LSTAT_PENDING=5,
00505
00506
00507 DB_LSTAT_WAITING=6
00508 }db_status_t;
00509
00510
00511 struct __db_lock_stat {
00512 u_int32_t st_id;
00513 u_int32_t st_cur_maxid;
00514 u_int32_t st_maxlocks;
00515 u_int32_t st_maxlockers;
00516 u_int32_t st_maxobjects;
00517 int st_nmodes;
00518 u_int32_t st_nlocks;
00519 u_int32_t st_maxnlocks;
00520 u_int32_t st_nlockers;
00521 u_int32_t st_maxnlockers;
00522 u_int32_t st_nobjects;
00523 u_int32_t st_maxnobjects;
00524 u_int32_t st_nrequests;
00525 u_int32_t st_nreleases;
00526 u_int32_t st_nupgrade;
00527 u_int32_t st_ndowngrade;
00528 u_int32_t st_lock_wait;
00529 u_int32_t st_lock_nowait;
00530 u_int32_t st_ndeadlocks;
00531 db_timeout_t st_locktimeout;
00532 u_int32_t st_nlocktimeouts;
00533 db_timeout_t st_txntimeout;
00534 u_int32_t st_ntxntimeouts;
00535 u_int32_t st_region_wait;
00536 u_int32_t st_region_nowait;
00537 roff_t st_regsize;
00538 };
00539
00540
00541
00542
00543
00544 struct __db_ilock {
00545 db_pgno_t pgno;
00546 u_int8_t fileid[DB_FILE_ID_LEN];
00547 #define DB_HANDLE_LOCK 1
00548 #define DB_RECORD_LOCK 2
00549 #define DB_PAGE_LOCK 3
00550 u_int32_t type;
00551 };
00552
00553
00554
00555
00556
00557
00558 struct __db_lock_u {
00559 roff_t off;
00560 u_int32_t ndx;
00561
00562 u_int32_t gen;
00563 db_lockmode_t mode;
00564 };
00565
00566
00567 struct __db_lockreq {
00568 db_lockop_t op;
00569 db_lockmode_t mode;
00570 db_timeout_t timeout;
00571 DBT *obj;
00572 DB_LOCK lock;
00573 };
00574
00575
00576
00577
00578 #define DB_LOGVERSION 11
00579 #define DB_LOGOLDVER 11
00580 #define DB_LOGMAGIC 0x040988
00581
00582
00583 #define DB_ARCH_ABS 0x001
00584 #define DB_ARCH_DATA 0x002
00585 #define DB_ARCH_LOG 0x004
00586 #define DB_ARCH_REMOVE 0x008
00587
00588
00589 #define DB_FLUSH 0x001
00590 #define DB_LOG_CHKPNT 0x002
00591 #define DB_LOG_COMMIT 0x004
00592 #define DB_LOG_NOCOPY 0x008
00593 #define DB_LOG_NOT_DURABLE 0x010
00594 #define DB_LOG_PERM 0x020
00595 #define DB_LOG_RESEND 0x040
00596 #define DB_LOG_WRNOSYNC 0x080
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607 struct __db_lsn {
00608 u_int32_t file;
00609 u_int32_t offset;
00610 };
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621 #define DB_user_BEGIN 10000
00622 #define DB_debug_FLAG 0x80000000
00623
00624
00625
00626
00627
00628 struct __db_log_cursor {
00629 DB_ENV *dbenv;
00630
00631 DB_FH *c_fhp;
00632 DB_LSN c_lsn;
00633 u_int32_t c_len;
00634 u_int32_t c_prev;
00635
00636 DBT c_dbt;
00637
00638 #define DB_LOGC_BUF_SIZE (32 * 1024)
00639 u_int8_t *bp;
00640 u_int32_t bp_size;
00641 u_int32_t bp_rlen;
00642 DB_LSN bp_lsn;
00643
00644 u_int32_t bp_maxrec;
00645
00646
00647 int (*close) __P((DB_LOGC *, u_int32_t));
00648 int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, u_int32_t));
00649
00650
00651 #define DB_LOG_DISK 0x01
00652 #define DB_LOG_LOCKED 0x02
00653 #define DB_LOG_SILENT_ERR 0x04
00654 u_int32_t flags;
00655 };
00656
00657
00658 struct __db_log_stat {
00659 u_int32_t st_magic;
00660 u_int32_t st_version;
00661 int st_mode;
00662 u_int32_t st_lg_bsize;
00663 u_int32_t st_lg_size;
00664 u_int32_t st_record;
00665 u_int32_t st_w_bytes;
00666 u_int32_t st_w_mbytes;
00667 u_int32_t st_wc_bytes;
00668 u_int32_t st_wc_mbytes;
00669 u_int32_t st_wcount;
00670 u_int32_t st_wcount_fill;
00671 u_int32_t st_rcount;
00672 u_int32_t st_scount;
00673 u_int32_t st_region_wait;
00674 u_int32_t st_region_nowait;
00675 u_int32_t st_cur_file;
00676 u_int32_t st_cur_offset;
00677 u_int32_t st_disk_file;
00678 u_int32_t st_disk_offset;
00679 roff_t st_regsize;
00680 u_int32_t st_maxcommitperflush;
00681 u_int32_t st_mincommitperflush;
00682 };
00683
00684
00685
00686
00687
00688
00689
00690
00691 #define DB_SET_TXN_LSNP(txn, blsnp, llsnp) \
00692 ((txn)->set_txn_lsnp(txn, blsnp, llsnp))
00693
00694
00695
00696
00697
00698 #define DB_MPOOL_CREATE 0x001
00699 #define DB_MPOOL_LAST 0x002
00700 #define DB_MPOOL_NEW 0x004
00701 #define DB_MPOOL_FREE 0x008
00702
00703
00704 #define DB_MPOOL_CLEAN 0x001
00705 #define DB_MPOOL_DIRTY 0x002
00706 #define DB_MPOOL_DISCARD 0x004
00707
00708
00709 #define DB_MPOOL_NOFILE 0x001
00710 #define DB_MPOOL_UNLINK 0x002
00711
00712
00713 typedef enum {
00714 DB_PRIORITY_VERY_LOW=1,
00715 DB_PRIORITY_LOW=2,
00716 DB_PRIORITY_DEFAULT=3,
00717 DB_PRIORITY_HIGH=4,
00718 DB_PRIORITY_VERY_HIGH=5
00719 } DB_CACHE_PRIORITY;
00720
00721
00722 struct __db_mpoolfile {
00723 DB_FH *fhp;
00724
00725
00726
00727
00728
00729 u_int32_t ref;
00730
00731 u_int32_t pinref;
00732
00733
00734
00735
00736
00737
00738 struct {
00739 struct __db_mpoolfile *tqe_next;
00740 struct __db_mpoolfile **tqe_prev;
00741 } q;
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753 DB_ENV *dbenv;
00754 MPOOLFILE *mfp;
00755
00756 u_int32_t clear_len;
00757 u_int8_t
00758 fileid[DB_FILE_ID_LEN];
00759 int ftype;
00760 int32_t lsn_offset;
00761 u_int32_t gbytes, bytes;
00762 DBT *pgcookie;
00763 int32_t priority;
00764
00765 void *addr;
00766 size_t len;
00767
00768 u_int32_t config_flags;
00769
00770
00771 int (*close) __P((DB_MPOOLFILE *, u_int32_t));
00772 int (*get) __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *));
00773 int (*open) __P((DB_MPOOLFILE *, const char *, u_int32_t, int, size_t));
00774 int (*put) __P((DB_MPOOLFILE *, void *, u_int32_t));
00775 int (*set) __P((DB_MPOOLFILE *, void *, u_int32_t));
00776 int (*get_clear_len) __P((DB_MPOOLFILE *, u_int32_t *));
00777 int (*set_clear_len) __P((DB_MPOOLFILE *, u_int32_t));
00778 int (*get_fileid) __P((DB_MPOOLFILE *, u_int8_t *));
00779 int (*set_fileid) __P((DB_MPOOLFILE *, u_int8_t *));
00780 int (*get_flags) __P((DB_MPOOLFILE *, u_int32_t *));
00781 int (*set_flags) __P((DB_MPOOLFILE *, u_int32_t, int));
00782 int (*get_ftype) __P((DB_MPOOLFILE *, int *));
00783 int (*set_ftype) __P((DB_MPOOLFILE *, int));
00784 int (*get_lsn_offset) __P((DB_MPOOLFILE *, int32_t *));
00785 int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t));
00786 int (*get_maxsize) __P((DB_MPOOLFILE *, u_int32_t *, u_int32_t *));
00787 int (*set_maxsize) __P((DB_MPOOLFILE *, u_int32_t, u_int32_t));
00788 int (*get_pgcookie) __P((DB_MPOOLFILE *, DBT *));
00789 int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *));
00790 int (*get_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY *));
00791 int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY));
00792 int (*sync) __P((DB_MPOOLFILE *));
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803 #define MP_FILEID_SET 0x001
00804 #define MP_FLUSH 0x002
00805 #define MP_OPEN_CALLED 0x004
00806 #define MP_READONLY 0x008
00807 u_int32_t flags;
00808 };
00809
00810
00811 struct __db_mpool_stat {
00812 u_int32_t st_gbytes;
00813 u_int32_t st_bytes;
00814 u_int32_t st_ncache;
00815 roff_t st_regsize;
00816 size_t st_mmapsize;
00817 int st_maxopenfd;
00818 int st_maxwrite;
00819 int st_maxwrite_sleep;
00820 u_int32_t st_map;
00821 u_int32_t st_cache_hit;
00822 u_int32_t st_cache_miss;
00823 u_int32_t st_page_create;
00824 u_int32_t st_page_in;
00825 u_int32_t st_page_out;
00826 u_int32_t st_ro_evict;
00827 u_int32_t st_rw_evict;
00828 u_int32_t st_page_trickle;
00829 u_int32_t st_pages;
00830 u_int32_t st_page_clean;
00831 u_int32_t st_page_dirty;
00832 u_int32_t st_hash_buckets;
00833 u_int32_t st_hash_searches;
00834 u_int32_t st_hash_longest;
00835 u_int32_t st_hash_examined;
00836 u_int32_t st_hash_nowait;
00837 u_int32_t st_hash_wait;
00838 u_int32_t st_hash_max_wait;
00839 u_int32_t st_region_nowait;
00840 u_int32_t st_region_wait;
00841 u_int32_t st_alloc;
00842 u_int32_t st_alloc_buckets;
00843 u_int32_t st_alloc_max_buckets;
00844 u_int32_t st_alloc_pages;
00845 u_int32_t st_alloc_max_pages;
00846 };
00847
00848
00849 struct __db_mpool_fstat {
00850 char *file_name;
00851 u_int32_t st_pagesize;
00852 u_int32_t st_map;
00853 u_int32_t st_cache_hit;
00854 u_int32_t st_cache_miss;
00855 u_int32_t st_page_create;
00856 u_int32_t st_page_in;
00857 u_int32_t st_page_out;
00858 };
00859
00860
00861
00862
00863 #define DB_TXNVERSION 1
00864
00865 typedef enum {
00866 DB_TXN_ABORT=0,
00867 DB_TXN_APPLY=1,
00868 DB_TXN_BACKWARD_ALLOC=2,
00869 DB_TXN_BACKWARD_ROLL=3,
00870 DB_TXN_FORWARD_ROLL=4,
00871 DB_TXN_OPENFILES=5,
00872 DB_TXN_POPENFILES=6,
00873 DB_TXN_PRINT=7
00874 } db_recops;
00875
00876
00877
00878
00879
00880
00881
00882 #define DB_UNDO(op) ((op) == DB_TXN_ABORT || \
00883 (op) == DB_TXN_BACKWARD_ROLL || (op) == DB_TXN_BACKWARD_ALLOC)
00884 #define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY)
00885
00886 struct __db_txn {
00887 DB_TXNMGR *mgrp;
00888 DB_TXN *parent;
00889
00890 u_int32_t txnid;
00891 char *name;
00892
00893 db_threadid_t tid;
00894 void *td;
00895 db_timeout_t lock_timeout;
00896 db_timeout_t expire;
00897 void *txn_list;
00898
00899
00900
00901
00902
00903
00904
00905 struct {
00906 struct __db_txn *tqe_next;
00907 struct __db_txn **tqe_prev;
00908 } links;
00909 struct {
00910 struct __db_txn *tqe_next;
00911 struct __db_txn **tqe_prev;
00912 } xalinks;
00913
00914
00915
00916
00917
00918
00919 struct __kids {
00920 struct __db_txn *tqh_first;
00921 struct __db_txn **tqh_last;
00922 } kids;
00923
00924
00925
00926
00927
00928
00929 struct {
00930 struct __txn_event *tqh_first;
00931 struct __txn_event **tqh_last;
00932 } events;
00933
00934
00935
00936
00937
00938
00939 struct {
00940 struct __txn_logrec *stqh_first;
00941 struct __txn_logrec **stqh_last;
00942 } logs;
00943
00944
00945
00946
00947
00948
00949 struct {
00950 struct __db_txn *tqe_next;
00951 struct __db_txn **tqe_prev;
00952 } klinks;
00953
00954 void *api_internal;
00955 void *xml_internal;
00956
00957 u_int32_t cursors;
00958
00959
00960 int (*abort) __P((DB_TXN *));
00961 int (*commit) __P((DB_TXN *, u_int32_t));
00962 int (*discard) __P((DB_TXN *, u_int32_t));
00963 int (*get_name) __P((DB_TXN *, const char **));
00964 u_int32_t (*id) __P((DB_TXN *));
00965 int (*prepare) __P((DB_TXN *, u_int8_t *));
00966 int (*set_name) __P((DB_TXN *, const char *));
00967 int (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t));
00968
00969
00970
00971 void (*set_txn_lsnp) __P((DB_TXN *txn, DB_LSN **, DB_LSN **));
00972
00973
00974 #define TXN_CHILDCOMMIT 0x001
00975 #define TXN_COMPENSATE 0x002
00976 #define TXN_DEADLOCK 0x004
00977 #define TXN_LOCKTIMEOUT 0x008
00978 #define TXN_MALLOC 0x010
00979 #define TXN_NOSYNC 0x020
00980 #define TXN_NOWAIT 0x040
00981 #define TXN_READ_COMMITTED 0x080
00982 #define TXN_READ_UNCOMMITTED 0x100
00983 #define TXN_RESTORED 0x200
00984 #define TXN_SYNC 0x400
00985 #define TXN_WRITE_NOSYNC 0x800
00986 u_int32_t flags;
00987 };
00988
00989 #define TXN_SYNC_FLAGS (TXN_SYNC | TXN_NOSYNC | TXN_WRITE_NOSYNC)
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999 #define DB_XIDDATASIZE 128
01000 struct __db_preplist {
01001 DB_TXN *txn;
01002 u_int8_t gid[DB_XIDDATASIZE];
01003 };
01004
01005
01006 struct __db_txn_active {
01007 u_int32_t txnid;
01008 u_int32_t parentid;
01009 pid_t pid;
01010 db_threadid_t tid;
01011 DB_LSN lsn;
01012 u_int32_t xa_status;
01013 u_int8_t xid[DB_XIDDATASIZE];
01014 char name[51];
01015 };
01016
01017 struct __db_txn_stat {
01018 DB_LSN st_last_ckp;
01019 time_t st_time_ckp;
01020 u_int32_t st_last_txnid;
01021 u_int32_t st_maxtxns;
01022 u_int32_t st_naborts;
01023 u_int32_t st_nbegins;
01024 u_int32_t st_ncommits;
01025 u_int32_t st_nactive;
01026 u_int32_t st_nrestores;
01027
01028 u_int32_t st_maxnactive;
01029 DB_TXN_ACTIVE *st_txnarray;
01030 u_int32_t st_region_wait;
01031 u_int32_t st_region_nowait;
01032 roff_t st_regsize;
01033 };
01034
01035
01036
01037
01038
01039 #define DB_EID_BROADCAST -1
01040 #define DB_EID_INVALID -2
01041
01042
01043 #define DB_REP_CONF_BULK 0x0001
01044 #define DB_REP_CONF_DELAYCLIENT 0x0002
01045 #define DB_REP_CONF_NOAUTOINIT 0x0004
01046 #define DB_REP_CONF_NOWAIT 0x0008
01047
01048
01049 #define DB_REP_CLIENT 0x001
01050 #define DB_REP_MASTER 0x002
01051
01052
01053 struct __db_rep_stat {
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063 u_int32_t st_status;
01064 DB_LSN st_next_lsn;
01065 DB_LSN st_waiting_lsn;
01066 db_pgno_t st_next_pg;
01067 db_pgno_t st_waiting_pg;
01068
01069 u_int32_t st_dupmasters;
01070
01071 int st_env_id;
01072 int st_env_priority;
01073 u_int32_t st_bulk_fills;
01074 u_int32_t st_bulk_overflows;
01075 u_int32_t st_bulk_records;
01076 u_int32_t st_bulk_transfers;
01077 u_int32_t st_client_rerequests;
01078 u_int32_t st_client_svc_req;
01079
01080 u_int32_t st_client_svc_miss;
01081
01082 u_int32_t st_gen;
01083 u_int32_t st_egen;
01084 u_int32_t st_log_duplicated;
01085 u_int32_t st_log_queued;
01086 u_int32_t st_log_queued_max;
01087 u_int32_t st_log_queued_total;
01088 u_int32_t st_log_records;
01089 u_int32_t st_log_requested;
01090 int st_master;
01091 u_int32_t st_master_changes;
01092 u_int32_t st_msgs_badgen;
01093 u_int32_t st_msgs_processed;
01094 u_int32_t st_msgs_recover;
01095
01096 u_int32_t st_msgs_send_failures;
01097 u_int32_t st_msgs_sent;
01098 u_int32_t st_newsites;
01099 int st_nsites;
01100
01101 u_int32_t st_nthrottles;
01102 u_int32_t st_outdated;
01103
01104 u_int32_t st_pg_duplicated;
01105 u_int32_t st_pg_records;
01106 u_int32_t st_pg_requested;
01107 u_int32_t st_startup_complete;
01108 u_int32_t st_txns_applied;
01109
01110
01111 u_int32_t st_elections;
01112 u_int32_t st_elections_won;
01113
01114
01115 int st_election_cur_winner;
01116 u_int32_t st_election_gen;
01117 DB_LSN st_election_lsn;
01118 int st_election_nsites;
01119 int st_election_nvotes;
01120 int st_election_priority;
01121 int st_election_status;
01122 u_int32_t st_election_tiebreaker;
01123 int st_election_votes;
01124 u_int32_t st_election_sec;
01125 u_int32_t st_election_usec;
01126 };
01127
01128
01129
01130
01131
01132
01133
01134 struct __db_seq_record {
01135 u_int32_t seq_version;
01136 #define DB_SEQ_DEC 0x00000001
01137 #define DB_SEQ_INC 0x00000002
01138 #define DB_SEQ_RANGE_SET 0x00000004
01139 #define DB_SEQ_WRAP 0x00000008
01140 #define DB_SEQ_WRAPPED 0x00000010
01141 u_int32_t flags;
01142 db_seq_t seq_value;
01143 db_seq_t seq_max;
01144 db_seq_t seq_min;
01145 };
01146
01147
01148
01149
01150 struct __db_sequence {
01151 DB *seq_dbp;
01152 db_mutex_t mtx_seq;
01153 DB_SEQ_RECORD *seq_rp;
01154 DB_SEQ_RECORD seq_record;
01155 int32_t seq_cache_size;
01156 db_seq_t seq_last_value;
01157 DBT seq_key;
01158 DBT seq_data;
01159
01160
01161 void *api_internal;
01162
01163
01164 int (*close) __P((DB_SEQUENCE *, u_int32_t));
01165 int (*get) __P((DB_SEQUENCE *,
01166 DB_TXN *, int32_t, db_seq_t *, u_int32_t));
01167 int (*get_cachesize) __P((DB_SEQUENCE *, int32_t *));
01168 int (*get_db) __P((DB_SEQUENCE *, DB **));
01169 int (*get_flags) __P((DB_SEQUENCE *, u_int32_t *));
01170 int (*get_key) __P((DB_SEQUENCE *, DBT *));
01171 int (*get_range) __P((DB_SEQUENCE *,
01172 db_seq_t *, db_seq_t *));
01173 int (*initial_value) __P((DB_SEQUENCE *, db_seq_t));
01174 int (*open) __P((DB_SEQUENCE *,
01175 DB_TXN *, DBT *, u_int32_t));
01176 int (*remove) __P((DB_SEQUENCE *, DB_TXN *, u_int32_t));
01177 int (*set_cachesize) __P((DB_SEQUENCE *, int32_t));
01178 int (*set_flags) __P((DB_SEQUENCE *, u_int32_t));
01179 int (*set_range) __P((DB_SEQUENCE *, db_seq_t, db_seq_t));
01180 int (*stat) __P((DB_SEQUENCE *,
01181 DB_SEQUENCE_STAT **, u_int32_t));
01182 int (*stat_print) __P((DB_SEQUENCE *, u_int32_t));
01183
01184 };
01185
01186 struct __db_seq_stat {
01187 u_int32_t st_wait;
01188 u_int32_t st_nowait;
01189 db_seq_t st_current;
01190 db_seq_t st_value;
01191 db_seq_t st_last_value;
01192 db_seq_t st_min;
01193 db_seq_t st_max;
01194 int32_t st_cache_size;
01195 u_int32_t st_flags;
01196 };
01197
01198
01199
01200
01201 typedef enum {
01202 DB_BTREE=1,
01203 DB_HASH=2,
01204 DB_RECNO=3,
01205 DB_QUEUE=4,
01206 DB_UNKNOWN=5
01207 } DBTYPE;
01208
01209 #define DB_RENAMEMAGIC 0x030800
01210
01211 #define DB_BTREEVERSION 9
01212 #define DB_BTREEOLDVER 8
01213 #define DB_BTREEMAGIC 0x053162
01214
01215 #define DB_HASHVERSION 8
01216 #define DB_HASHOLDVER 7
01217 #define DB_HASHMAGIC 0x061561
01218
01219 #define DB_QAMVERSION 4
01220 #define DB_QAMOLDVER 3
01221 #define DB_QAMMAGIC 0x042253
01222
01223 #define DB_SEQUENCE_VERSION 2
01224 #define DB_SEQUENCE_OLDVER 1
01225
01226
01227
01228
01229
01230 #define DB_AFTER 1
01231 #define DB_APPEND 2
01232 #define DB_BEFORE 3
01233 #define DB_CACHED_COUNTS 4
01234 #define DB_CONSUME 5
01235 #define DB_CONSUME_WAIT 6
01236 #define DB_CURRENT 7
01237 #define DB_FAST_STAT 8
01238 #define DB_FIRST 9
01239 #define DB_GET_BOTH 10
01240 #define DB_GET_BOTHC 11
01241 #define DB_GET_BOTH_RANGE 12
01242 #define DB_GET_RECNO 13
01243 #define DB_JOIN_ITEM 14
01244 #define DB_KEYFIRST 15
01245 #define DB_KEYLAST 16
01246 #define DB_LAST 17
01247 #define DB_NEXT 18
01248 #define DB_NEXT_DUP 19
01249 #define DB_NEXT_NODUP 20
01250 #define DB_NODUPDATA 21
01251 #define DB_NOOVERWRITE 22
01252 #define DB_NOSYNC 23
01253 #define DB_POSITION 24
01254 #define DB_PREV 25
01255 #define DB_PREV_NODUP 26
01256 #define DB_RECORDCOUNT 27
01257 #define DB_SET 28
01258 #define DB_SET_LOCK_TIMEOUT 29
01259 #define DB_SET_RANGE 30
01260 #define DB_SET_RECNO 31
01261 #define DB_SET_TXN_NOW 32
01262 #define DB_SET_TXN_TIMEOUT 33
01263 #define DB_UPDATE_SECONDARY 34
01264 #define DB_WRITECURSOR 35
01265 #define DB_WRITELOCK 36
01266
01267
01268 #define DB_OPFLAGS_MASK 0x000000ff
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278 #define DB_MULTIPLE 0x08000000
01279 #define DB_MULTIPLE_KEY 0x10000000
01280 #define DB_RMW 0x20000000
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297 #define DB_BUFFER_SMALL (-30999)
01298 #define DB_DONOTINDEX (-30998)
01299 #define DB_KEYEMPTY (-30997)
01300 #define DB_KEYEXIST (-30996)
01301 #define DB_LOCK_DEADLOCK (-30995)
01302 #define DB_LOCK_NOTGRANTED (-30994)
01303 #define DB_LOG_BUFFER_FULL (-30993)
01304 #define DB_NOSERVER (-30992)
01305 #define DB_NOSERVER_HOME (-30991)
01306 #define DB_NOSERVER_ID (-30990)
01307 #define DB_NOTFOUND (-30989)
01308 #define DB_OLD_VERSION (-30988)
01309 #define DB_PAGE_NOTFOUND (-30987)
01310 #define DB_REP_DUPMASTER (-30986)
01311 #define DB_REP_HANDLE_DEAD (-30985)
01312 #define DB_REP_HOLDELECTION (-30984)
01313 #define DB_REP_IGNORE (-30983)
01314 #define DB_REP_ISPERM (-30982)
01315 #define DB_REP_JOIN_FAILURE (-30981)
01316 #define DB_REP_LOCKOUT (-30980)
01317 #define DB_REP_NEWMASTER (-30979)
01318 #define DB_REP_NEWSITE (-30978)
01319 #define DB_REP_NOTPERM (-30977)
01320 #define DB_REP_STARTUPDONE (-30976)
01321 #define DB_REP_UNAVAIL (-30975)
01322 #define DB_RUNRECOVERY (-30974)
01323 #define DB_SECONDARY_BAD (-30973)
01324 #define DB_VERIFY_BAD (-30972)
01325 #define DB_VERSION_MISMATCH (-30971)
01326
01327
01328 #define DB_ALREADY_ABORTED (-30899)
01329 #define DB_DELETED (-30898)
01330 #define DB_NEEDSPLIT (-30897)
01331 #define DB_REP_BULKOVF (-30896)
01332 #define DB_REP_EGENCHG (-30895)
01333 #define DB_REP_LOGREADY (-30894)
01334 #define DB_REP_PAGEDONE (-30893)
01335 #define DB_SURPRISE_KID (-30892)
01336
01337 #define DB_SWAPBYTES (-30891)
01338 #define DB_TIMEOUT (-30890)
01339 #define DB_TXN_CKP (-30889)
01340 #define DB_VERIFY_FATAL (-30888)
01341
01342
01343 struct __db {
01344
01345
01346
01347 u_int32_t pgsize;
01348
01349
01350 int (*db_append_recno) __P((DB *, DBT *, db_recno_t));
01351 void (*db_feedback) __P((DB *, int, int));
01352 int (*dup_compare) __P((DB *, const DBT *, const DBT *));
01353
01354 void *app_private;
01355
01356
01357
01358
01359 DB_ENV *dbenv;
01360
01361 DBTYPE type;
01362
01363 DB_MPOOLFILE *mpf;
01364
01365 db_mutex_t mutex;
01366
01367 char *fname, *dname;
01368 u_int32_t open_flags;
01369
01370 u_int8_t fileid[DB_FILE_ID_LEN];
01371
01372 u_int32_t adj_fileid;
01373
01374 #define DB_LOGFILEID_INVALID -1
01375 FNAME *log_filename;
01376
01377 db_pgno_t meta_pgno;
01378 u_int32_t lid;
01379 u_int32_t cur_lid;
01380 u_int32_t associate_lid;
01381 DB_LOCK handle_lock;
01382
01383 u_int cl_id;
01384
01385 time_t timestamp;
01386 u_int32_t fid_gen;
01387
01388
01389
01390
01391 DBT my_rskey;
01392 DBT my_rkey;
01393 DBT my_rdata;
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408 DB_FH *saved_open_fhp;
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418 struct {
01419 struct __db *le_next;
01420 struct __db **le_prev;
01421 } dblistlinks;
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432 struct __cq_fq {
01433 struct __dbc *tqh_first;
01434 struct __dbc **tqh_last;
01435 } free_queue;
01436 struct __cq_aq {
01437 struct __dbc *tqh_first;
01438 struct __dbc **tqh_last;
01439 } active_queue;
01440 struct __cq_jq {
01441 struct __dbc *tqh_first;
01442 struct __dbc **tqh_last;
01443 } join_queue;
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454 struct {
01455 struct __db *lh_first;
01456 } s_secondaries;
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470 struct {
01471 struct __db *le_next;
01472 struct __db **le_prev;
01473 } s_links;
01474 u_int32_t s_refcnt;
01475
01476
01477 int (*s_callback) __P((DB *, const DBT *, const DBT *, DBT *));
01478
01479
01480 DB *s_primary;
01481
01482 #define DB_ASSOC_IMMUTABLE_KEY 0x00000001
01483
01484
01485 u_int32_t s_assoc_flags;
01486
01487
01488 void *api_internal;
01489
01490
01491 void *bt_internal;
01492 void *h_internal;
01493 void *q_internal;
01494 void *xa_internal;
01495
01496
01497 int (*associate) __P((DB *, DB_TXN *, DB *,
01498 int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t));
01499 int (*close) __P((DB *, u_int32_t));
01500 int (*compact) __P((DB *,
01501 DB_TXN *, DBT *, DBT *, DB_COMPACT *, u_int32_t, DBT *));
01502 int (*cursor) __P((DB *, DB_TXN *, DBC **, u_int32_t));
01503 int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t));
01504 void (*err) __P((DB *, int, const char *, ...));
01505 void (*errx) __P((DB *, const char *, ...));
01506 int (*fd) __P((DB *, int *));
01507 int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
01508 int (*get_bt_minkey) __P((DB *, u_int32_t *));
01509 int (*get_byteswapped) __P((DB *, int *));
01510 int (*get_cachesize) __P((DB *, u_int32_t *, u_int32_t *, int *));
01511 int (*get_dbname) __P((DB *, const char **, const char **));
01512 int (*get_encrypt_flags) __P((DB *, u_int32_t *));
01513 DB_ENV *(*get_env) __P((DB *));
01514 void (*get_errfile) __P((DB *, FILE **));
01515 void (*get_errpfx) __P((DB *, const char **));
01516 int (*get_flags) __P((DB *, u_int32_t *));
01517 int (*get_h_ffactor) __P((DB *, u_int32_t *));
01518 int (*get_h_nelem) __P((DB *, u_int32_t *));
01519 int (*get_lorder) __P((DB *, int *));
01520 DB_MPOOLFILE *(*get_mpf) __P((DB *));
01521 void (*get_msgfile) __P((DB *, FILE **));
01522 int (*get_open_flags) __P((DB *, u_int32_t *));
01523 int (*get_pagesize) __P((DB *, u_int32_t *));
01524 int (*get_q_extentsize) __P((DB *, u_int32_t *));
01525 int (*get_re_delim) __P((DB *, int *));
01526 int (*get_re_len) __P((DB *, u_int32_t *));
01527 int (*get_re_pad) __P((DB *, int *));
01528 int (*get_re_source) __P((DB *, const char **));
01529 int (*get_transactional) __P((DB *));
01530 int (*get_type) __P((DB *, DBTYPE *));
01531 int (*join) __P((DB *, DBC **, DBC **, u_int32_t));
01532 int (*key_range)
01533 __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t));
01534 int (*open) __P((DB *,
01535 DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int));
01536 int (*pget) __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t));
01537 int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
01538 int (*remove) __P((DB *, const char *, const char *, u_int32_t));
01539 int (*rename) __P((DB *,
01540 const char *, const char *, const char *, u_int32_t));
01541 int (*set_alloc) __P((DB *, void *(*)(size_t),
01542 void *(*)(void *, size_t), void (*)(void *)));
01543 int (*set_append_recno) __P((DB *, int (*)(DB *, DBT *, db_recno_t)));
01544 int (*set_bt_compare)
01545 __P((DB *, int (*)(DB *, const DBT *, const DBT *)));
01546 int (*set_bt_minkey) __P((DB *, u_int32_t));
01547 int (*set_bt_prefix)
01548 __P((DB *, size_t (*)(DB *, const DBT *, const DBT *)));
01549 int (*set_cachesize) __P((DB *, u_int32_t, u_int32_t, int));
01550 int (*set_dup_compare)
01551 __P((DB *, int (*)(DB *, const DBT *, const DBT *)));
01552 int (*set_encrypt) __P((DB *, const char *, u_int32_t));
01553 void (*set_errcall) __P((DB *,
01554 void (*)(const DB_ENV *, const char *, const char *)));
01555 void (*set_errfile) __P((DB *, FILE *));
01556 void (*set_errpfx) __P((DB *, const char *));
01557 int (*set_feedback) __P((DB *, void (*)(DB *, int, int)));
01558 int (*set_flags) __P((DB *, u_int32_t));
01559 int (*set_h_ffactor) __P((DB *, u_int32_t));
01560 int (*set_h_hash)
01561 __P((DB *, u_int32_t (*)(DB *, const void *, u_int32_t)));
01562 int (*set_h_nelem) __P((DB *, u_int32_t));
01563 int (*set_lorder) __P((DB *, int));
01564 void (*set_msgcall) __P((DB *, void (*)(const DB_ENV *, const char *)));
01565 void (*set_msgfile) __P((DB *, FILE *));
01566 int (*set_pagesize) __P((DB *, u_int32_t));
01567 int (*set_paniccall) __P((DB *, void (*)(DB_ENV *, int)));
01568 int (*set_q_extentsize) __P((DB *, u_int32_t));
01569 int (*set_re_delim) __P((DB *, int));
01570 int (*set_re_len) __P((DB *, u_int32_t));
01571 int (*set_re_pad) __P((DB *, int));
01572 int (*set_re_source) __P((DB *, const char *));
01573 int (*stat) __P((DB *, DB_TXN *, void *, u_int32_t));
01574 int (*stat_print) __P((DB *, u_int32_t));
01575 int (*sync) __P((DB *, u_int32_t));
01576 int (*truncate) __P((DB *, DB_TXN *, u_int32_t *, u_int32_t));
01577 int (*upgrade) __P((DB *, const char *, u_int32_t));
01578 int (*verify)
01579 __P((DB *, const char *, const char *, FILE *, u_int32_t));
01580
01581
01582
01583 int (*dump) __P((DB *, const char *,
01584 int (*)(void *, const void *), void *, int, int));
01585 int (*db_am_remove) __P((DB *, DB_TXN *, const char *, const char *));
01586 int (*db_am_rename) __P((DB *, DB_TXN *,
01587 const char *, const char *, const char *));
01588
01589
01590
01591
01592
01593
01594 int (*stored_get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t));
01595 int (*stored_close) __P((DB *, u_int32_t));
01596
01597 #define DB_OK_BTREE 0x01
01598 #define DB_OK_HASH 0x02
01599 #define DB_OK_QUEUE 0x04
01600 #define DB_OK_RECNO 0x08
01601 u_int32_t am_ok;
01602
01603
01604
01605
01606
01607
01608 int preserve_fid;
01609
01610 #define DB_AM_CHKSUM 0x00000001
01611 #define DB_AM_CL_WRITER 0x00000002
01612 #define DB_AM_COMPENSATE 0x00000004
01613 #define DB_AM_CREATED 0x00000008
01614 #define DB_AM_CREATED_MSTR 0x00000010
01615 #define DB_AM_DBM_ERROR 0x00000020
01616 #define DB_AM_DELIMITER 0x00000040
01617 #define DB_AM_DISCARD 0x00000080
01618 #define DB_AM_DUP 0x00000100
01619 #define DB_AM_DUPSORT 0x00000200
01620 #define DB_AM_ENCRYPT 0x00000400
01621 #define DB_AM_FIXEDLEN 0x00000800
01622 #define DB_AM_INMEM 0x00001000
01623 #define DB_AM_INORDER 0x00002000
01624 #define DB_AM_IN_RENAME 0x00004000
01625 #define DB_AM_NOT_DURABLE 0x00008000
01626 #define DB_AM_OPEN_CALLED 0x00010000
01627 #define DB_AM_PAD 0x00020000
01628 #define DB_AM_PGDEF 0x00040000
01629 #define DB_AM_RDONLY 0x00080000
01630 #define DB_AM_READ_UNCOMMITTED 0x00100000
01631 #define DB_AM_RECNUM 0x00200000
01632 #define DB_AM_RECOVER 0x00400000
01633 #define DB_AM_RENUMBER 0x00800000
01634 #define DB_AM_REVSPLITOFF 0x01000000
01635 #define DB_AM_SECONDARY 0x02000000
01636 #define DB_AM_SNAPSHOT 0x04000000
01637 #define DB_AM_SUBDB 0x08000000
01638 #define DB_AM_SWAP 0x10000000
01639 #define DB_AM_TXN 0x20000000
01640 #define DB_AM_VERIFYING 0x40000000
01641 u_int32_t orig_flags;
01642 u_int32_t flags;
01643 };
01644
01645
01646
01647
01648
01649 #define DB_MULTIPLE_INIT(pointer, dbt) \
01650 (pointer = (u_int8_t *)(dbt)->data + \
01651 (dbt)->ulen - sizeof(u_int32_t))
01652 #define DB_MULTIPLE_NEXT(pointer, dbt, retdata, retdlen) \
01653 do { \
01654 if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \
01655 retdata = NULL; \
01656 pointer = NULL; \
01657 break; \
01658 } \
01659 retdata = (u_int8_t *) \
01660 (dbt)->data + *(u_int32_t *)(pointer); \
01661 (pointer) = (u_int32_t *)(pointer) - 1; \
01662 retdlen = *(u_int32_t *)(pointer); \
01663 (pointer) = (u_int32_t *)(pointer) - 1; \
01664 if (retdlen == 0 && \
01665 retdata == (u_int8_t *)(dbt)->data) \
01666 retdata = NULL; \
01667 } while (0)
01668 #define DB_MULTIPLE_KEY_NEXT(pointer, dbt, retkey, retklen, retdata, retdlen) \
01669 do { \
01670 if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \
01671 retdata = NULL; \
01672 retkey = NULL; \
01673 pointer = NULL; \
01674 break; \
01675 } \
01676 retkey = (u_int8_t *) \
01677 (dbt)->data + *(u_int32_t *)(pointer); \
01678 (pointer) = (u_int32_t *)(pointer) - 1; \
01679 retklen = *(u_int32_t *)(pointer); \
01680 (pointer) = (u_int32_t *)(pointer) - 1; \
01681 retdata = (u_int8_t *) \
01682 (dbt)->data + *(u_int32_t *)(pointer); \
01683 (pointer) = (u_int32_t *)(pointer) - 1; \
01684 retdlen = *(u_int32_t *)(pointer); \
01685 (pointer) = (u_int32_t *)(pointer) - 1; \
01686 } while (0)
01687
01688 #define DB_MULTIPLE_RECNO_NEXT(pointer, dbt, recno, retdata, retdlen) \
01689 do { \
01690 if (*((u_int32_t *)(pointer)) == (u_int32_t)0) { \
01691 recno = 0; \
01692 retdata = NULL; \
01693 pointer = NULL; \
01694 break; \
01695 } \
01696 recno = *(u_int32_t *)(pointer); \
01697 (pointer) = (u_int32_t *)(pointer) - 1; \
01698 retdata = (u_int8_t *) \
01699 (dbt)->data + *(u_int32_t *)(pointer); \
01700 (pointer) = (u_int32_t *)(pointer) - 1; \
01701 retdlen = *(u_int32_t *)(pointer); \
01702 (pointer) = (u_int32_t *)(pointer) - 1; \
01703 } while (0)
01704
01705
01706
01707
01708 struct __dbc {
01709 DB *dbp;
01710 DB_TXN *txn;
01711
01712
01713
01714
01715
01716
01717
01718
01719 struct {
01720 DBC *tqe_next;
01721 DBC **tqe_prev;
01722 } links;
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735 DBT *rskey;
01736 DBT *rkey;
01737 DBT *rdata;
01738
01739 DBT my_rskey;
01740 DBT my_rkey;
01741 DBT my_rdata;
01742
01743 void *lref;
01744 u_int32_t locker;
01745 DBT lock_dbt;
01746 DB_LOCK_ILOCK lock;
01747 DB_LOCK mylock;
01748
01749 u_int cl_id;
01750
01751 DBTYPE dbtype;
01752
01753 DBC_INTERNAL *internal;
01754
01755
01756 int (*c_close) __P((DBC *));
01757 int (*c_count) __P((DBC *, db_recno_t *, u_int32_t));
01758 int (*c_del) __P((DBC *, u_int32_t));
01759 int (*c_dup) __P((DBC *, DBC **, u_int32_t));
01760 int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t));
01761 int (*c_pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t));
01762 int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t));
01763
01764
01765
01766 int (*c_am_bulk) __P((DBC *, DBT *, u_int32_t));
01767 int (*c_am_close) __P((DBC *, db_pgno_t, int *));
01768 int (*c_am_del) __P((DBC *));
01769 int (*c_am_destroy) __P((DBC *));
01770 int (*c_am_get) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *));
01771 int (*c_am_put) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *));
01772 int (*c_am_writelock) __P((DBC *));
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783 #define DBC_ACTIVE 0x0001
01784 #define DBC_COMPENSATE 0x0002
01785 #define DBC_MULTIPLE 0x0004
01786 #define DBC_MULTIPLE_KEY 0x0008
01787 #define DBC_OPD 0x0010
01788 #define DBC_OWN_LID 0x0020
01789 #define DBC_READ_COMMITTED 0x0040
01790 #define DBC_READ_UNCOMMITTED 0x0080
01791 #define DBC_RECOVER 0x0100
01792 #define DBC_RMW 0x0200
01793 #define DBC_TRANSIENT 0x0400
01794 #define DBC_WRITECURSOR 0x0800
01795 #define DBC_WRITER 0x1000
01796 u_int32_t flags;
01797 };
01798
01799
01800 struct __key_range {
01801 double less;
01802 double equal;
01803 double greater;
01804 };
01805
01806
01807 struct __db_bt_stat {
01808 u_int32_t bt_magic;
01809 u_int32_t bt_version;
01810 u_int32_t bt_metaflags;
01811 u_int32_t bt_nkeys;
01812 u_int32_t bt_ndata;
01813 u_int32_t bt_pagesize;
01814 u_int32_t bt_minkey;
01815 u_int32_t bt_re_len;
01816 u_int32_t bt_re_pad;
01817 u_int32_t bt_levels;
01818 u_int32_t bt_int_pg;
01819 u_int32_t bt_leaf_pg;
01820 u_int32_t bt_dup_pg;
01821 u_int32_t bt_over_pg;
01822 u_int32_t bt_empty_pg;
01823 u_int32_t bt_free;
01824 u_int32_t bt_int_pgfree;
01825 u_int32_t bt_leaf_pgfree;
01826 u_int32_t bt_dup_pgfree;
01827 u_int32_t bt_over_pgfree;
01828 };
01829
01830 struct __db_compact {
01831
01832 u_int32_t compact_fillpercent;
01833 db_timeout_t compact_timeout;
01834 u_int32_t compact_pages;
01835
01836 u_int32_t compact_pages_free;
01837 u_int32_t compact_pages_examine;
01838 u_int32_t compact_levels;
01839 u_int32_t compact_deadlock;
01840 db_pgno_t compact_pages_truncated;
01841
01842 db_pgno_t compact_truncate;
01843 };
01844
01845
01846 struct __db_h_stat {
01847 u_int32_t hash_magic;
01848 u_int32_t hash_version;
01849 u_int32_t hash_metaflags;
01850 u_int32_t hash_nkeys;
01851 u_int32_t hash_ndata;
01852 u_int32_t hash_pagesize;
01853 u_int32_t hash_ffactor;
01854 u_int32_t hash_buckets;
01855 u_int32_t hash_free;
01856 u_int32_t hash_bfree;
01857 u_int32_t hash_bigpages;
01858 u_int32_t hash_big_bfree;
01859 u_int32_t hash_overflows;
01860 u_int32_t hash_ovfl_free;
01861 u_int32_t hash_dup;
01862 u_int32_t hash_dup_free;
01863 };
01864
01865
01866 struct __db_qam_stat {
01867 u_int32_t qs_magic;
01868 u_int32_t qs_version;
01869 u_int32_t qs_metaflags;
01870 u_int32_t qs_nkeys;
01871 u_int32_t qs_ndata;
01872 u_int32_t qs_pagesize;
01873 u_int32_t qs_extentsize;
01874 u_int32_t qs_pages;
01875 u_int32_t qs_re_len;
01876 u_int32_t qs_re_pad;
01877 u_int32_t qs_pgfree;
01878 u_int32_t qs_first_recno;
01879 u_int32_t qs_cur_recno;
01880 };
01881
01882
01883
01884
01885 #define DB_REGION_MAGIC 0x120897
01886
01887
01888 struct __db_env {
01889
01890
01891
01892
01893 void (*db_errcall) __P((const DB_ENV *, const char *, const char *));
01894 FILE *db_errfile;
01895 const char *db_errpfx;
01896
01897 FILE *db_msgfile;
01898
01899 void (*db_msgcall) __P((const DB_ENV *, const char *));
01900
01901
01902 void (*db_feedback) __P((DB_ENV *, int, int));
01903 void (*db_paniccall) __P((DB_ENV *, int));
01904
01905
01906 void *(*db_malloc) __P((size_t));
01907 void *(*db_realloc) __P((void *, size_t));
01908 void (*db_free) __P((void *));
01909
01910
01911
01912
01913
01914
01915 #define DB_VERB_DEADLOCK 0x0001
01916 #define DB_VERB_RECOVERY 0x0002
01917 #define DB_VERB_REGISTER 0x0004
01918 #define DB_VERB_REPLICATION 0x0008
01919 #define DB_VERB_WAITSFOR 0x0010
01920 u_int32_t verbose;
01921
01922 void *app_private;
01923
01924 int (*app_dispatch)
01925 __P((DB_ENV *, DBT *, DB_LSN *, db_recops));
01926
01927
01928 u_int32_t mutex_align;
01929 u_int32_t mutex_cnt;
01930 u_int32_t mutex_inc;
01931 u_int32_t mutex_tas_spins;
01932
01933 struct {
01934 int alloc_id;
01935 u_int32_t flags;
01936 } *mutex_iq;
01937 u_int mutex_iq_next;
01938 u_int mutex_iq_max;
01939
01940
01941 u_int8_t *lk_conflicts;
01942 int lk_modes;
01943 u_int32_t lk_max;
01944 u_int32_t lk_max_lockers;
01945 u_int32_t lk_max_objects;
01946 u_int32_t lk_detect;
01947 db_timeout_t lk_timeout;
01948
01949
01950 u_int32_t lg_bsize;
01951 u_int32_t lg_size;
01952 u_int32_t lg_regionmax;
01953 int lg_filemode;
01954
01955
01956 u_int32_t mp_gbytes;
01957 u_int32_t mp_bytes;
01958 u_int mp_ncache;
01959 size_t mp_mmapsize;
01960 int mp_maxopenfd;
01961 int mp_maxwrite;
01962 int
01963 mp_maxwrite_sleep;
01964
01965
01966 int rep_eid;
01967 int (*rep_send)
01968 __P((DB_ENV *, const DBT *, const DBT *,
01969 const DB_LSN *, int, u_int32_t));
01970
01971
01972 u_int32_t tx_max;
01973 time_t tx_timestamp;
01974 db_timeout_t tx_timeout;
01975
01976
01977 u_int32_t thr_nbucket;
01978 u_int32_t thr_max;
01979 void *thr_hashtab;
01980
01981
01982
01983
01984 pid_t pid_cache;
01985
01986
01987 char *db_home;
01988 char *db_abshome;
01989 char *db_log_dir;
01990 char *db_tmp_dir;
01991
01992 char **db_data_dir;
01993 int data_cnt;
01994 int data_next;
01995
01996 int db_mode;
01997 int dir_mode;
01998 void *env_lref;
01999 u_int32_t open_flags;
02000
02001 void *reginfo;
02002 DB_FH *lockfhp;
02003
02004 DB_FH *registry;
02005 u_int32_t registry_off;
02006
02007
02008
02009
02010
02011
02012 void (*thread_id) __P((DB_ENV *, pid_t *, db_threadid_t *));
02013 int (*is_alive) __P((DB_ENV *, pid_t, db_threadid_t));
02014 char *(*thread_id_string)
02015 __P((DB_ENV *, pid_t, db_threadid_t, char *));
02016
02017 int (**recover_dtab)
02018 __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
02019 size_t recover_dtab_size;
02020
02021
02022 void *cl_handle;
02023 u_int cl_id;
02024
02025 int db_ref;
02026
02027 long shm_key;
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042 db_mutex_t mtx_dblist;
02043 struct {
02044 struct __db *lh_first;
02045 } dblist;
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055 struct {
02056 struct __db_env *tqe_next;
02057 struct __db_env **tqe_prev;
02058 } links;
02059 struct __xa_txn {
02060 struct __db_txn *tqh_first;
02061 struct __db_txn **tqh_last;
02062 } xa_txn;
02063 int xa_rmid;
02064
02065 char *passwd;
02066 size_t passwd_len;
02067 void *crypto_handle;
02068 db_mutex_t mtx_mt;
02069 int mti;
02070 u_long *mt;
02071
02072
02073 void *api1_internal;
02074 void *api2_internal;
02075
02076 void *lg_handle;
02077 void *lk_handle;
02078 void *mp_handle;
02079 void *mutex_handle;
02080 void *rep_handle;
02081 void *tx_handle;
02082
02083
02084 int (*close) __P((DB_ENV *, u_int32_t));
02085 int (*dbremove) __P((DB_ENV *,
02086 DB_TXN *, const char *, const char *, u_int32_t));
02087 int (*dbrename) __P((DB_ENV *,
02088 DB_TXN *, const char *, const char *, const char *, u_int32_t));
02089 void (*err) __P((const DB_ENV *, int, const char *, ...));
02090 void (*errx) __P((const DB_ENV *, const char *, ...));
02091 int (*failchk) __P((DB_ENV *, u_int32_t));
02092 int (*fileid_reset) __P((DB_ENV *, const char *, u_int32_t));
02093 int (*get_cachesize) __P((DB_ENV *, u_int32_t *, u_int32_t *, int *));
02094 int (*get_data_dirs) __P((DB_ENV *, const char ***));
02095 int (*get_encrypt_flags) __P((DB_ENV *, u_int32_t *));
02096 void (*get_errfile) __P((DB_ENV *, FILE **));
02097 void (*get_errpfx) __P((DB_ENV *, const char **));
02098 int (*get_flags) __P((DB_ENV *, u_int32_t *));
02099 int (*get_home) __P((DB_ENV *, const char **));
02100 int (*get_lg_bsize) __P((DB_ENV *, u_int32_t *));
02101 int (*get_lg_dir) __P((DB_ENV *, const char **));
02102 int (*get_lg_filemode) __P((DB_ENV *, int *));
02103 int (*get_lg_max) __P((DB_ENV *, u_int32_t *));
02104 int (*get_lg_regionmax) __P((DB_ENV *, u_int32_t *));
02105 int (*get_lk_conflicts) __P((DB_ENV *, const u_int8_t **, int *));
02106 int (*get_lk_detect) __P((DB_ENV *, u_int32_t *));
02107 int (*get_lk_max_lockers) __P((DB_ENV *, u_int32_t *));
02108 int (*get_lk_max_locks) __P((DB_ENV *, u_int32_t *));
02109 int (*get_lk_max_objects) __P((DB_ENV *, u_int32_t *));
02110 int (*get_mp_max_openfd) __P((DB_ENV *, int *));
02111 int (*get_mp_max_write) __P((DB_ENV *, int *, int *));
02112 int (*get_mp_mmapsize) __P((DB_ENV *, size_t *));
02113 void (*get_msgfile) __P((DB_ENV *, FILE **));
02114 int (*get_open_flags) __P((DB_ENV *, u_int32_t *));
02115 int (*get_rep_limit) __P((DB_ENV *, u_int32_t *, u_int32_t *));
02116 int (*get_shm_key) __P((DB_ENV *, long *));
02117 int (*get_timeout) __P((DB_ENV *, db_timeout_t *, u_int32_t));
02118 int (*get_tmp_dir) __P((DB_ENV *, const char **));
02119 int (*get_tx_max) __P((DB_ENV *, u_int32_t *));
02120 int (*get_tx_timestamp) __P((DB_ENV *, time_t *));
02121 int (*get_verbose) __P((DB_ENV *, u_int32_t, int *));
02122 int (*is_bigendian) __P((void));
02123 int (*lock_detect) __P((DB_ENV *, u_int32_t, u_int32_t, int *));
02124 int (*lock_get) __P((DB_ENV *,
02125 u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *));
02126 int (*lock_id) __P((DB_ENV *, u_int32_t *));
02127 int (*lock_id_free) __P((DB_ENV *, u_int32_t));
02128 int (*lock_put) __P((DB_ENV *, DB_LOCK *));
02129 int (*lock_stat) __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t));
02130 int (*lock_stat_print) __P((DB_ENV *, u_int32_t));
02131 int (*lock_vec) __P((DB_ENV *,
02132 u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **));
02133 int (*log_archive) __P((DB_ENV *, char **[], u_int32_t));
02134 int (*log_cursor) __P((DB_ENV *, DB_LOGC **, u_int32_t));
02135 int (*log_file) __P((DB_ENV *, const DB_LSN *, char *, size_t));
02136 int (*log_flush) __P((DB_ENV *, const DB_LSN *));
02137 int (*log_printf) __P((DB_ENV *, DB_TXN *, const char *, ...));
02138 int (*log_put) __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t));
02139 int (*log_stat) __P((DB_ENV *, DB_LOG_STAT **, u_int32_t));
02140 int (*log_stat_print) __P((DB_ENV *, u_int32_t));
02141 int (*lsn_reset) __P((DB_ENV *, const char *, u_int32_t));
02142 int (*memp_fcreate) __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t));
02143 int (*memp_register) __P((DB_ENV *, int, int (*)(DB_ENV *,
02144 db_pgno_t, void *, DBT *), int (*)(DB_ENV *,
02145 db_pgno_t, void *, DBT *)));
02146 int (*memp_stat) __P((DB_ENV *,
02147 DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t));
02148 int (*memp_stat_print) __P((DB_ENV *, u_int32_t));
02149 int (*memp_sync) __P((DB_ENV *, DB_LSN *));
02150 int (*memp_trickle) __P((DB_ENV *, int, int *));
02151 int (*mutex_alloc) __P((DB_ENV *, u_int32_t, db_mutex_t *));
02152 int (*mutex_free) __P((DB_ENV *, db_mutex_t));
02153 int (*mutex_get_align) __P((DB_ENV *, u_int32_t *));
02154 int (*mutex_get_increment) __P((DB_ENV *, u_int32_t *));
02155 int (*mutex_get_max) __P((DB_ENV *, u_int32_t *));
02156 int (*mutex_get_tas_spins) __P((DB_ENV *, u_int32_t *));
02157 int (*mutex_lock) __P((DB_ENV *, db_mutex_t));
02158 int (*mutex_set_align) __P((DB_ENV *, u_int32_t));
02159 int (*mutex_set_increment) __P((DB_ENV *, u_int32_t));
02160 int (*mutex_set_max) __P((DB_ENV *, u_int32_t));
02161 int (*mutex_set_tas_spins) __P((DB_ENV *, u_int32_t));
02162 int (*mutex_stat) __P((DB_ENV *, DB_MUTEX_STAT **, u_int32_t));
02163 int (*mutex_stat_print) __P((DB_ENV *, u_int32_t));
02164 int (*mutex_unlock) __P((DB_ENV *, db_mutex_t));
02165 int (*open) __P((DB_ENV *, const char *, u_int32_t, int));
02166 int (*remove) __P((DB_ENV *, const char *, u_int32_t));
02167 int (*rep_elect)
02168 __P((DB_ENV *, int, int, int, u_int32_t, int *, u_int32_t));
02169 int (*rep_flush) __P((DB_ENV *));
02170 int (*rep_get_config) __P((DB_ENV *, u_int32_t, int *));
02171 int (*rep_process_message)
02172 __P((DB_ENV *, DBT *, DBT *, int *, DB_LSN *));
02173 int (*rep_set_config) __P((DB_ENV *, u_int32_t, int));
02174 int (*rep_start) __P((DB_ENV *, DBT *, u_int32_t));
02175 int (*rep_stat) __P((DB_ENV *, DB_REP_STAT **, u_int32_t));
02176 int (*rep_stat_print) __P((DB_ENV *, u_int32_t));
02177 int (*rep_sync) __P((DB_ENV *, u_int32_t));
02178 int (*set_alloc) __P((DB_ENV *, void *(*)(size_t),
02179 void *(*)(void *, size_t), void (*)(void *)));
02180 int (*set_app_dispatch)
02181 __P((DB_ENV *, int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops)));
02182 int (*set_cachesize) __P((DB_ENV *, u_int32_t, u_int32_t, int));
02183 int (*set_data_dir) __P((DB_ENV *, const char *));
02184 int (*set_encrypt) __P((DB_ENV *, const char *, u_int32_t));
02185 void (*set_errcall) __P((DB_ENV *,
02186 void (*)(const DB_ENV *, const char *, const char *)));
02187 void (*set_errfile) __P((DB_ENV *, FILE *));
02188 void (*set_errpfx) __P((DB_ENV *, const char *));
02189 int (*set_feedback) __P((DB_ENV *, void (*)(DB_ENV *, int, int)));
02190 int (*set_flags) __P((DB_ENV *, u_int32_t, int));
02191 int (*set_intermediate_dir) __P((DB_ENV *, int, u_int32_t));
02192 int (*set_isalive) __P((DB_ENV *,
02193 int (*)(DB_ENV *, pid_t, db_threadid_t)));
02194 int (*set_lg_bsize) __P((DB_ENV *, u_int32_t));
02195 int (*set_lg_dir) __P((DB_ENV *, const char *));
02196 int (*set_lg_filemode) __P((DB_ENV *, int));
02197 int (*set_lg_max) __P((DB_ENV *, u_int32_t));
02198 int (*set_lg_regionmax) __P((DB_ENV *, u_int32_t));
02199 int (*set_lk_conflicts) __P((DB_ENV *, u_int8_t *, int));
02200 int (*set_lk_detect) __P((DB_ENV *, u_int32_t));
02201 int (*set_lk_max) __P((DB_ENV *, u_int32_t));
02202 int (*set_lk_max_lockers) __P((DB_ENV *, u_int32_t));
02203 int (*set_lk_max_locks) __P((DB_ENV *, u_int32_t));
02204 int (*set_lk_max_objects) __P((DB_ENV *, u_int32_t));
02205 int (*set_mp_max_openfd) __P((DB_ENV *, int));
02206 int (*set_mp_max_write) __P((DB_ENV *, int, int));
02207 int (*set_mp_mmapsize) __P((DB_ENV *, size_t));
02208 void (*set_msgcall)
02209 __P((DB_ENV *, void (*)(const DB_ENV *, const char *)));
02210 void (*set_msgfile) __P((DB_ENV *, FILE *));
02211 int (*set_paniccall) __P((DB_ENV *, void (*)(DB_ENV *, int)));
02212 int (*set_rep_limit) __P((DB_ENV *, u_int32_t, u_int32_t));
02213 int (*set_rep_request) __P((DB_ENV *, u_int32_t, u_int32_t));
02214 int (*set_rep_transport) __P((DB_ENV *, int, int (*)(DB_ENV *,
02215 const DBT *, const DBT *, const DB_LSN *, int, u_int32_t)));
02216 int (*set_rpc_server)
02217 __P((DB_ENV *, void *, const char *, long, long, u_int32_t));
02218 int (*set_shm_key) __P((DB_ENV *, long));
02219 int (*set_thread_count) __P((DB_ENV *, u_int32_t));
02220 int (*set_thread_id) __P((DB_ENV *,
02221 void (*)(DB_ENV *, pid_t *, db_threadid_t *)));
02222 int (*set_thread_id_string) __P((DB_ENV *,
02223 char *(*)(DB_ENV *, pid_t, db_threadid_t, char *)));
02224 int (*set_timeout) __P((DB_ENV *, db_timeout_t, u_int32_t));
02225 int (*set_tmp_dir) __P((DB_ENV *, const char *));
02226 int (*set_tx_max) __P((DB_ENV *, u_int32_t));
02227 int (*set_tx_timestamp) __P((DB_ENV *, time_t *));
02228 int (*set_verbose) __P((DB_ENV *, u_int32_t, int));
02229 int (*stat_print) __P((DB_ENV *, u_int32_t));
02230 int (*txn_begin) __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t));
02231 int (*txn_checkpoint) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t));
02232 int (*txn_recover)
02233 __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t));
02234 int (*txn_stat) __P((DB_ENV *, DB_TXN_STAT **, u_int32_t));
02235 int (*txn_stat_print) __P((DB_ENV *, u_int32_t));
02236
02237
02238
02239 int (*prdbt) __P((DBT *,
02240 int, const char *, void *, int (*)(void *, const void *), int));
02241
02242
02243 #define DB_TEST_ELECTINIT 1
02244 #define DB_TEST_ELECTVOTE1 2
02245 #define DB_TEST_POSTDESTROY 3
02246 #define DB_TEST_POSTLOG 4
02247 #define DB_TEST_POSTLOGMETA 5
02248 #define DB_TEST_POSTOPEN 6
02249 #define DB_TEST_POSTSYNC 7
02250 #define DB_TEST_PREDESTROY 8
02251 #define DB_TEST_PREOPEN 9
02252 #define DB_TEST_SUBDB_LOCKS 10
02253 int test_abort;
02254 int test_check;
02255 int test_copy;
02256
02257 #define DB_ENV_AUTO_COMMIT 0x0000001
02258 #define DB_ENV_CDB 0x0000002
02259 #define DB_ENV_CDB_ALLDB 0x0000004
02260 #define DB_ENV_CREATE 0x0000008
02261 #define DB_ENV_DBLOCAL 0x0000010
02262 #define DB_ENV_DIRECT_DB 0x0000020
02263 #define DB_ENV_DIRECT_LOG 0x0000040
02264 #define DB_ENV_DSYNC_DB 0x0000080
02265 #define DB_ENV_DSYNC_LOG 0x0000100
02266 #define DB_ENV_FATAL 0x0000200
02267 #define DB_ENV_LOCKDOWN 0x0000400
02268 #define DB_ENV_LOG_AUTOREMOVE 0x0000800
02269 #define DB_ENV_LOG_INMEMORY 0x0001000
02270 #define DB_ENV_NOLOCKING 0x0002000
02271 #define DB_ENV_NOMMAP 0x0004000
02272 #define DB_ENV_NOPANIC 0x0008000
02273 #define DB_ENV_OPEN_CALLED 0x0010000
02274 #define DB_ENV_OVERWRITE 0x0020000
02275 #define DB_ENV_PRIVATE 0x0040000
02276 #define DB_ENV_REGION_INIT 0x0080000
02277 #define DB_ENV_RPCCLIENT 0x0100000
02278 #define DB_ENV_RPCCLIENT_GIVEN 0x0200000
02279 #define DB_ENV_SYSTEM_MEM 0x0400000
02280 #define DB_ENV_THREAD 0x0800000
02281 #define DB_ENV_TIME_NOTGRANTED 0x1000000
02282 #define DB_ENV_TXN_NOSYNC 0x2000000
02283 #define DB_ENV_TXN_WRITE_NOSYNC 0x4000000
02284 #define DB_ENV_YIELDCPU 0x8000000
02285 u_int32_t flags;
02286 };
02287
02288 #ifndef DB_DBM_HSEARCH
02289 #define DB_DBM_HSEARCH 0
02290 #endif
02291 #if DB_DBM_HSEARCH != 0
02292
02293
02294
02295 typedef struct __db DBM;
02296
02297 #define DBM_INSERT 0
02298 #define DBM_REPLACE 1
02299
02300
02301
02302
02303
02304 #define DBM_SUFFIX ".db"
02305
02306 #if defined(_XPG4_2)
02307 typedef struct {
02308 char *dptr;
02309 size_t dsize;
02310 } datum;
02311 #else
02312 typedef struct {
02313 char *dptr;
02314 int dsize;
02315 } datum;
02316 #endif
02317
02318
02319
02320
02321
02322 #define dbm_clearerr(a) __db_ndbm_clearerr(a)
02323 #define dbm_close(a) __db_ndbm_close(a)
02324 #define dbm_delete(a, b) __db_ndbm_delete(a, b)
02325 #define dbm_dirfno(a) __db_ndbm_dirfno(a)
02326 #define dbm_error(a) __db_ndbm_error(a)
02327 #define dbm_fetch(a, b) __db_ndbm_fetch(a, b)
02328 #define dbm_firstkey(a) __db_ndbm_firstkey(a)
02329 #define dbm_nextkey(a) __db_ndbm_nextkey(a)
02330 #define dbm_open(a, b, c) __db_ndbm_open(a, b, c)
02331 #define dbm_pagfno(a) __db_ndbm_pagfno(a)
02332 #define dbm_rdonly(a) __db_ndbm_rdonly(a)
02333 #define dbm_store(a, b, c, d) \
02334 __db_ndbm_store(a, b, c, d)
02335
02336
02337
02338
02339
02340
02341
02342
02343 #define dbminit(a) __db_dbm_init(a)
02344 #define dbmclose __db_dbm_close
02345 #if !defined(__cplusplus)
02346 #define delete(a) __db_dbm_delete(a)
02347 #endif
02348 #define fetch(a) __db_dbm_fetch(a)
02349 #define firstkey __db_dbm_firstkey
02350 #define nextkey(a) __db_dbm_nextkey(a)
02351 #define store(a, b) __db_dbm_store(a, b)
02352
02353
02354
02355
02356 typedef enum {
02357 FIND, ENTER
02358 } ACTION;
02359
02360 typedef struct entry {
02361 char *key;
02362 char *data;
02363 } ENTRY;
02364
02365 #define hcreate(a) __db_hcreate(a)
02366 #define hdestroy __db_hdestroy
02367 #define hsearch(a, b) __db_hsearch(a, b)
02368
02369 #endif
02370
02371 #if defined(__cplusplus)
02372 }
02373 #endif
02374 #endif
02375
02376
02377 #ifndef _DB_EXT_PROT_IN_
02378 #define _DB_EXT_PROT_IN_
02379
02380 #if defined(__cplusplus)
02381 extern "C" {
02382 #endif
02383
02384 int db_create __P((DB **, DB_ENV *, u_int32_t));
02385 char *db_strerror __P((int));
02386 int db_env_create __P((DB_ENV **, u_int32_t));
02387 char *db_version __P((int *, int *, int *));
02388 int log_compare __P((const DB_LSN *, const DB_LSN *));
02389 int db_env_set_func_close __P((int (*)(int)));
02390 int db_env_set_func_dirfree __P((void (*)(char **, int)));
02391 int db_env_set_func_dirlist __P((int (*)(const char *, char ***, int *)));
02392 int db_env_set_func_exists __P((int (*)(const char *, int *)));
02393 int db_env_set_func_free __P((void (*)(void *)));
02394 int db_env_set_func_fsync __P((int (*)(int)));
02395 int db_env_set_func_ftruncate __P((int (*)(int, off_t)));
02396 int db_env_set_func_ioinfo __P((int (*)(const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)));
02397 int db_env_set_func_malloc __P((void *(*)(size_t)));
02398 int db_env_set_func_map __P((int (*)(char *, size_t, int, int, void **)));
02399 int db_env_set_func_pread __P((ssize_t (*)(int, void *, size_t, off_t)));
02400 int db_env_set_func_pwrite __P((ssize_t (*)(int, const void *, size_t, off_t)));
02401 int db_env_set_func_open __P((int (*)(const char *, int, ...)));
02402 int db_env_set_func_read __P((ssize_t (*)(int, void *, size_t)));
02403 int db_env_set_func_realloc __P((void *(*)(void *, size_t)));
02404 int db_env_set_func_rename __P((int (*)(const char *, const char *)));
02405 int db_env_set_func_seek __P((int (*)(int, off_t, int)));
02406 int db_env_set_func_sleep __P((int (*)(u_long, u_long)));
02407 int db_env_set_func_unlink __P((int (*)(const char *)));
02408 int db_env_set_func_unmap __P((int (*)(void *, size_t)));
02409 int db_env_set_func_write __P((ssize_t (*)(int, const void *, size_t)));
02410 int db_env_set_func_yield __P((int (*)(void)));
02411 int db_sequence_create __P((DB_SEQUENCE **, DB *, u_int32_t));
02412 #if DB_DBM_HSEARCH != 0
02413 int __db_ndbm_clearerr __P((DBM *));
02414 void __db_ndbm_close __P((DBM *));
02415 int __db_ndbm_delete __P((DBM *, datum));
02416 int __db_ndbm_dirfno __P((DBM *));
02417 int __db_ndbm_error __P((DBM *));
02418 datum __db_ndbm_fetch __P((DBM *, datum));
02419 datum __db_ndbm_firstkey __P((DBM *));
02420 datum __db_ndbm_nextkey __P((DBM *));
02421 DBM *__db_ndbm_open __P((const char *, int, int));
02422 int __db_ndbm_pagfno __P((DBM *));
02423 int __db_ndbm_rdonly __P((DBM *));
02424 int __db_ndbm_store __P((DBM *, datum, datum, int));
02425 int __db_dbm_close __P((void));
02426 int __db_dbm_delete __P((datum));
02427 datum __db_dbm_fetch __P((datum));
02428 datum __db_dbm_firstkey __P((void));
02429 int __db_dbm_init __P((char *));
02430 datum __db_dbm_nextkey __P((datum));
02431 int __db_dbm_store __P((datum, datum));
02432 #endif
02433 #if DB_DBM_HSEARCH != 0
02434 int __db_hcreate __P((size_t));
02435 ENTRY *__db_hsearch __P((ENTRY, ACTION));
02436 void __db_hdestroy __P((void));
02437 #endif
02438
02439 #if defined(__cplusplus)
02440 }
02441 #endif
02442 #endif