summary refs log tree commit diff
path: root/db2/include
diff options
context:
space:
mode:
Diffstat (limited to 'db2/include')
-rw-r--r--db2/include/btree_ext.h18
-rw-r--r--db2/include/clib_ext.h3
-rw-r--r--db2/include/common_ext.h5
-rw-r--r--db2/include/db.h.src129
-rw-r--r--db2/include/db_185.h.src4
-rw-r--r--db2/include/db_am.h4
-rw-r--r--db2/include/db_ext.h14
-rw-r--r--db2/include/db_int.h.src29
-rw-r--r--db2/include/hash_ext.h15
-rw-r--r--db2/include/lock_ext.h12
-rw-r--r--db2/include/log.h13
-rw-r--r--db2/include/log_auto.h11
-rw-r--r--db2/include/log_ext.h16
-rw-r--r--db2/include/mp.h33
-rw-r--r--db2/include/mp_ext.h3
-rw-r--r--db2/include/mutex_ext.h5
-rw-r--r--db2/include/os_ext.h7
-rw-r--r--db2/include/os_func.h6
-rw-r--r--db2/include/txn_ext.h3
19 files changed, 215 insertions, 115 deletions
diff --git a/db2/include/btree_ext.h b/db2/include/btree_ext.h
index 46f2227bdd..9c34c8c6bf 100644
--- a/db2/include/btree_ext.h
+++ b/db2/include/btree_ext.h
@@ -1,4 +1,6 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _btree_ext_h_
+#define _btree_ext_h_
 int __bam_close __P((DB *));
 int __bam_sync __P((DB *, int));
 int __bam_cmp __P((DB *, const DBT *, EPG *));
@@ -11,11 +13,12 @@ int __bam_cursor __P((DB *, DB_TXN *, DBC **));
 int __bam_c_iclose __P((DB *, DBC *));
 int __bam_get __P((DB *, DB_TXN *, DBT *, DBT *, int));
 int __bam_ovfl_chk __P((DB *, CURSOR *, u_int32_t, int));
+int __bam_cprint __P((DB *));
 int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, CURSOR *, int));
 void __bam_ca_di __P((DB *, db_pgno_t, u_int32_t, int));
 void __bam_ca_dup __P((DB *,
    db_pgno_t, u_int32_t, u_int32_t, db_pgno_t, u_int32_t));
-void __bam_ca_move __P((DB *, BTREE *, db_pgno_t, db_pgno_t));
+void __bam_ca_move __P((DB *, db_pgno_t, db_pgno_t));
 void __bam_ca_replace
    __P((DB *, db_pgno_t, u_int32_t, ca_replace_arg));
 void __bam_ca_split __P((DB *,
@@ -29,6 +32,7 @@ int __bam_open __P((DB *, DBTYPE, DB_INFO *));
 int __bam_bdup __P((DB *, DB *));
 int __bam_new __P((DB *, u_int32_t, PAGE **));
 int __bam_free __P((DB *, PAGE *));
+int __bam_lt __P((DB *));
 int __bam_lget __P((DB *, int, db_pgno_t, db_lockmode_t, DB_LOCK *));
 int __bam_lput __P((DB *, DB_LOCK));
 int __bam_pget __P((DB *, PAGE **, db_pgno_t *, int));
@@ -57,6 +61,7 @@ int __ram_cursor __P((DB *, DB_TXN *, DBC **));
 int __ram_close __P((DB *));
 int __ram_c_iclose __P((DB *, DBC *));
 void __ram_ca __P((DB *, db_recno_t, ca_recno_arg));
+int __ram_cprint __P((DB *));
 int __ram_getno __P((DB *, const DBT *, db_recno_t *, int));
 int __ram_snapshot __P((DB *));
 int __bam_rsearch __P((DB *, db_recno_t *, u_int, int, int *));
@@ -82,7 +87,7 @@ int __bam_pg_alloc_print
 int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **));
 int __bam_pg_free_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
-    u_int32_t, db_pgno_t, DB_LSN *, DBT *,
+    u_int32_t, db_pgno_t, DB_LSN *, const DBT *,
     db_pgno_t));
 int __bam_pg_free_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
@@ -91,14 +96,14 @@ int __bam_split_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
     u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
     DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *,
-    DBT *));
+    const DBT *));
 int __bam_split_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 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 *, db_pgno_t,
-    DBT *, DB_LSN *));
+    u_int32_t, db_pgno_t, const DBT *, db_pgno_t,
+    const DBT *, DB_LSN *));
 int __bam_rsplit_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __bam_rsplit_read __P((void *, __bam_rsplit_args **));
