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