diff options
Diffstat (limited to 'db2/include')
-rw-r--r-- | db2/include/btree_auto.h | 19 | ||||
-rw-r--r-- | db2/include/btree_ext.h | 17 | ||||
-rw-r--r-- | db2/include/clib_ext.h | 2 | ||||
-rw-r--r-- | db2/include/common_ext.h | 3 | ||||
-rw-r--r-- | db2/include/db.h.src | 135 | ||||
-rw-r--r-- | db2/include/db_am.h | 6 | ||||
-rw-r--r-- | db2/include/db_auto.h | 1 | ||||
-rw-r--r-- | db2/include/db_cxx.h | 19 | ||||
-rw-r--r-- | db2/include/db_ext.h | 6 | ||||
-rw-r--r-- | db2/include/db_int.h.src | 28 | ||||
-rw-r--r-- | db2/include/hash.h | 6 | ||||
-rw-r--r-- | db2/include/hash_auto.h | 18 | ||||
-rw-r--r-- | db2/include/hash_ext.h | 15 | ||||
-rw-r--r-- | db2/include/lock.h | 5 | ||||
-rw-r--r-- | db2/include/lock_ext.h | 2 | ||||
-rw-r--r-- | db2/include/log.h | 19 | ||||
-rw-r--r-- | db2/include/log_ext.h | 2 | ||||
-rw-r--r-- | db2/include/mp.h | 41 | ||||
-rw-r--r-- | db2/include/mp_ext.h | 2 | ||||
-rw-r--r-- | db2/include/mutex_ext.h | 4 | ||||
-rw-r--r-- | db2/include/os_ext.h | 24 | ||||
-rw-r--r-- | db2/include/os_func.h | 76 | ||||
-rw-r--r-- | db2/include/txn.h | 8 | ||||
-rw-r--r-- | db2/include/txn_ext.h | 2 |
24 files changed, 326 insertions, 134 deletions
diff --git a/db2/include/btree_auto.h b/db2/include/btree_auto.h index b422e1db1b..041b80f196 100644 --- a/db2/include/btree_auto.h +++ b/db2/include/btree_auto.h @@ -58,6 +58,7 @@ typedef struct _bam_rsplit_args { u_int32_t fileid; db_pgno_t pgno; DBT pgdbt; + db_pgno_t nrec; DBT rootent; DB_LSN rootlsn; } __bam_rsplit_args; @@ -105,4 +106,22 @@ typedef struct _bam_cdel_args { u_int32_t indx; } __bam_cdel_args; + +#define DB_bam_repl (DB_bam_BEGIN + 8) + +typedef struct _bam_repl_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; + u_int32_t isdeleted; + DBT orig; + DBT repl; + u_int32_t prefix; + u_int32_t suffix; +} __bam_repl_args; + #endif diff --git a/db2/include/btree_ext.h b/db2/include/btree_ext.h index 9133c58c6b..bbe0d971b2 100644 --- a/db2/include/btree_ext.h +++ b/db2/include/btree_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __bam_close __P((DB *)); int __bam_sync __P((DB *, int)); int __bam_cmp __P((DB *, const DBT *, EPG *)); @@ -35,6 +35,7 @@ int __bam_pget __P((DB *, PAGE **, db_pgno_t *, int)); int __bam_put __P((DB *, DB_TXN *, DBT *, DBT *, int)); int __bam_iitem __P((DB *, PAGE **, db_indx_t *, DBT *, DBT *, int, int)); +int __bam_ritem __P((DB *, PAGE *, u_int32_t, DBT *)); int __bam_pg_alloc_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __bam_pg_free_recover @@ -49,6 +50,8 @@ int __bam_cadjust_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __bam_cdel_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_repl_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __ram_open __P((DB *, DBTYPE, DB_INFO *)); int __ram_cursor __P((DB *, DB_TXN *, DBC **)); int __ram_close __P((DB *)); @@ -94,8 +97,8 @@ int __bam_split_print int __bam_split_read __P((void *, __bam_split_args **)); int __bam_rsplit_log __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DBT *, DBT *, - DB_LSN *)); + u_int32_t, db_pgno_t, DBT *, db_pgno_t, + DBT *, DB_LSN *)); int __bam_rsplit_print __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __bam_rsplit_read __P((void *, __bam_rsplit_args **)); @@ -119,5 +122,13 @@ int __bam_cdel_log int __bam_cdel_print __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __bam_cdel_read __P((void *, __bam_cdel_args **)); +int __bam_repl_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + u_int32_t, DBT *, DBT *, u_int32_t, + u_int32_t)); +int __bam_repl_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_repl_read __P((void *, __bam_repl_args **)); int __bam_init_print __P((DB_ENV *)); int __bam_init_recover __P((DB_ENV *)); diff --git a/db2/include/clib_ext.h b/db2/include/clib_ext.h index 8ccd2b559f..91e4a13fa5 100644 --- a/db2/include/clib_ext.h +++ b/db2/include/clib_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ #ifdef __STDC__ void err __P((int eval, const char *, ...)); #else diff --git a/db2/include/common_ext.h b/db2/include/common_ext.h index 9840162a12..b814582abd 100644 --- a/db2/include/common_ext.h +++ b/db2/include/common_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __db_appname __P((DB_ENV *, APPNAME, const char *, const char *, int *, char **)); int __db_apprec __P((DB_ENV *, int)); @@ -24,6 +24,7 @@ int __db_ferr __P((const DB_ENV *, const char *, int)); u_int32_t __db_log2 __P((u_int32_t)); int __db_rcreate __P((DB_ENV *, APPNAME, const char *, const char *, int, size_t, int *, void *)); +int __db_rinit __P((DB_ENV *, RLAYOUT *, int, size_t, int)); int __db_ropen __P((DB_ENV *, APPNAME, const char *, const char *, int, int *, void *)); int __db_rclose __P((DB_ENV *, int, void *)); diff --git a/db2/include/db.h.src b/db2/include/db.h.src index 63d9603dba..3cc2bfd4fc 100644 --- a/db2/include/db.h.src +++ b/db2/include/db.h.src @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)db.h.src 10.77 (Sleepycat) 9/24/97 + * @(#)db.h.src 10.91 (Sleepycat) 11/3/97 */ #ifndef _DB_H_ @@ -28,9 +28,15 @@ * XXX * Handle function prototypes and the keyword "const". This steps on name * space that DB doesn't control, but all of the other solutions are worse. + * + * XXX + * While Microsoft's compiler is ANSI C compliant, it doesn't have _STDC_ + * defined by default, you specify a command line flag or #pragma to turn + * it on. Don't do that, however, because some of Microsoft's own header + * files won't compile. */ #undef __P -#if defined(__STDC__) || defined(__cplusplus) +#if defined(__STDC__) || defined(__cplusplus) || defined(_MSC_VER) #define __P(protos) protos /* ANSI C prototypes */ #else #define const @@ -67,8 +73,8 @@ #define DB_VERSION_MAJOR 2 #define DB_VERSION_MINOR 3 -#define DB_VERSION_PATCH 10 -#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.10: (9/24/97)" +#define DB_VERSION_PATCH 12 +#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.12: (11/3/97)" typedef u_int32_t db_pgno_t; /* Page number type. */ typedef u_int16_t db_indx_t; /* Page offset type. */ @@ -93,6 +99,7 @@ struct __db_lockregion; typedef struct __db_lockregion DB_LOCKREGION; struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB; struct __db_log; typedef struct __db_log DB_LOG; +struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT; struct __db_lsn; typedef struct __db_lsn DB_LSN; struct __db_mpool; typedef struct __db_mpool DB_MPOOL; struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT; @@ -122,6 +129,31 @@ struct __db_dbt { }; /* + * DB configuration. There are a set of functions which the application + * can replace with its own versions. + */ +#define DB_FUNC_CALLOC 1 /* ANSI C calloc. */ +#define DB_FUNC_CLOSE 2 /* POSIX 1003.1 close. */ +#define DB_FUNC_DIRFREE 3 /* DB: free directory list. */ +#define DB_FUNC_DIRLIST 4 /* DB: create directory list. */ +#define DB_FUNC_EXISTS 5 /* DB: return if file exists. */ +#define DB_FUNC_FREE 6 /* ANSI C free. */ +#define DB_FUNC_FSYNC 7 /* POSIX 1003.1 fsync. */ +#define DB_FUNC_IOINFO 8 /* DB: return file I/O information. */ +#define DB_FUNC_MALLOC 9 /* ANSI C malloc. */ +#define DB_FUNC_MAP 10 /* DB: map file into shared memory. */ +#define DB_FUNC_OPEN 11 /* POSIX 1003.1 open. */ +#define DB_FUNC_READ 12 /* POSIX 1003.1 read. */ +#define DB_FUNC_REALLOC 13 /* ANSI C realloc. */ +#define DB_FUNC_SEEK 14 /* POSIX 1003.1 lseek. */ +#define DB_FUNC_SLEEP 15 /* DB: sleep secs/usecs. */ +#define DB_FUNC_STRDUP 16 /* ANSI C strdup. */ +#define DB_FUNC_UNLINK 17 /* POSIX 1003.1 unlink. */ +#define DB_FUNC_UNMAP 18 /* DB: unmap shared memory file. */ +#define DB_FUNC_WRITE 19 /* POSIX 1003.1 write. */ +#define DB_FUNC_YIELD 20 /* DB: yield thread to scheduler. */ + +/* * Database configuration and initialization. */ /* @@ -134,21 +166,20 @@ struct __db_dbt { /* * Flags understood by db_appinit(3). * - * DB_APP_INIT and DB_MUTEXDEBUG are internal only, and not documented. + * DB_MUTEXDEBUG is internal only, and not documented. */ /* 0x00007 COMMON MASK. */ -#define DB_APP_INIT 0x00008 /* Appinit called, paths initialized. */ -#define DB_INIT_LOCK 0x00010 /* Initialize locking. */ -#define DB_INIT_LOG 0x00020 /* Initialize logging. */ -#define DB_INIT_MPOOL 0x00040 /* Initialize mpool. */ -#define DB_INIT_TXN 0x00080 /* Initialize transactions. */ -#define DB_MPOOL_PRIVATE 0x00100 /* Mpool: private memory pool. */ -#define DB_MUTEXDEBUG 0x00200 /* Do not get/set mutexes in regions. */ -#define DB_RECOVER 0x00400 /* Run normal recovery. */ -#define DB_RECOVER_FATAL 0x00800 /* Run catastrophic recovery. */ -#define DB_TXN_NOSYNC 0x01000 /* Do not sync log on commit. */ -#define DB_USE_ENVIRON 0x02000 /* Use the environment. */ -#define DB_USE_ENVIRON_ROOT 0x04000 /* Use the environment if root. */ +#define DB_INIT_LOCK 0x00008 /* Initialize locking. */ +#define DB_INIT_LOG 0x00010 /* Initialize logging. */ +#define DB_INIT_MPOOL 0x00020 /* Initialize mpool. */ +#define DB_INIT_TXN 0x00040 /* Initialize transactions. */ +#define DB_MPOOL_PRIVATE 0x00080 /* Mpool: private memory pool. */ +#define DB_MUTEXDEBUG 0x00100 /* Do not get/set mutexes in regions. */ +#define DB_RECOVER 0x00200 /* Run normal recovery. */ +#define DB_RECOVER_FATAL 0x00400 /* Run catastrophic recovery. */ +#define DB_TXN_NOSYNC 0x00800 /* Do not sync log on commit. */ +#define DB_USE_ENVIRON 0x01000 /* Use the environment. */ +#define DB_USE_ENVIRON_ROOT 0x02000 /* Use the environment if root. */ /* CURRENTLY UNUSED LOCK FLAGS. */ #define DB_TXN_LOCK_2PL 0x00000 /* Two-phase locking. */ @@ -209,7 +240,6 @@ struct __db_env { int lk_modes; /* Number of lock modes in table. */ unsigned int lk_max; /* Maximum number of locks. */ u_int32_t lk_detect; /* Deadlock detect on every conflict. */ - int (*db_yield) __P((void)); /* Yield function for threads. */ /* Logging. */ DB_LOG *lg_info; /* Return from log_open(). */ @@ -226,6 +256,9 @@ struct __db_env { int (*tx_recover) /* Dispatch function for recovery. */ __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +#define DB_ENV_APPINIT 0x01 /* Paths initialized by db_appinit(). */ +#define DB_ENV_STANDALONE 0x02 /* Test: freestanding environment. */ +#define DB_ENV_THREAD 0x04 /* DB_ENV is multi-threaded. */ u_int32_t flags; /* Flags. */ }; @@ -301,7 +334,7 @@ struct __db_info { #define DB_CURRENT 0x000010 /* c_get(), c_put(), log_get() */ #define DB_FIRST 0x000020 /* c_get(), log_get() */ #define DB_FLUSH 0x000040 /* log_put() */ -#define DB_GET_RECNO 0x000080 /* c_get() */ +#define DB_GET_RECNO 0x000080 /* get(), c_get() */ #define DB_KEYFIRST 0x000100 /* c_put() */ #define DB_KEYLAST 0x000200 /* c_put() */ #define DB_LAST 0x000400 /* c_get(), log_get() */ @@ -312,7 +345,7 @@ struct __db_info { #define DB_RECORDCOUNT 0x008000 /* stat() */ #define DB_SET 0x010000 /* c_get(), log_get() */ #define DB_SET_RANGE 0x020000 /* c_get() */ -#define DB_SET_RECNO 0x040000 /* get(), c_get() */ +#define DB_SET_RECNO 0x040000 /* c_get() */ /* DB (user visible) error return codes. */ #define DB_INCOMPLETE ( -1) /* Sync didn't finish. */ @@ -472,6 +505,8 @@ struct __db_bt_stat { u_int32_t bt_get; /* Items retrieved. */ u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ + u_int32_t bt_magic; /* Magic number. */ + u_int32_t bt_version; /* Version number. */ }; #if defined(__cplusplus) @@ -479,6 +514,7 @@ extern "C" { #endif int db_appinit __P((const char *, char * const *, DB_ENV *, int)); int db_appexit __P((DB_ENV *)); +int db_jump_set __P((void *, int)); int db_open __P((const char *, DBTYPE, int, int, DB_ENV *, DB_INFO *, DB **)); char *db_version __P((int *, int *, int *)); #if defined(__cplusplus) @@ -576,6 +612,22 @@ struct __db_lsn { u_int32_t offset; /* File offset. */ }; +/* Log statistics structure. */ +struct __db_log_stat { + u_int32_t st_magic; /* Log file magic number. */ + u_int32_t st_version; /* Log file version number. */ + int st_mode; /* Log file mode. */ + u_int32_t st_lg_max; /* Maximum log file size. */ + u_int32_t st_w_bytes; /* Bytes to log. */ + u_int32_t st_w_mbytes; /* Megabytes to log. */ + u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ + u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ + u_int32_t st_wcount; /* Total syncs to the log. */ + u_int32_t st_scount; /* Total writes to the log. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ +}; + #if defined(__cplusplus) extern "C" { #endif @@ -588,6 +640,7 @@ int log_get __P((DB_LOG *, DB_LSN *, DBT *, int)); int log_open __P((const char *, int, int, DB_ENV *, DB_LOG **)); int log_put __P((DB_LOG *, DB_LSN *, const DBT *, int)); int log_register __P((DB_LOG *, DB *, const char *, DBTYPE, u_int32_t *)); +int log_stat __P((DB_LOG *, DB_LOG_STAT **, void *(*)(size_t))); int log_unlink __P((const char *, int, DB_ENV *)); int log_unregister __P((DB_LOG *, u_int32_t)); #if defined(__cplusplus) @@ -610,30 +663,35 @@ int log_unregister __P((DB_LOG *, u_int32_t)); /* Mpool statistics structure. */ struct __db_mpool_stat { size_t st_cachesize; /* Cache size. */ - unsigned long st_cache_hit; /* Pages found in the cache. */ - unsigned long st_cache_miss; /* Pages not found in the cache. */ - unsigned long st_map; /* Pages from mapped files. */ - unsigned long st_page_create; /* Pages created in the cache. */ - unsigned long st_page_in; /* Pages read in. */ - unsigned long st_page_out; /* Pages written out. */ - unsigned long st_ro_evict; /* Read-only pages evicted. */ - unsigned long st_rw_evict; /* Read-write pages evicted. */ - unsigned long st_hash_buckets; /* Number of hash buckets. */ - unsigned long st_hash_searches; /* Total hash chain searches. */ - unsigned long st_hash_longest; /* Longest hash chain searched. */ - unsigned long st_hash_examined; /* Total hash entries searched. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ + u_int32_t st_ro_evict; /* Clean pages forced from the cache. */ + u_int32_t st_rw_evict; /* Dirty pages forced from the cache. */ + u_int32_t st_hash_buckets; /* Number of hash buckets. */ + u_int32_t st_hash_searches; /* Total hash chain searches. */ + u_int32_t st_hash_longest; /* Longest hash chain searched. */ + u_int32_t st_hash_examined; /* Total hash entries searched. */ + u_int32_t st_page_clean; /* Clean pages. */ + u_int32_t st_page_dirty; /* Dirty pages. */ + u_int32_t st_page_trickle; /* Pages written by memp_trickle. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ }; /* Mpool file statistics structure. */ struct __db_mpool_fstat { char *file_name; /* File name. */ size_t st_pagesize; /* Page size. */ - unsigned long st_cache_hit; /* Pages found in the cache. */ - unsigned long st_cache_miss; /* Pages not found in the cache. */ - unsigned long st_map; /* Pages from mapped files. */ - unsigned long st_page_create; /* Pages created in the cache. */ - unsigned long st_page_in; /* Pages read in. */ - unsigned long st_page_out; /* Pages written out. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ }; #if defined(__cplusplus) @@ -654,6 +712,7 @@ int memp_register __P((DB_MPOOL *, int, int memp_stat __P((DB_MPOOL *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, void *(*)(size_t))); int memp_sync __P((DB_MPOOL *, DB_LSN *)); +int memp_trickle __P((DB_MPOOL *, int, int *)); int memp_unlink __P((const char *, int, DB_ENV *)); #if defined(__cplusplus) }; diff --git a/db2/include/db_am.h b/db2/include/db_am.h index 5814ff88c3..0ea24be667 100644 --- a/db2/include/db_am.h +++ b/db2/include/db_am.h @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)db_am.h 10.6 (Sleepycat) 8/27/97 + * @(#)db_am.h 10.7 (Sleepycat) 10/25/97 */ #ifndef _DB_AM_H #define _DB_AM_H @@ -49,7 +49,7 @@ } #define REC_CLOSE { \ if (argp != NULL) \ - free (argp); \ + __db_free(argp); \ if (file_dbp != NULL) { \ F_CLR(file_dbp, DB_AM_RECOVER); \ if (F_ISSET(file_dbp, DB_AM_THREAD)) \ @@ -67,7 +67,7 @@ } #define REC_NOOP_CLOSE { \ if (argp != NULL) \ - free (argp); \ + __db_free(argp); \ return (ret); \ } diff --git a/db2/include/db_auto.h b/db2/include/db_auto.h index 7478173740..4c7b4da970 100644 --- a/db2/include/db_auto.h +++ b/db2/include/db_auto.h @@ -59,6 +59,7 @@ typedef struct _db_ovref_args { DB_LSN prev_lsn; u_int32_t fileid; db_pgno_t pgno; + int32_t adjust; DB_LSN lsn; } __db_ovref_args; diff --git a/db2/include/db_cxx.h b/db2/include/db_cxx.h index 611d967ef9..01d1231092 100644 --- a/db2/include/db_cxx.h +++ b/db2/include/db_cxx.h @@ -4,12 +4,11 @@ * Copyright (c) 1997 * Sleepycat Software. All rights reserved. * - * @(#)db_cxx.h 10.8 (Sleepycat) 9/20/97 + * @(#)db_cxx.h 10.12 (Sleepycat) 10/25/97 */ #ifndef _DB_CXX_H_ #define _DB_CXX_H_ - // // C++ assumptions: // @@ -264,7 +263,7 @@ public: // Normally these would be called register and unregister to // parallel the C interface, but "register" is a reserved word. // - int db_register(Db *dbp, const char *name, u_int32_t *fidp); + int db_register(Db *dbp, const char *name, DBTYPE type, u_int32_t *fidp); int db_unregister(u_int32_t fid); // Create or remove new log files @@ -353,6 +352,7 @@ public: int stat(DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT ***fsp, void *(*db_malloc)(size_t)); int sync(DbLsn *lsn); + int trickle(int pct, int *nwrotep); // Create or remove new mpool files // @@ -598,6 +598,11 @@ public: // int appinit(const char *homeDir, char *const *db_config, int flags); + // Called automatically when DbEnv is destroyed, or can be + // called at any time to shut down Db. + // + int appexit(); + //////////////////////////////////////////////////////////////// // simple get/set access methods // @@ -675,11 +680,6 @@ public: u_int32_t get_lk_detect() const; void set_lk_detect(u_int32_t); - // Yield function for threads. - typedef int (*db_yield_fcn) (void); - db_yield_fcn get_yield() const; - void set_yield(db_yield_fcn); - //////////////////////////////////////////////////////////////// // Logging. @@ -783,7 +783,7 @@ class _exported Db public: int close(int flags); int cursor(DbTxn *txnid, Dbc **cursorp); - int del(Dbt *key, DbTxn *txnid); + int del(DbTxn *txnid, Dbt *key, int flags); int fd(int *fdp); int get(DbTxn *txnid, Dbt *key, Dbt *data, int flags); int put(DbTxn *txnid, Dbt *key, Dbt *data, int flags); @@ -884,5 +884,4 @@ private: Dbc(const Dbc &); Dbc &operator = (const Dbc &); }; - #endif /* !_DB_CXX_H_ */ diff --git a/db2/include/db_ext.h b/db2/include/db_ext.h index b18b10ff7f..f9b3b3a214 100644 --- a/db2/include/db_ext.h +++ b/db2/include/db_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __db_pgerr __P((DB *, db_pgno_t)); int __db_pgfmt __P((DB *, db_pgno_t)); int __db_addrem_log @@ -25,7 +25,7 @@ int __db_big_print int __db_big_read __P((void *, __db_big_args **)); int __db_ovref_log __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *)); + u_int32_t, db_pgno_t, int32_t, DB_LSN *)); int __db_ovref_print __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __db_ovref_read __P((void *, __db_ovref_args **)); @@ -79,7 +79,7 @@ int __db_goff __P((DB *, DBT *, u_int32_t, db_pgno_t, void **, u_int32_t *)); int __db_poff __P((DB *, const DBT *, db_pgno_t *, int (*)(DB *, u_int32_t, PAGE **))); -int __db_ioff __P((DB *, db_pgno_t)); +int __db_ovref __P((DB *, db_pgno_t, int)); int __db_doff __P((DB *, db_pgno_t, int (*)(DB *, PAGE *))); int __db_moff __P((DB *, const DBT *, db_pgno_t)); void __db_loadme __P((void)); diff --git a/db2/include/db_int.h.src b/db2/include/db_int.h.src index ebadb35d36..abd93a6e8e 100644 --- a/db2/include/db_int.h.src +++ b/db2/include/db_int.h.src @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)db_int.h.src 10.30 (Sleepycat) 9/23/97 + * @(#)db_int.h.src 10.36 (Sleepycat) 10/31/97 */ #ifndef _DB_INTERNAL_H_ @@ -12,6 +12,7 @@ #include "db.h" /* Standard DB include file. */ #include "queue.h" +#include "os_func.h" #include "os_ext.h" /******************************************************* @@ -64,12 +65,16 @@ #undef SSZA #define SSZA(name, field) ((int)&(((name *)0)->field[0])) +/* Macros to return per-process address, offsets based on shared regions. */ +#define R_ADDR(base, offset) ((void *)((u_int8_t *)((base)->addr) + offset)) +#define R_OFFSET(base, p) ((u_int8_t *)(p) - (u_int8_t *)(base)->addr) + /* Free and free-string macros that overwrite memory during debugging. */ #ifdef DEBUG #undef FREE #define FREE(p, len) { \ memset(p, 0xff, len); \ - free(p); \ + __db_free(p); \ } #undef FREES #define FREES(p) { \ @@ -78,18 +83,18 @@ #else #undef FREE #define FREE(p, len) { \ - free(p); \ + __db_free(p); \ } #undef FREES #define FREES(p) { \ - free(p); \ + __db_free(p); \ } #endif /* Structure used to print flag values. */ typedef struct __fn { u_int32_t mask; /* Flag value. */ - char *name; /* Flag name. */ + const char *name; /* Flag name. */ } FN; /* Set, clear and test flags. */ @@ -163,10 +168,8 @@ typedef struct _db_mutex_t { off_t off; /* Backing file offset. */ u_long pid; /* Lock holder: 0 or process pid. */ #endif -#ifdef MUTEX_STATISTICS - u_long mutex_set_wait; /* Blocking mutex: required waiting. */ - u_long mutex_set_nowait; /* Blocking mutex: without waiting. */ -#endif + u_int32_t mutex_set_wait; /* Granted after wait. */ + u_int32_t mutex_set_nowait; /* Granted without waiting. */ } db_mutex_t; #include "mutex_ext.h" @@ -177,11 +180,10 @@ typedef struct _db_mutex_t { /* Lock/unlock a DB thread. */ #define DB_THREAD_LOCK(dbp) \ (F_ISSET(dbp, DB_AM_THREAD) ? \ - __db_mutex_lock((db_mutex_t *)(dbp)->mutexp, -1, \ - (dbp)->dbenv == NULL ? NULL : (dbp)->dbenv->db_yield) : 0) + __db_mutex_lock((db_mutex_t *)(dbp)->mutexp, -1) : 0) #define DB_THREAD_UNLOCK(dbp) \ (F_ISSET(dbp, DB_AM_THREAD) ? \ - __db_mutex_unlock((db_mutex_t *)(dbp)->mutexp, -1) : 0) + __db_mutex_unlock((db_mutex_t *)(dbp)->mutexp, -1) : 0) /* Btree/recno local statistics structure. */ struct __db_bt_lstat; typedef struct __db_bt_lstat DB_BTREE_LSTAT; @@ -260,7 +262,7 @@ typedef struct __dbpginfo { #define IS_ZERO_LSN(LSN) ((LSN).file == 0) /* Test if we need to log a change. */ -#define DB_LOGGING(dbp) \ +#define DB_LOGGING(dbp) \ (F_ISSET(dbp, DB_AM_LOGGING) && !F_ISSET(dbp, DB_AM_RECOVER)) #ifdef DEBUG diff --git a/db2/include/hash.h b/db2/include/hash.h index cb8ea350f5..ae6d3843c6 100644 --- a/db2/include/hash.h +++ b/db2/include/hash.h @@ -43,7 +43,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)hash.h 10.6 (Sleepycat) 8/18/97 + * @(#)hash.h 10.7 (Sleepycat) 11/1/97 */ /* Cursor structure definitions. */ @@ -179,8 +179,8 @@ typedef struct htab { /* Memory resident data structure. */ /* Constraints about number of pages and how much data goes on a page. */ #define MAX_PAGES(H) UINT32_T_MAX -#define MINFILL 0.25 -#define ISBIG(H, N) (((N) > ((H)->hdr->pagesize * MINFILL)) ? 1 : 0) +#define MINFILL 4 +#define ISBIG(H, N) (((N) > ((H)->hdr->pagesize / MINFILL)) ? 1 : 0) /* Shorthands for accessing structure */ #define NDX_INVALID 0xFFFF diff --git a/db2/include/hash_auto.h b/db2/include/hash_auto.h index 5ff1229115..2b8aea8d86 100644 --- a/db2/include/hash_auto.h +++ b/db2/include/hash_auto.h @@ -108,7 +108,25 @@ typedef struct _ham_ovfl_args { db_pgno_t start_pgno; u_int32_t npages; db_pgno_t free_pgno; + u_int32_t ovflpoint; DB_LSN metalsn; } __ham_ovfl_args; + +#define DB_ham_copypage (DB_ham_BEGIN + 8) + +typedef struct _ham_copypage_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN pagelsn; + db_pgno_t next_pgno; + DB_LSN nextlsn; + db_pgno_t nnext_pgno; + DB_LSN nnextlsn; + DBT page; +} __ham_copypage_args; + #endif diff --git a/db2/include/hash_ext.h b/db2/include/hash_ext.h index 32788c7b8a..5abbb274f0 100644 --- a/db2/include/hash_ext.h +++ b/db2/include/hash_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __ham_open __P((DB *, DB_INFO *)); int __ham_close __P((DB *)); int __ham_c_iclose __P((DB *, DBC *)); @@ -54,10 +54,17 @@ int __ham_newpgno_read __P((void *, __ham_newpgno_args **)); int __ham_ovfl_log __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, db_pgno_t, u_int32_t, db_pgno_t, - DB_LSN *)); + u_int32_t, DB_LSN *)); int __ham_ovfl_print __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __ham_ovfl_read __P((void *, __ham_ovfl_args **)); +int __ham_copypage_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + DB_LSN *, db_pgno_t, DB_LSN *, DBT *)); +int __ham_copypage_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_copypage_read __P((void *, __ham_copypage_args **)); int __ham_init_print __P((DB_ENV *)); int __ham_init_recover __P((DB_ENV *)); int __ham_pgin __P((db_pgno_t, void *, DBT *)); @@ -81,7 +88,7 @@ int __ham_item_first __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); int __ham_item_prev __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); int __ham_item_next __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); void __ham_putitem __P((PAGE *p, const DBT *, int)); -int __ham_del_pair __P((HTAB *, HASH_CURSOR *)); +int __ham_del_pair __P((HTAB *, HASH_CURSOR *, int)); int __ham_replpair __P((HTAB *, HASH_CURSOR *, DBT *, u_int32_t)); void __ham_onpage_replace __P((PAGE *, size_t, u_int32_t, int32_t, int32_t, DBT *)); @@ -118,4 +125,6 @@ int __ham_splitdata_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __ham_ovfl_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_copypage_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); int __ham_stat __P((DB *, FILE *)); diff --git a/db2/include/lock.h b/db2/include/lock.h index 8f9e81c0fa..8a927f076e 100644 --- a/db2/include/lock.h +++ b/db2/include/lock.h @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)lock.h 10.8 (Sleepycat) 9/23/97 + * @(#)lock.h 10.9 (Sleepycat) 10/25/97 */ typedef struct __db_lockobj DB_LOCKOBJ; @@ -54,8 +54,7 @@ struct __db_lockregion { /* Macros to lock/unlock the region. */ #define LOCK_LOCKREGION(lt) \ - (void)__db_mutex_lock(&(lt)->region->hdr.lock,(lt)->fd, \ - (lt)->dbenv == NULL ? NULL : (lt)->dbenv->db_yield) + (void)__db_mutex_lock(&(lt)->region->hdr.lock, (lt)->fd) #define UNLOCK_LOCKREGION(lt) \ (void)__db_mutex_unlock(&(lt)->region->hdr.lock, (lt)->fd) diff --git a/db2/include/lock_ext.h b/db2/include/lock_ext.h index 59d5072bc4..0d0ba148b6 100644 --- a/db2/include/lock_ext.h +++ b/db2/include/lock_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __lock_getobj __P((DB_LOCKTAB *, u_int32_t, DBT *, u_int32_t type, DB_LOCKOBJ **)); int __lock_cmp __P((DBT *, DB_LOCKOBJ *)); diff --git a/db2/include/log.h b/db2/include/log.h index a9c82fa04d..a192a38136 100644 --- a/db2/include/log.h +++ b/db2/include/log.h @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)log.h 10.9 (Sleepycat) 9/23/97 + * @(#)log.h 10.15 (Sleepycat) 11/2/97 */ #ifndef _LOG_H_ @@ -15,6 +15,8 @@ struct __hdr; typedef struct __hdr HDR; struct __log; typedef struct __log LOG; struct __log_persist; typedef struct __log_persist LOGP; +#define MEGABYTE (1024 * 1024) + #define MAXLFNAME 99999 /* Maximum log file name. */ #define LFNAME "log.%05d" /* Log file name template. */ @@ -23,21 +25,15 @@ struct __log_persist; typedef struct __log_persist LOGP; #define DEFAULT_MAX (10 * 1048576) /* 10 Mb. */ -/* Macros to return per-process address, offsets. */ -#define ADDR(base, offset) ((void *)((u_int8_t *)((base)->addr) + offset)) -#define OFFSET(base, p) ((u_int8_t *)(p) - (u_int8_t *)(base)->addr) - /* Macros to lock/unlock the region and threads. */ #define LOCK_LOGTHREAD(dblp) \ if (F_ISSET(dblp, DB_AM_THREAD)) \ - (void)__db_mutex_lock((dblp)->mutexp, -1, \ - (dblp)->dbenv == NULL ? NULL : (dblp)->dbenv->db_yield) + (void)__db_mutex_lock((dblp)->mutexp, -1) #define UNLOCK_LOGTHREAD(dblp) \ if (F_ISSET(dblp, DB_AM_THREAD)) \ (void)__db_mutex_unlock((dblp)->mutexp, -1); #define LOCK_LOGREGION(dblp) \ - (void)__db_mutex_lock(&((RLAYOUT *)(dblp)->lp)->lock, \ - (dblp)->fd, (dblp)->dbenv == NULL ? NULL : (dblp)->dbenv->db_yield) + (void)__db_mutex_lock(&((RLAYOUT *)(dblp)->lp)->lock, (dblp)->fd) #define UNLOCK_LOGREGION(dblp) \ (void)__db_mutex_unlock(&((RLAYOUT *)(dblp)->lp)->lock, (dblp)->fd) @@ -124,7 +120,7 @@ struct __log { DB_LSN lsn; /* LSN at current file offset. */ DB_LSN c_lsn; /* LSN of the last checkpoint. */ DB_LSN s_lsn; /* LSN of the last sync. */ - DB_LSN span_lsn; /* LSN spanning buffer write. */ + DB_LSN uw_lsn; /* LSN of 1st rec not fully on disk. */ u_int32_t len; /* Length of the last record. */ @@ -132,7 +128,8 @@ struct __log { u_int32_t w_off; /* Current write offset in the file. */ time_t chkpt; /* Time of the last checkpoint. */ - u_int32_t written; /* Bytes written since checkpoint. */ + + DB_LOG_STAT stat; /* Log statistics. */ u_int8_t buf[4 * 1024]; /* Log buffer. */ }; diff --git a/db2/include/log_ext.h b/db2/include/log_ext.h index bc63d9dac8..c32d1d6af6 100644 --- a/db2/include/log_ext.h +++ b/db2/include/log_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __log_find __P((DB_LOG *, int *)); int __log_valid __P((DB_LOG *, LOG *, int)); int __log_register_log diff --git a/db2/include/mp.h b/db2/include/mp.h index 3b71774484..f68f42b144 100644 --- a/db2/include/mp.h +++ b/db2/include/mp.h @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)mp.h 10.16 (Sleepycat) 9/23/97 + * @(#)mp.h 10.19 (Sleepycat) 10/25/97 */ struct __bh; typedef struct __bh BH; @@ -22,30 +22,36 @@ struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; #define DB_CACHESIZE_DEF (128 * 1024) #define DB_CACHESIZE_MIN ( 20 * 1024) -/* Macro to return per-process address, offsets. */ -#define ADDR(base, offset) ((void *)((u_int8_t *)((base)->addr) + offset)) -#define OFFSET(base, p) ((u_int8_t *)(p) - (u_int8_t *)(base)->addr) - #define INVALID 0 /* Invalid shared memory offset. */ #define TEMPORARY "<tmp>" /* Temporary file name. */ /* - * There are two kinds of locks in the mpool code. The first is the region - * lock, used to serialize modifications to all data structures. The second - * is a per-buffer header lock. The locking order is as follows: + * There are three ways we do locking in the mpool code: + * + * Locking a handle mutex to provide concurrency for DB_THREAD operations. + * Locking the region mutex to provide mutual exclusion while reading and + * writing structures in the shared region. + * Locking buffer header mutexes during I/O. + * + * The first will not be further described here. We use the shared mpool + * region lock to provide mutual exclusion while reading/modifying all of + * the data structures, including the buffer headers. We use a per-buffer + * header lock to wait on buffer I/O. The order of locking is as follows: * - * Process searching for a buffer: + * Searching for a buffer: * Acquire the region lock. * Find the buffer header. * Increment the reference count (guarantee the buffer stays). - * If the BH_LOCKED flag is set: + * If the BH_LOCKED flag is set (I/O is going on): * Release the region lock. + * Request the buffer lock. + * The I/O will complete... * Acquire the buffer lock. * Release the buffer lock. * Acquire the region lock. * Return the buffer. * - * Process reading/writing a buffer: + * Reading/writing a buffer: * Acquire the region lock. * Find/create the buffer header. * If reading, increment the reference count (guarantee the buffer stays). @@ -69,8 +75,7 @@ struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; #define LOCKHANDLE(dbmp, mutexp) \ if (F_ISSET(dbmp, MP_LOCKHANDLE)) \ - (void)__db_mutex_lock(mutexp, (dbmp)->fd, \ - (dbmp)->dbenv == NULL ? NULL : (dbmp)->dbenv->db_yield) + (void)__db_mutex_lock(mutexp, (dbmp)->fd) #define UNLOCKHANDLE(dbmp, mutexp) \ if (F_ISSET(dbmp, MP_LOCKHANDLE)) \ (void)__db_mutex_unlock(mutexp, (dbmp)->fd) @@ -78,8 +83,7 @@ struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; #define LOCKREGION(dbmp) \ if (F_ISSET(dbmp, MP_LOCKREGION)) \ (void)__db_mutex_lock(&((RLAYOUT *)(dbmp)->mp)->lock, \ - (dbmp)->fd, \ - (dbmp)->dbenv == NULL ? NULL : (dbmp)->dbenv->db_yield) + (dbmp)->fd) #define UNLOCKREGION(dbmp) \ if (F_ISSET(dbmp, MP_LOCKREGION)) \ (void)__db_mutex_unlock(&((RLAYOUT *)(dbmp)->mp)->lock, \ @@ -87,8 +91,7 @@ struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; #define LOCKBUFFER(dbmp, bhp) \ if (F_ISSET(dbmp, MP_LOCKREGION)) \ - (void)__db_mutex_lock(&(bhp)->mutex, (dbmp)->fd, \ - (dbmp)->dbenv == NULL ? NULL : (dbmp)->dbenv->db_yield) + (void)__db_mutex_lock(&(bhp)->mutex, (dbmp)->fd) #define UNLOCKBUFFER(dbmp, bhp) \ if (F_ISSET(dbmp, MP_LOCKREGION)) \ (void)__db_mutex_unlock(&(bhp)->mutex, (dbmp)->fd) @@ -250,8 +253,8 @@ struct __bh { #define BH_WRITE 0x020 /* Page scheduled for writing. */ u_int16_t flags; - SH_TAILQ_ENTRY q; /* LRU list of bucket headers. */ - SH_TAILQ_ENTRY mq; /* MPOOLFILE list of bucket headers. */ + SH_TAILQ_ENTRY q; /* LRU queue. */ + SH_TAILQ_ENTRY hq; /* MPOOL hash bucket queue. */ db_pgno_t pgno; /* Underlying MPOOLFILE page number. */ size_t mf_offset; /* Associated MPOOLFILE offset. */ diff --git a/db2/include/mp_ext.h b/db2/include/mp_ext.h index 3934c130a8..49d86ba2e5 100644 --- a/db2/include/mp_ext.h +++ b/db2/include/mp_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __memp_bhwrite __P((DB_MPOOL *, MPOOLFILE *, BH *, int *, int *)); int __memp_pgread __P((DB_MPOOLFILE *, BH *, int)); diff --git a/db2/include/mutex_ext.h b/db2/include/mutex_ext.h index ff46b6a404..cb2d4886af 100644 --- a/db2/include/mutex_ext.h +++ b/db2/include/mutex_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ void __db_mutex_init __P((db_mutex_t *, off_t)); -int __db_mutex_lock __P((db_mutex_t *, int, int (*)(void))); +int __db_mutex_lock __P((db_mutex_t *, int)); int __db_mutex_unlock __P((db_mutex_t *, int)); diff --git a/db2/include/os_ext.h b/db2/include/os_ext.h index 59d72acf12..e48a1e9407 100644 --- a/db2/include/os_ext.h +++ b/db2/include/os_ext.h @@ -1,19 +1,19 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __db_abspath __P((const char *)); -char *__db_rpath __P((const char *)); -int __db_dir __P((DB_ENV *, const char *, char ***, int *)); -void __db_dirf __P((DB_ENV *, char **, int)); +int __os_dirlist __P((const char *, char ***, int *)); +void __os_dirfree __P((char **, int)); int __db_fileid __P((DB_ENV *, const char *, int, u_int8_t *)); -int __db_lseek __P((int, size_t, db_pgno_t, u_long, int)); -int __db_mmap __P((int, size_t, int, int, void *)); -int __db_munmap __P((void *, size_t)); -int __db_oflags __P((int)); -int __db_fdopen __P((const char *, int, int, int, int *)); int __db_fsync __P((int)); +int __os_map __P((int, size_t, int, int, void **)); +int __os_unmap __P((void *, size_t)); +int __db_oflags __P((int)); +int __db_open __P((const char *, int, int, int, int *)); int __db_close __P((int)); +char *__db_rpath __P((const char *)); int __db_read __P((int, void *, size_t, ssize_t *)); int __db_write __P((int, void *, size_t, ssize_t *)); -int __db_sleep __P((u_long, u_long)); -int __db_exists __P((const char *, int *)); -int __db_stat __P((DB_ENV *, const char *, int, off_t *, off_t *)); +int __os_seek __P((int, size_t, db_pgno_t, u_long, int)); +int __os_sleep __P((u_long, u_long)); +int __os_exists __P((const char *, int *)); +int __os_ioinfo __P((const char *, int, off_t *, off_t *)); int __db_unlink __P((const char *)); diff --git a/db2/include/os_func.h b/db2/include/os_func.h new file mode 100644 index 0000000000..0a72942903 --- /dev/null +++ b/db2/include/os_func.h @@ -0,0 +1,76 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997 + * Sleepycat Software. All rights reserved. + * + * @(#)os_func.h 10.2 (Sleepycat) 10/28/97 + */ + +/* Calls which can be replaced by the application. */ +struct __db_jumptab { + void *(*db_calloc) __P((size_t, size_t)); /* DB_FUNC_CALLOC */ + int (*db_close) __P((int)); /* DB_FUNC_CLOSE */ + void (*db_dirfree) __P((char **, int)); /* DB_FUNC_DIRFREE */ + int (*db_dirlist) /* DB_FUNC_DIRLIST */ + __P((const char *, char ***, int *)); + int (*db_exists) /* DB_FUNC_EXISTS */ + __P((const char *, int *)); + void (*db_free) __P((void *)); /* DB_FUNC_FREE */ + int (*db_fsync) __P((int)); /* DB_FUNC_FSYNC */ + int (*db_ioinfo) /* DB_FUNC_IOINFO */ + __P((const char *, int, off_t *, off_t *)); + void *(*db_malloc) __P((size_t)); /* DB_FUNC_MALLOC */ + int (*db_map) /* DB_FUNC_MAP */ + __P((int, size_t, int, int, void **)); + int (*db_open) /* DB_FUNC_OPEN */ + __P((const char *, int, ...)); + ssize_t (*db_read) __P((int, void *, size_t)); /* DB_FUNC_READ */ + void *(*db_realloc) __P((void *, size_t)); /* DB_FUNC_REALLOC */ + int (*db_seek) /* DB_FUNC_SEEK */ + __P((int, size_t, db_pgno_t, u_long, int)); + int (*db_sleep) __P((u_long, u_long)); /* DB_FUNC_SLEEP */ + char *(*db_strdup) __P((const char *)); /* DB_FUNC_STRDUP */ + int (*db_unlink) __P((const char *)); /* DB_FUNC_UNLINK */ + int (*db_unmap) __P((void *, size_t)); /* DB_FUNC_UNMAP */ + ssize_t (*db_write) /* DB_FUNC_WRITE */ + __P((int, const void *, size_t)); + int (*db_yield) __P((void)); /* DB_FUNC_YIELD */ +}; + +extern struct __db_jumptab __db_jump; + +/* + * Names used by DB to call through the jump table. + * + * The naming scheme goes like this: if the functionality the application can + * replace is the same as the DB functionality, e.g., calloc, or dirlist, then + * we use the name __db_XXX, and the application is expected to replace the + * complete functionality, which may or may not map directly to an ANSI C or + * POSIX 1003.1 interface. If the functionality that the aplication replaces + * only underlies what the DB os directory exports to other parts of DB, e.g., + * read, then the name __os_XXX is used, and the application can only replace + * the underlying functionality. Under most circumstances, the os directory + * part of DB is the only code that should use the __os_XXX names, all other + * parts of DB should be calling __db_XXX functions. + */ +#define __db_calloc __db_jump.db_calloc +#define __os_close __db_jump.db_close /* __db_close is a wrapper. */ +#define __db_dirfree __db_jump.db_dirfree +#define __db_dirlist __db_jump.db_dirlist +#define __db_exists __db_jump.db_exists +#define __db_free __db_jump.db_free +#define __os_fsync __db_jump.db_fsync /* __db_fsync is a wrapper. */ +#define __db_ioinfo __db_jump.db_ioinfo +#define __db_malloc __db_jump.db_malloc +#define __db_map __db_jump.db_map +#define __os_open __db_jump.db_open /* __db_open is a wrapper. */ +#define __os_read __db_jump.db_read /* __db_read is a wrapper. */ +#define __db_realloc __db_jump.db_realloc +#define __db_seek __db_jump.db_seek +#define __db_sleep __db_jump.db_sleep +#define __db_strdup __db_jump.db_strdup +#define __os_unlink __db_jump.db_unlink /* __db_unlink is a wrapper. */ +#define __db_unmap __db_jump.db_unmap +#define __os_write __db_jump.db_write /* __db_write is a wrapper. */ +#define __db_yield __db_jump.db_yield diff --git a/db2/include/txn.h b/db2/include/txn.h index 8bb3976c1c..c64ac3fc52 100644 --- a/db2/include/txn.h +++ b/db2/include/txn.h @@ -4,7 +4,7 @@ * Copyright (c) 1996, 1997 * Sleepycat Software. All rights reserved. * - * @(#)txn.h 10.10 (Sleepycat) 9/23/97 + * @(#)txn.h 10.11 (Sleepycat) 10/25/97 */ #ifndef _TXN_H_ #define _TXN_H_ @@ -96,15 +96,13 @@ struct __db_txnregion { /* Macros to lock/unlock the region and threads. */ #define LOCK_TXNTHREAD(tmgrp) \ if (F_ISSET(tmgrp, DB_THREAD)) \ - (void)__db_mutex_lock((tmgrp)->mutexp, -1, \ - (tmgrp)->dbenv == NULL ? NULL : (tmgrp)->dbenv->db_yield) + (void)__db_mutex_lock((tmgrp)->mutexp, -1) #define UNLOCK_TXNTHREAD(tmgrp) \ if (F_ISSET(tmgrp, DB_THREAD)) \ (void)__db_mutex_unlock((tmgrp)->mutexp, -1) #define LOCK_TXNREGION(tmgrp) \ - (void)__db_mutex_lock(&(tmgrp)->region->hdr.lock,(tmgrp)->fd, \ - (tmgrp)->dbenv == NULL ? NULL : (tmgrp)->dbenv->db_yield) + (void)__db_mutex_lock(&(tmgrp)->region->hdr.lock, (tmgrp)->fd) #define UNLOCK_TXNREGION(tmgrp) \ (void)__db_mutex_unlock(&(tmgrp)->region->hdr.lock, (tmgrp)->fd) diff --git a/db2/include/txn_ext.h b/db2/include/txn_ext.h index 8ba0b0c44e..9b617bb68c 100644 --- a/db2/include/txn_ext.h +++ b/db2/include/txn_ext.h @@ -1,4 +1,4 @@ -/* Do not edit: automatically built by dist/distrib. */ +/* DO NOT EDIT: automatically built by dist/distrib. */ int __txn_regop_log __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t)); |