@@ -125,10 +130,11 @@ 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, const DBT *, const 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 *));
+#endif /* _btree_ext_h_ */
diff --git a/db2/include/clib_ext.h b/db2/include/clib_ext.h
index 91e4a13fa5..eb982bf85f 100644
--- a/db2/include/clib_ext.h
+++ b/db2/include/clib_ext.h
@@ -1,4 +1,6 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _clib_ext_h_
+#define _clib_ext_h_
 #ifdef __STDC__
 void err __P((int eval, const char *, ...));
 #else
@@ -63,3 +65,4 @@ char *strsep __P((char **, const char *));
 #ifndef HAVE_VSNPRINTF
 int vsnprintf();
 #endif
+#endif /* _clib_ext_h_ */
diff --git a/db2/include/common_ext.h b/db2/include/common_ext.h
index 29bc9aa4e2..b362c9c32e 100644
--- a/db2/include/common_ext.h
+++ b/db2/include/common_ext.h
@@ -1,4 +1,6 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _common_ext_h_
+#define _common_ext_h_
 int __db_appname __P((DB_ENV *,
    APPNAME, const char *, const char *, int *, char **));
 int __db_apprec __P((DB_ENV *, int));
@@ -38,5 +40,6 @@ void __db_shalloc_free __P((void *, void *));
 size_t __db_shalloc_count __P((void *));
 size_t __db_shsizeof __P((void *));
 void __db_shalloc_dump __P((FILE *, void *));
-int __db_tablesize __P((int));
+int __db_tablesize __P((u_int));
 void __db_hashinit __P((void *, int));
+#endif /* _common_ext_h_ */
diff --git a/db2/include/db.h.src b/db2/include/db.h.src
index 654eb16425..ebdaa27470 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.97 (Sleepycat) 11/28/97
+ *	@(#)db.h.src	10.102 (Sleepycat) 1/18/98
  */
 
 #ifndef _DB_H_
@@ -73,8 +73,8 @@
 
 #define	DB_VERSION_MAJOR	2
 #define	DB_VERSION_MINOR	3
-#define	DB_VERSION_PATCH	14
-#define	DB_VERSION_STRING	"Sleepycat Software: DB 2.3.14: (11/28/97)"
+#define	DB_VERSION_PATCH	16
+#define	DB_VERSION_STRING	"Sleepycat Software: DB 2.3.16: (1/19/98)"
 
 typedef	u_int32_t	db_pgno_t;	/* Page number type. */
 typedef	u_int16_t	db_indx_t;	/* Page offset type. */
@@ -241,7 +241,7 @@ struct __db_env {
 	DB_LOCKTAB	*lk_info;	/* Return from lock_open(). */
 	u_int8_t	*lk_conflicts;	/* Two dimensional conflict matrix. */
 	int		 lk_modes;	/* Number of lock modes in table. */
-	unsigned int	 lk_max;	/* Maximum number of locks. */
+	u_int		 lk_max;	/* Maximum number of locks. */
 	u_int32_t	 lk_detect;	/* Deadlock detect on every conflict. */
 
 	/* Logging. */
@@ -461,7 +461,6 @@ struct __db {
 #define	DB_RE_PAD	0x004000	/* DB_PAD (internal). */
 #define	DB_RE_RENUMBER	0x008000	/* DB_RENUMBER (internal). */
 #define	DB_RE_SNAPSHOT	0x010000	/* DB_SNAPSHOT (internal). */
-
 	u_int32_t flags;
 };
 
@@ -532,7 +531,7 @@ int   db_open __P((const char *, DBTYPE, int, int, DB_ENV *, DB_INFO *, DB **));
 int   db_value_set __P((int, int));
 char *db_version __P((int *, int *, int *));
 #if defined(__cplusplus)
-};
+}
 #endif
 
 /*******************************************************
@@ -611,7 +610,7 @@ int	  lock_unlink __P((const char *, int, DB_ENV *));
 int	  lock_vec __P((DB_LOCKTAB *,
 	    u_int32_t, int, DB_LOCKREQ *, int, DB_LOCKREQ **));
 #if defined(__cplusplus)
-};
+}
 #endif
 
 /*******************************************************
@@ -650,6 +649,8 @@ struct __db_log_stat {
 	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. */
+	u_int32_t st_cur_file;		/* Current log file number. */
+	u_int32_t st_cur_offset;	/* Current log file offset. */
 };
 
 #if defined(__cplusplus)
@@ -668,7 +669,7 @@ 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)
-};
+}
 #endif
 
 /*******************************************************
@@ -739,7 +740,7 @@ 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)
-};
+}
 #endif
 
 /*******************************************************
@@ -790,10 +791,13 @@ int	  txn_prepare __P((DB_TXN *));
 int	  txn_stat __P((DB_TXNMGR *, DB_TXN_STAT **, void *(*)(size_t)));
 int	  txn_unlink __P((const char *, int, DB_ENV *));
 #if defined(__cplusplus)
-};
+}
 #endif
 
-#ifdef DB_DBM_HSEARCH
+#ifndef DB_DBM_HSEARCH
+#define	DB_DBM_HSEARCH	0		/* No historic interfaces by default. */
+#endif
+#if DB_DBM_HSEARCH != 0
 /*******************************************************
  * Dbm/Ndbm historic interfaces.
  *******************************************************/
@@ -811,40 +815,74 @@ typedef struct {
 	int dsize;
 } datum;
 
+/*
+ * Translate DBM calls into DB calls so that DB doesn't step on the
+ * application's name space.
+ *
+ * The global variables dbrdonly, dirf and pagf were not retained when
+ * 4BSD replaced the dbm interface with ndbm, and are not support here.
+ */
+#define	dbminit(a)	__db_dbm_init(a)
+#if !defined(__cplusplus)
+#define	delete(a)	__db_dbm_delete(a)
+#endif
+#define	fetch(a)	__db_dbm_fetch(a)
+#define	firstkey	__db_dbm_firstkey
+#define	nextkey(a)	__db_dbm_nextkey(a)
+#define	store(a, b)	__db_dbm_store(a, b)
+
+/* Prototype the DB calls. */
 #if defined(__cplusplus)
 extern "C" {
 #endif
-int	 dbminit __P((char *));
-#if !defined(__cplusplus)
-int	 delete __P((datum));
+int	 __db_dbm_init __P((char *));
+int	 __db_dbm_delete __P((datum));
+int	 __db_dbm_dbrdonly __P((void));
+int	 __db_dbm_dirf __P((void));
+datum	 __db_dbm_fetch __P((datum));
+datum	 __db_dbm_firstkey __P((void));
+datum	 __db_dbm_nextkey __P((datum));
+int	 __db_dbm_pagf __P((void));
+int	 __db_dbm_store __P((datum, datum));
+#if defined(__cplusplus)
+}
 #endif
-datum	 fetch __P((datum));
-datum	 firstkey __P((void));
-datum	 nextkey __P((datum));
-int	 store __P((datum, datum));
 
 /*
- * !!!
- * Don't prototype:
- *
- *	 dbm_clearerr(DBM *db);
- *	 dbm_dirfno(DBM *db);
- *	 dbm_error(DBM *db);
- *	 dbm_pagfno(DBM *db);
- *	 dbm_rdonly(DBM *db);
- *
- * they weren't documented and were historically implemented as #define's.
+ * Translate NDBM calls into DB calls so that DB doesn't step on the
+ * application's name space.
  */
-void	 dbm_close __P((DBM *));
-int	 dbm_delete __P((DBM *, datum));
-datum	 dbm_fetch __P((DBM *, datum));
-datum	 dbm_firstkey __P((DBM *));
-long	 dbm_forder __P((DBM *, datum));
-datum	 dbm_nextkey __P((DBM *));
-DBM	*dbm_open __P((const char *, int, int));
-int	 dbm_store __P((DBM *, datum, datum, int));
+#define	dbm_clearerr(a)		__db_ndbm_clearerr(a)
+#define	dbm_close(a)		__db_ndbm_close(a)
+#define	dbm_delete(a, b)	__db_ndbm_delete(a, b)
+#define	dbm_dirfno(a)		__db_ndbm_dirfno(a)
+#define	dbm_error(a)		__db_ndbm_error(a)
+#define	dbm_fetch(a, b)		__db_ndbm_fetch(a, b)
+#define	dbm_firstkey(a)		__db_ndbm_firstkey(a)
+#define	dbm_nextkey(a)		__db_ndbm_nextkey(a)
+#define	dbm_open(a, b, c)	__db_ndbm_open(a, b, c)
+#define	dbm_pagfno(a)		__db_ndbm_pagfno(a)
+#define	dbm_rdonly(a)		__db_ndbm_rdonly(a)
+#define	dbm_store(a, b, c, d)	__db_ndbm_store(a, b, c, d)
+
+/* Prototype the DB calls. */
 #if defined(__cplusplus)
-};
+extern "C" {
+#endif
+int	 __db_ndbm_clearerr __P((DBM *));
+void	 __db_ndbm_close __P((DBM *));
+int	 __db_ndbm_delete __P((DBM *, datum));
+int	 __db_ndbm_dirfno __P((DBM *));
+int	 __db_ndbm_error __P((DBM *));
+datum	 __db_ndbm_fetch __P((DBM *, datum));
+datum	 __db_ndbm_firstkey __P((DBM *));
+datum	 __db_ndbm_nextkey __P((DBM *));
+DBM	*__db_ndbm_open __P((const char *, int, int));
+int	 __db_ndbm_pagfno __P((DBM *));
+int	 __db_ndbm_rdonly __P((DBM *));
+int	 __db_ndbm_store __P((DBM *, datum, datum, int));
+#if defined(__cplusplus)
+}
 #endif
 
 /*******************************************************
@@ -859,14 +897,23 @@ typedef struct entry {
 	void *data;
 } ENTRY;
 
+/*
+ * Translate HSEARCH calls into DB calls so that DB doesn't step on the
+ * application's name space.
+ */
+#define	hcreate(a)	__db_hcreate(a)
+#define	hdestroy	__db_hdestroy
+#define	hsearch(a, b)	__db_hsearch(a, b)
+
+/* Prototype the DB calls. */
 #if defined(__cplusplus)
 extern "C" {
 #endif
-int	 hcreate __P((unsigned int));
-void	 hdestroy __P((void));
-ENTRY	*hsearch __P((ENTRY, ACTION));
+int	 __db_hcreate __P((unsigned int));
+void	 __db_hdestroy __P((void));
+ENTRY	*__db_hsearch __P((ENTRY, ACTION));
 #if defined(__cplusplus)
-};
+}
 #endif
 #endif /* DB_DBM_HSEARCH */
 
diff --git a/db2/include/db_185.h.src b/db2/include/db_185.h.src
index 3fbca8bfda..a88eb4e525 100644
--- a/db2/include/db_185.h.src
+++ b/db2/include/db_185.h.src
@@ -36,7 +36,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)db_185.h.src	8.4 (Sleepycat) 9/16/97
+ *	@(#)db_185.h.src	8.5 (Sleepycat) 1/15/98
  */
 
 #ifndef _DB_185_H_
@@ -173,6 +173,6 @@ extern "C" {
 DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
 
 #if defined(__cplusplus)
-};
+}
 #endif
 #endif /* !_DB_185_H_ */
diff --git a/db2/include/db_am.h b/db2/include/db_am.h
index 0ea24be667..304e3fd959 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.7 (Sleepycat) 10/25/97
+ *	@(#)db_am.h	10.8 (Sleepycat) 1/8/98
  */
 #ifndef _DB_AM_H
 #define _DB_AM_H
@@ -79,7 +79,7 @@
 	(void)func(logp, dbtp, lsnp, redo, info);
 #else
 #define	REC_PRINT(func)							\
-	info = info;			/* XXX: Shut the compiler up. */
+	COMPQUIET(info, NULL);
 #endif
 
 #include "db_auto.h"
diff --git a/db2/include/db_ext.h b/db2/include/db_ext.h
index 15eeaf50a3..122d8f13c1 100644
--- a/db2/include/db_ext.h
+++ b/db2/include/db_ext.h
@@ -1,16 +1,18 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _db_ext_h_
+#define _db_ext_h_
 int __db_pgerr __P((DB *, db_pgno_t));
 int __db_pgfmt __P((DB *, db_pgno_t));
 int __db_addrem_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
     u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
-    size_t, DBT *, DBT *, DB_LSN *));
+    size_t, const DBT *, const DBT *, DB_LSN *));
 int __db_addrem_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __db_addrem_read __P((void *, __db_addrem_args **));
 int __db_split_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
-    u_int32_t, u_int32_t, db_pgno_t, DBT *,
+    u_int32_t, u_int32_t, db_pgno_t, const DBT *,
     DB_LSN *));
 int __db_split_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
@@ -18,7 +20,7 @@ int __db_split_read __P((void *, __db_split_args **));
 int __db_big_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
     u_int32_t, u_int32_t, db_pgno_t, db_pgno_t,
-    db_pgno_t, DBT *, DB_LSN *, DB_LSN *,
+    db_pgno_t, const DBT *, DB_LSN *, DB_LSN *,
     DB_LSN *));
 int __db_big_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
@@ -45,7 +47,7 @@ int __db_addpage_print
 int __db_addpage_read __P((void *, __db_addpage_args **));
 int __db_debug_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
-    DBT *, u_int32_t, DBT *, DBT *,
+    const DBT *, u_int32_t, const DBT *, const DBT *,
     u_int32_t));
 int __db_debug_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
@@ -65,13 +67,14 @@ int __db_add_recovery __P((DB_ENV *,
 int __db_txnlist_init __P((void *));
 int __db_txnlist_add __P((void *, u_int32_t));
 int __db_txnlist_find __P((void *, u_int32_t));
+void __db_txnlist_print __P((void *));
 void __db_txnlist_end __P((void *));
 int __db_dput __P((DB *,
    DBT *, PAGE **, db_indx_t *, int (*)(DB *, u_int32_t, PAGE **)));
 int __db_drem __P((DB *,
    PAGE **, u_int32_t, int (*)(DB *, PAGE *)));
 int __db_dend __P((DB *, db_pgno_t, PAGE **));
- int __db_ditem __P((DB *, PAGE *, int, u_int32_t));
+ int __db_ditem __P((DB *, PAGE *, u_int32_t, u_int32_t));
 int __db_pitem
     __P((DB *, PAGE *, u_int32_t, u_int32_t, DBT *, DBT *));
 int __db_relink __P((DB *, PAGE *, PAGE **, int));
@@ -113,3 +116,4 @@ int __db_retcopy __P((DBT *,
    void *, u_int32_t, void **, u_int32_t *, void *(*)(size_t)));
 int __db_gethandle __P((DB *, int (*)(DB *, DB *), DB **));
 int __db_puthandle __P((DB *));
+#endif /* _db_ext_h_ */
diff --git a/db2/include/db_int.h.src b/db2/include/db_int.h.src
index 03a882fded..48790d6c9a 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.37 (Sleepycat) 11/25/97
+ *	@(#)db_int.h.src	10.41 (Sleepycat) 1/8/98
  */
 
 #ifndef _DB_INTERNAL_H_
@@ -18,14 +18,22 @@
 /*******************************************************
  * General purpose constants and macros.
  *******************************************************/
-#define	UINT32_T_MAX	0xffffffff	/* Maximum 32 bit unsigned. */
 #define	UINT16_T_MAX	    0xffff	/* Maximum 16 bit unsigned. */
+#define	UINT32_T_MAX	0xffffffff	/* Maximum 32 bit unsigned. */
 
 #define	DB_MIN_PGSIZE	0x000200	/* Minimum page size. */
 #define	DB_MAX_PGSIZE	0x010000	/* Maximum page size. */
 
 #define	DB_MINCACHE	10		/* Minimum cached pages */
 
+#define	MEGABYTE	1048576
+
+/*
+ * If we are unable to determine the underlying filesystem block size, use
+ * 8K on the grounds that most OS's use less than 8K as their VM page size.
+ */
+#define	DB_DEF_IOSIZE	(8 * 1024)
+
 /*
  * Aligning items to particular sizes or in pages or memory.  ALIGNP is a
  * separate macro, as we've had to cast the pointer to different integral
@@ -109,6 +117,9 @@ typedef struct __fn {
 #undef	DB_LINE
 #define	DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
 
+/* Unused, or not-used-yet variable.  "Shut that bloody compiler up!" */
+#define	COMPQUIET(n, v)	(n) = (v)
+
 /*******************************************************
  * Files.
  *******************************************************/
@@ -155,18 +166,22 @@ typedef struct __fn {
 
 /*
  * The offset of a mutex in memory.
+ *
+ * !!!
+ * Not an off_t, so backing file offsets MUST be less than 4Gb.  See the
+ * off field of the db_mutex_t as well.
  */
-#define	MUTEX_LOCK_OFFSET(a, b)	((off_t)((u_int8_t *)b - (u_int8_t *)a))
+#define	MUTEX_LOCK_OFFSET(a, b)	((u_int32_t)((u_int8_t *)b - (u_int8_t *)a))
 
 typedef struct _db_mutex_t {
 #ifdef HAVE_SPINLOCKS
-	tsl_t	tsl_resource;		/* Resource test and set. */
+	tsl_t	  tsl_resource;		/* Resource test and set. */
 #ifdef DEBUG
-	u_long	pid;			/* Lock holder: 0 or process pid. */
+	u_long	  pid;			/* Lock holder: 0 or process pid. */
 #endif
 #else
-	off_t	off;			/* Backing file offset. */
-	u_long	pid;			/* Lock holder: 0 or process pid. */
+	u_int32_t off;			/* Backing file offset. */
+	u_long	  pid;			/* Lock holder: 0 or process pid. */
 #endif
 	u_int32_t spins;		/* Spins before block. */
 	u_int32_t mutex_set_wait;	/* Granted after wait. */
diff --git a/db2/include/hash_ext.h b/db2/include/hash_ext.h
index 5abbb274f0..9b97d35a42 100644
--- a/db2/include/hash_ext.h
+++ b/db2/include/hash_ext.h
@@ -1,17 +1,19 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _hash_ext_h_
+#define _hash_ext_h_
 int __ham_open __P((DB *, DB_INFO *));
 int  __ham_close __P((DB *));
 int __ham_c_iclose __P((DB *, DBC *));
 int __ham_expand_table __P((HTAB *));
 u_int32_t __ham_call_hash __P((HTAB *, u_int8_t *, int32_t));
 int __ham_init_dbt __P((DBT *, u_int32_t, void **, u_int32_t *));
-void __ham_c_update __P((HTAB *,
-   HASH_CURSOR *, db_pgno_t, u_int32_t, int, int));
+void __ham_c_update
+   __P((HASH_CURSOR *, db_pgno_t, u_int32_t, int, int));
 int  __ham_hdup __P((DB *, DB *));
 int __ham_insdel_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
     u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
-    DB_LSN *, DBT *, DBT *));
+    DB_LSN *, const DBT *, const DBT *));
 int __ham_insdel_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __ham_insdel_read __P((void *, __ham_insdel_args **));
@@ -31,7 +33,7 @@ int __ham_splitmeta_print
 int __ham_splitmeta_read __P((void *, __ham_splitmeta_args **));
 int __ham_splitdata_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
-    u_int32_t, u_int32_t, db_pgno_t, DBT *,
+    u_int32_t, u_int32_t, db_pgno_t, const DBT *,
     DB_LSN *));
 int __ham_splitdata_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
@@ -39,7 +41,7 @@ int __ham_splitdata_read __P((void *, __ham_splitdata_args **));
 int __ham_replace_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
     u_int32_t, db_pgno_t, u_int32_t, DB_LSN *,
-    int32_t, DBT *, DBT *, u_int32_t));
+    int32_t, const DBT *, const DBT *, u_int32_t));
 int __ham_replace_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __ham_replace_read __P((void *, __ham_replace_args **));
@@ -61,7 +63,7 @@ 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 *));
+    DB_LSN *, db_pgno_t, DB_LSN *, const DBT *));
 int __ham_copypage_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __ham_copypage_read __P((void *, __ham_copypage_args **));
@@ -128,3 +130,4 @@ int __ham_ovfl_recover
 int __ham_copypage_recover
   __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __ham_stat __P((DB *, FILE *));
+#endif /* _hash_ext_h_ */
diff --git a/db2/include/lock_ext.h b/db2/include/lock_ext.h
index 0d0ba148b6..d983b29069 100644
--- a/db2/include/lock_ext.h
+++ b/db2/include/lock_ext.h
@@ -1,8 +1,14 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _lock_ext_h_
+#define _lock_ext_h_
+void __lock_dump_region __P((DB_LOCKTAB *, u_int));
+int __lock_is_locked
+   __P((DB_LOCKTAB *, u_int32_t, DBT *, db_lockmode_t));
 int __lock_getobj  __P((DB_LOCKTAB *,
-    u_int32_t, DBT *, u_int32_t type, DB_LOCKOBJ **));
-int __lock_cmp __P((DBT *, DB_LOCKOBJ *));
+    u_int32_t, const DBT *, u_int32_t type, DB_LOCKOBJ **));
+int __lock_cmp __P((const DBT *, DB_LOCKOBJ *));
 int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *));
-int __lock_ohash __P((DBT *));
+int __lock_ohash __P((const DBT *));
 u_int32_t __lock_locker_hash __P((u_int32_t));
 u_int32_t __lock_lhash __P((DB_LOCKOBJ *));
+#endif /* _lock_ext_h_ */
diff --git a/db2/include/log.h b/db2/include/log.h
index 405daf4148..4e27b038d3 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.16 (Sleepycat) 11/9/97
+ *	@(#)log.h	10.19 (Sleepycat) 1/17/98
  */
 
 #ifndef _LOG_H_
@@ -15,15 +15,13 @@ 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. */
 
 					/* Default log name. */
 #define DB_DEFAULT_LOG_FILE	"__db_log.share"
 
-#define	DEFAULT_MAX	(10 * 1048576)	/* 10 Mb. */
+#define	DEFAULT_MAX	(10 * MEGABYTE)	/* 10 Mb. */
 
 /* Macros to lock/unlock the region and threads. */
 #define	LOCK_LOGTHREAD(dblp)						\
@@ -125,7 +123,7 @@ struct __log {
 
 	/*
 	 * The s_lsn LSN is the last LSN that we know is on disk, not just
-	 * written, by synced.
+	 * written, but synced.
 	 */
 	DB_LSN	  s_lsn;		/* LSN of the last sync. */
 
@@ -166,6 +164,11 @@ struct __fname {
 	size_t	  name_off;		/* Name offset. */
 };
 
+/* File open/close register log record opcodes. */
+#define	LOG_CHECKPOINT	1		/* Checkpoint: file name/id dump. */
+#define	LOG_CLOSE	2		/* File close. */
+#define	LOG_OPEN	3		/* File open. */
+
 #include "log_auto.h"
 #include "log_ext.h"
 #endif /* _LOG_H_ */
diff --git a/db2/include/log_auto.h b/db2/include/log_auto.h
index 820aac6acf..5717e140d7 100644
--- a/db2/include/log_auto.h
+++ b/db2/include/log_auto.h
@@ -8,20 +8,11 @@ typedef struct _log_register_args {
 	u_int32_t type;
 	DB_TXN *txnid;
 	DB_LSN prev_lsn;
+	u_int32_t	opcode;
 	DBT	name;
 	DBT	uid;
 	u_int32_t	id;
 	DBTYPE	ftype;
 } __log_register_args;
 
-
-#define	DB_log_unregister	(DB_log_BEGIN + 2)
-
-typedef struct _log_unregister_args {
-	u_int32_t type;
-	DB_TXN *txnid;
-	DB_LSN prev_lsn;
-	u_int32_t	id;
-} __log_unregister_args;
-
 #endif
diff --git a/db2/include/log_ext.h b/db2/include/log_ext.h
index c32d1d6af6..8640b134cd 100644
--- a/db2/include/log_ext.h
+++ b/db2/include/log_ext.h
@@ -1,18 +1,15 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
-int __log_find __P((DB_LOG *, int *));
+#ifndef _log_ext_h_
+#define _log_ext_h_
+int __log_find __P((DB_LOG *, int, int *));
 int __log_valid __P((DB_LOG *, LOG *, int));
 int __log_register_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
-    DBT *, DBT *, u_int32_t, DBTYPE));
+    u_int32_t, const DBT *, const DBT *, u_int32_t,
+    DBTYPE));
 int __log_register_print
    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __log_register_read __P((void *, __log_register_args **));
-int __log_unregister_log
-    __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
-    u_int32_t));
-int __log_unregister_print
-   __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
-int __log_unregister_read __P((void *, __log_unregister_args **));
 int __log_init_print __P((DB_ENV *));
 int __log_init_recover __P((DB_ENV *));
 int __log_findckp __P((DB_LOG *, DB_LSN *));
@@ -21,9 +18,8 @@ int __log_put __P((DB_LOG *, DB_LSN *, const DBT *, int));
 int __log_name __P((DB_LOG *, int, char **));
 int __log_register_recover
     __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
-int __log_unregister_recover
-    __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __log_add_logid __P((DB_LOG *, DB *, u_int32_t));
 int __db_fileid_to_db __P((DB_LOG *, DB **, u_int32_t));
 void __log_close_files __P((DB_LOG *));
 void __log_rem_logid __P((DB_LOG *, u_int32_t));
+#endif /* _log_ext_h_ */
diff --git a/db2/include/mp.h b/db2/include/mp.h
index f108246f2c..4efbf9b95e 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.22 (Sleepycat) 11/28/97
+ *	@(#)mp.h	10.25 (Sleepycat) 1/8/98
  */
 
 struct __bh;		typedef struct __bh BH;
@@ -41,13 +41,17 @@ struct __mpoolfile;	typedef struct __mpoolfile MPOOLFILE;
  *	Acquire the region lock.
  *	Find the buffer header.
  *	Increment the reference count (guarantee the buffer stays).
- *	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.
+ *	While the BH_LOCKED flag is set (I/O is going on) {
+ *	    Release the region lock.
+ *		Explicitly yield the processor if it's not the first pass
+ *		through this loop, otherwise, we can simply spin because
+ *		we'll be simply switching between the two locks.
+ *	    Request the buffer lock.
+ *	    The I/O will complete...
+ *	    Acquire the buffer lock.
+ *	    Release the buffer lock.
+ *	    Acquire the region lock.
+ *	}
  *	Return the buffer.
  *
  * Reading/writing a buffer:
@@ -57,12 +61,16 @@ struct __mpoolfile;	typedef struct __mpoolfile MPOOLFILE;
  *	Set the BH_LOCKED flag.
  *	Acquire the buffer lock (guaranteed not to block).
  *	Release the region lock.
- *	Do the I/O and/or initialize buffer contents.
+ *	Do the I/O and/or initialize the buffer contents.
+ *	Release the buffer lock.
+ *	    At this point, the buffer lock is available, but the logical
+ *	    operation (flagged by BH_LOCKED) is not yet completed.  For
+ *	    this reason, among others, threads checking the BH_LOCKED flag
+ *	    must loop around their test.
  *	Acquire the region lock.
  *	Clear the BH_LOCKED flag.
  *	Release the region lock.
- *	Release the buffer lock.
- *	If reading, return the buffer.
+ *	Return/discard the buffer.
  *
  * Pointers to DB_MPOOL, MPOOL, DB_MPOOLFILE and MPOOLFILE structures are not
  * reacquired when a region lock is reacquired because they couldn't have been
@@ -70,7 +78,8 @@ struct __mpoolfile;	typedef struct __mpoolfile MPOOLFILE;
  */
 #define	LOCKINIT(dbmp, mutexp)						\
 	if (F_ISSET(dbmp, MP_LOCKHANDLE | MP_LOCKREGION))		\
-		(void)__db_mutex_init(mutexp, (dbmp)->fd)
+		(void)__db_mutex_init(mutexp,				\
+		    MUTEX_LOCK_OFFSET((dbmp)->maddr, mutexp))
 
 #define	LOCKHANDLE(dbmp, mutexp)					\
 	if (F_ISSET(dbmp, MP_LOCKHANDLE))				\
diff --git a/db2/include/mp_ext.h b/db2/include/mp_ext.h
index b78b3423cd..1928820637 100644
--- a/db2/include/mp_ext.h
+++ b/db2/include/mp_ext.h
@@ -1,4 +1,6 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _mp_ext_h_
+#define _mp_ext_h_
 int __memp_bhwrite
     __P((DB_MPOOL *, MPOOLFILE *, BH *, int *, int *));
 int __memp_pgread __P((DB_MPOOLFILE *, BH *, int));
@@ -14,3 +16,4 @@ int __memp_ralloc __P((DB_MPOOL *, size_t, size_t *, void *));
 int __memp_ropen
    __P((DB_MPOOL *, const char *, size_t, int, int));
 int __memp_rclose __P((DB_MPOOL *));
+#endif /* _mp_ext_h_ */
diff --git a/db2/include/mutex_ext.h b/db2/include/mutex_ext.h
index cb2d4886af..f0e68f3659 100644
--- a/db2/include/mutex_ext.h
+++ b/db2/include/mutex_ext.h
@@ -1,4 +1,7 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
-void __db_mutex_init __P((db_mutex_t *, off_t));
+#ifndef _mutex_ext_h_
+#define _mutex_ext_h_
+void __db_mutex_init __P((db_mutex_t *, u_int32_t));
 int __db_mutex_lock __P((db_mutex_t *, int));
 int __db_mutex_unlock __P((db_mutex_t *, int));
+#endif /* _mutex_ext_h_ */
diff --git a/db2/include/os_ext.h b/db2/include/os_ext.h
index 2edf2e257d..9c66a248c8 100644
--- a/db2/include/os_ext.h
+++ b/db2/include/os_ext.h
@@ -1,8 +1,11 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _os_ext_h_
+#define _os_ext_h_
 int __db_abspath __P((const char *));
 void *__db_calloc __P((size_t, size_t));
 void *__db_malloc __P((size_t));
 void *__db_realloc __P((void *, size_t));
+int __os_oldwin __P((void));
 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 *));
@@ -19,5 +22,7 @@ int __os_seek __P((int, size_t, db_pgno_t, u_long, int));
 int __os_sleep __P((u_long, u_long));
 int __os_spin __P((void));
 int __os_exists __P((const char *, int *));
-int __os_ioinfo __P((const char *, int, off_t *, off_t *));
+int __os_ioinfo
+   __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *));
 int __db_unlink __P((const char *));
+#endif /* _os_ext_h_ */
diff --git a/db2/include/os_func.h b/db2/include/os_func.h
index 54b64ffaa2..b825fed5db 100644
--- a/db2/include/os_func.h
+++ b/db2/include/os_func.h
@@ -4,7 +4,7 @@
  * Copyright (c) 1997
  *	Sleepycat Software.  All rights reserved.
  *
- *	@(#)os_func.h	10.4 (Sleepycat) 11/28/97
+ *	@(#)os_func.h	10.5 (Sleepycat) 12/4/97
  */
 
 /* Calls which can be replaced by the application. */
@@ -17,8 +17,8 @@ struct __db_jumptab {
 		    __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 *));
+	int	(*db_ioinfo) __P((const char *,		/* DB_FUNC_IOINFO */
+		    int, u_int32_t *, u_int32_t *, u_int32_t *));
 	void   *(*db_malloc) __P((size_t));		/* DB_FUNC_MALLOC */
 	int	(*db_map)				/* DB_FUNC_MAP */
 		    __P((int, size_t, int, int, void **));
diff --git a/db2/include/txn_ext.h b/db2/include/txn_ext.h
index 9b617bb68c..7d694f070d 100644
--- a/db2/include/txn_ext.h
+++ b/db2/include/txn_ext.h
@@ -1,4 +1,6 @@
 /* DO NOT EDIT: automatically built by dist/distrib. */
+#ifndef _txn_ext_h_
+#define _txn_ext_h_
 int __txn_regop_log
     __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
     u_int32_t));
@@ -16,3 +18,4 @@ int __txn_init_recover __P((DB_ENV *));
 int __txn_regop_recover
     __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
 int __txn_ckp_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
+#endif /* _txn_ext_h_ */