summaryrefslogtreecommitdiff
path: root/db2/include
diff options
context:
space:
mode:
Diffstat (limited to 'db2/include')
-rw-r--r--db2/include/btree_ext.h2
-rw-r--r--db2/include/common_ext.h2
-rw-r--r--db2/include/db.h.src54
-rw-r--r--db2/include/db_cxx.h4
-rw-r--r--db2/include/db_ext.h1
-rw-r--r--db2/include/db_int.h.src3
-rw-r--r--db2/include/lock.h8
-rw-r--r--db2/include/log.h23
-rw-r--r--db2/include/mp.h23
-rw-r--r--db2/include/mp_ext.h6
-rw-r--r--db2/include/os_ext.h4
-rw-r--r--db2/include/os_func.h6
12 files changed, 91 insertions, 45 deletions
diff --git a/db2/include/btree_ext.h b/db2/include/btree_ext.h
index bbe0d971b2..46f2227bdd 100644
--- a/db2/include/btree_ext.h
+++ b/db2/include/btree_ext.h
@@ -11,7 +11,7 @@ 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_ca_delete __P((DB *, db_pgno_t, u_int32_t, CURSOR *));
+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));
diff --git a/db2/include/common_ext.h b/db2/include/common_ext.h
index b814582abd..29bc9aa4e2 100644
--- a/db2/include/common_ext.h
+++ b/db2/include/common_ext.h
@@ -23,7 +23,7 @@ int __db_syncchk __P((const DB *, int));
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 *));
+ const char *, const char *, int, size_t, int, 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 *));
diff --git a/db2/include/db.h.src b/db2/include/db.h.src
index 3cc2bfd4fc..654eb16425 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.91 (Sleepycat) 11/3/97
+ * @(#)db.h.src 10.97 (Sleepycat) 11/28/97
*/
#ifndef _DB_H_
@@ -73,8 +73,8 @@
#define DB_VERSION_MAJOR 2
#define DB_VERSION_MINOR 3
-#define DB_VERSION_PATCH 12
-#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.12: (11/3/97)"
+#define DB_VERSION_PATCH 14
+#define DB_VERSION_STRING "Sleepycat Software: DB 2.3.14: (11/28/97)"
typedef u_int32_t db_pgno_t; /* Page number type. */
typedef u_int16_t db_indx_t; /* Page offset type. */
@@ -129,8 +129,10 @@ struct __db_dbt {
};
/*
- * DB configuration. There are a set of functions which the application
- * can replace with its own versions.
+ * DB internal configuration.
+ *
+ * There are a set of functions that the application can replace with its
+ * own versions, and some other knobs which can be turned at run-time.
*/
#define DB_FUNC_CALLOC 1 /* ANSI C calloc. */
#define DB_FUNC_CLOSE 2 /* POSIX 1003.1 close. */
@@ -147,11 +149,12 @@ struct __db_dbt {
#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_STRDUP 16 /* DB: strdup(3). */
#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. */
+#define DB_TSL_SPINS 21 /* DB: initialize spin count. */
/*
* Database configuration and initialization.
@@ -211,10 +214,10 @@ struct __db_dbt {
* locking subsystem.
*/
#define DB_LOCK_NORUN 0x0
-#define DB_LOCK_DEFAULT 0x1
-#define DB_LOCK_OLDEST 0x2
-#define DB_LOCK_RANDOM 0x3
-#define DB_LOCK_YOUNGEST 0x4
+#define DB_LOCK_DEFAULT 0x1 /* Default policy. */
+#define DB_LOCK_OLDEST 0x2 /* Abort oldest transaction. */
+#define DB_LOCK_RANDOM 0x3 /* Abort random transaction. */
+#define DB_LOCK_YOUNGEST 0x4 /* Abort youngest transaction. */
struct __db_env {
int db_lorder; /* Byte order. */
@@ -265,6 +268,10 @@ struct __db_env {
/*******************************************************
* Access methods.
*******************************************************/
+/*
+ * XXX
+ * Changes here must be reflected in java/src/com/sleepycat/db/Db.java.
+ */
typedef enum {
DB_BTREE=1, /* B+tree. */
DB_HASH, /* Extended Linear Hashing. */
@@ -347,7 +354,13 @@ struct __db_info {
#define DB_SET_RANGE 0x020000 /* c_get() */
#define DB_SET_RECNO 0x040000 /* c_get() */
-/* DB (user visible) error return codes. */
+/*
+ * DB (user visible) error return codes.
+ *
+ * XXX
+ * Changes to any of the user visible error return codes must be reflected
+ * in java/src/com/sleepycat/db/Db.java.
+ */
#define DB_INCOMPLETE ( -1) /* Sync didn't finish. */
#define DB_KEYEMPTY ( -2) /* The key/data pair was deleted or
was never created by the user. */
@@ -516,6 +529,7 @@ 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 **));
+int db_value_set __P((int, int));
char *db_version __P((int *, int *, int *));
#if defined(__cplusplus)
};
@@ -533,16 +547,26 @@ char *db_version __P((int *, int *, int *));
/* Flag values for lock_detect(). */
#define DB_LOCK_CONFLICT 0x01 /* Run on any conflict. */
-/* Request types. */
+/*
+ * Request types.
+ *
+ * XXX
+ * Changes here must be reflected in java/src/com/sleepycat/db/Db.java.
+ */
typedef enum {
- DB_LOCK_DUMP, /* Display held locks. */
+ DB_LOCK_DUMP=0, /* Display held locks. */
DB_LOCK_GET, /* Get the lock. */
DB_LOCK_PUT, /* Release the lock. */
DB_LOCK_PUT_ALL, /* Release locker's locks. */
DB_LOCK_PUT_OBJ /* Release locker's locks on obj. */
} db_lockop_t;
-/* Simple R/W lock modes and for multi-granularity intention locking. */
+/*
+ * Simple R/W lock modes and for multi-granularity intention locking.
+ *
+ * XXX
+ * Changes here must be reflected in java/src/com/sleepycat/db/Db.java.
+ */
typedef enum {
DB_LOCK_NG=0, /* Not granted. */
DB_LOCK_READ, /* Shared/read. */
@@ -577,7 +601,7 @@ extern const u_int8_t db_riw_conflicts[];
extern "C" {
#endif
int lock_close __P((DB_LOCKTAB *));
-int lock_detect __P((DB_LOCKTAB *, int, u_int32_t));
+int lock_detect __P((DB_LOCKTAB *, int, int));
int lock_get __P((DB_LOCKTAB *,
u_int32_t, int, const DBT *, db_lockmode_t, DB_LOCK *));
int lock_id __P((DB_LOCKTAB *, u_int32_t *));
diff --git a/db2/include/db_cxx.h b/db2/include/db_cxx.h
index 01d1231092..83523c5559 100644
--- a/db2/include/db_cxx.h
+++ b/db2/include/db_cxx.h
@@ -4,7 +4,7 @@
* Copyright (c) 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)db_cxx.h 10.12 (Sleepycat) 10/25/97
+ * @(#)db_cxx.h 10.13 (Sleepycat) 11/25/97
*/
#ifndef _DB_CXX_H_
@@ -202,7 +202,7 @@ class _exported DbLockTab
friend DbEnv;
public:
int close();
- int detect(int atype, u_int32_t flags);
+ int detect(int flags, int atype);
int get(u_int32_t locker, int flags, const Dbt *obj,
db_lockmode_t lock_mode, DbLock *lock);
int id(u_int32_t *idp);
diff --git a/db2/include/db_ext.h b/db2/include/db_ext.h
index f9b3b3a214..15eeaf50a3 100644
--- a/db2/include/db_ext.h
+++ b/db2/include/db_ext.h
@@ -65,6 +65,7 @@ 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_end __P((void *));
int __db_dput __P((DB *,
DBT *, PAGE **, db_indx_t *, int (*)(DB *, u_int32_t, PAGE **)));
int __db_drem __P((DB *,
diff --git a/db2/include/db_int.h.src b/db2/include/db_int.h.src
index abd93a6e8e..03a882fded 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.36 (Sleepycat) 10/31/97
+ * @(#)db_int.h.src 10.37 (Sleepycat) 11/25/97
*/
#ifndef _DB_INTERNAL_H_
@@ -168,6 +168,7 @@ typedef struct _db_mutex_t {
off_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. */
u_int32_t mutex_set_nowait; /* Granted without waiting. */
} db_mutex_t;
diff --git a/db2/include/lock.h b/db2/include/lock.h
index 8a927f076e..5031b65d06 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.9 (Sleepycat) 10/25/97
+ * @(#)lock.h 10.10 (Sleepycat) 11/13/97
*/
typedef struct __db_lockobj DB_LOCKOBJ;
@@ -85,10 +85,14 @@ struct __db_lockobj {
} dlinks;
#define DB_LOCK_OBJTYPE 1
#define DB_LOCK_LOCKER 2
+ /* Allocate room in the object to
+ * hold typical DB lock structures
+ * so that we do not have to
+ * allocate them from shalloc. */
+ u_int8_t objdata[sizeof(struct __db_ilock)];
u_int8_t type; /* Real object or locker id. */
};
-
#define dd_id wlinks._dd_id
#define waiters wlinks._waiters
#define holders dlinks._holders
diff --git a/db2/include/log.h b/db2/include/log.h
index a192a38136..405daf4148 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.15 (Sleepycat) 11/2/97
+ * @(#)log.h 10.16 (Sleepycat) 11/9/97
*/
#ifndef _LOG_H_
@@ -117,20 +117,35 @@ struct __log {
SH_TAILQ_HEAD(__fq) fq; /* List of file names. */
+ /*
+ * The lsn LSN is the file offset that we're about to write and which
+ * we will return to the user.
+ */
DB_LSN lsn; /* LSN at current file offset. */
- DB_LSN c_lsn; /* LSN of the last checkpoint. */
+
+ /*
+ * The s_lsn LSN is the last LSN that we know is on disk, not just
+ * written, by synced.
+ */
DB_LSN s_lsn; /* LSN of the last sync. */
- DB_LSN uw_lsn; /* LSN of 1st rec not fully on disk. */
u_int32_t len; /* Length of the last record. */
- size_t b_off; /* Current offset in the buffer. */
u_int32_t w_off; /* Current write offset in the file. */
+ DB_LSN c_lsn; /* LSN of the last checkpoint. */
time_t chkpt; /* Time of the last checkpoint. */
DB_LOG_STAT stat; /* Log statistics. */
+ /*
+ * The f_lsn LSN is the LSN (returned to the user) that "owns" the
+ * first byte of the buffer. If the record associated with the LSN
+ * spans buffers, it may not reflect the physical file location of
+ * the first byte of the buffer.
+ */
+ DB_LSN f_lsn; /* LSN of first byte in the buffer. */
+ size_t b_off; /* Current offset in the buffer. */
u_int8_t buf[4 * 1024]; /* Log buffer. */
};
diff --git a/db2/include/mp.h b/db2/include/mp.h
index f68f42b144..f108246f2c 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.19 (Sleepycat) 10/25/97
+ * @(#)mp.h 10.22 (Sleepycat) 11/28/97
*/
struct __bh; typedef struct __bh BH;
@@ -23,7 +23,6 @@ struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE;
#define DB_CACHESIZE_MIN ( 20 * 1024)
#define INVALID 0 /* Invalid shared memory offset. */
-#define TEMPORARY "<tmp>" /* Temporary file name. */
/*
* There are three ways we do locking in the mpool code:
@@ -122,10 +121,10 @@ struct __db_mpool {
int fd; /* Underlying mmap'd fd. */
-
#define MP_ISPRIVATE 0x01 /* Private, so local memory. */
#define MP_LOCKHANDLE 0x02 /* Threaded, lock handles and region. */
#define MP_LOCKREGION 0x04 /* Concurrent access, lock region. */
+#define MP_MALLOC 0x08 /* If region in allocated memory. */
u_int32_t flags;
};
@@ -157,7 +156,6 @@ struct __db_mpoolfile {
/* These fields are not protected. */
TAILQ_ENTRY(__db_mpoolfile) q; /* Linked list of DB_MPOOLFILE's. */
- char *path; /* Initial file path. */
DB_MPOOL *dbmp; /* Overlying DB_MPOOL. */
MPOOLFILE *mfp; /* Underlying MPOOLFILE. */
@@ -165,11 +163,9 @@ struct __db_mpoolfile {
size_t len; /* Length of mmap'd region. */
/* These fields need to be protected for multi-threaded support. */
-#define MP_PATH_ALLOC 0x001 /* Path is allocated memory. */
-#define MP_PATH_TEMP 0x002 /* Backing file is a temporary. */
-#define MP_READONLY 0x004 /* File is readonly. */
-#define MP_UPGRADE 0x008 /* File descriptor is readwrite. */
-#define MP_UPGRADE_FAIL 0x010 /* Upgrade wasn't possible. */
+#define MP_READONLY 0x01 /* File is readonly. */
+#define MP_UPGRADE 0x02 /* File descriptor is readwrite. */
+#define MP_UPGRADE_FAIL 0x04 /* Upgrade wasn't possible. */
u_int32_t flags;
};
@@ -220,12 +216,9 @@ struct __mpoolfile {
u_int32_t ref; /* Reference count. */
int ftype; /* File type. */
- int can_mmap; /* If the file can be mmap'd. */
-
int lsn_off; /* Page's LSN offset. */
size_t path_off; /* File name location. */
-
size_t fileid_off; /* File identification location. */
size_t pgcookie_len; /* Pgin/pgout cookie length. */
@@ -233,6 +226,12 @@ struct __mpoolfile {
int lsn_cnt; /* Checkpoint buffers left to write. */
+ db_pgno_t last_pgno; /* Last page in the file. */
+
+#define MP_CAN_MMAP 0x01 /* If the file can be mmap'd. */
+#define MP_TEMP 0x02 /* Backing file is a temporary. */
+ u_int32_t flags;
+
DB_MPOOL_FSTAT stat; /* Per-file mpool statistics. */
};
diff --git a/db2/include/mp_ext.h b/db2/include/mp_ext.h
index 49d86ba2e5..b78b3423cd 100644
--- a/db2/include/mp_ext.h
+++ b/db2/include/mp_ext.h
@@ -5,8 +5,10 @@ int __memp_pgread __P((DB_MPOOLFILE *, BH *, int));
int __memp_pgwrite __P((DB_MPOOLFILE *, BH *, int *, int *));
int __memp_pg __P((DB_MPOOLFILE *, BH *, int));
void __memp_bhfree __P((DB_MPOOL *, MPOOLFILE *, BH *, int));
-int __memp_fopen __P((DB_MPOOL *, const char *, int, int,
- int, size_t, int, DBT *, u_int8_t *, int, DB_MPOOLFILE **));
+int __memp_fopen __P((DB_MPOOL *, MPOOLFILE *, const char *, int,
+ int, int, size_t, int, DBT *, u_int8_t *, int, DB_MPOOLFILE **));
+char * __memp_fn __P((DB_MPOOLFILE *));
+char * __memp_fns __P((DB_MPOOL *, MPOOLFILE *));
void __memp_debug __P((DB_MPOOL *, FILE *, int));
int __memp_ralloc __P((DB_MPOOL *, size_t, size_t *, void *));
int __memp_ropen
diff --git a/db2/include/os_ext.h b/db2/include/os_ext.h
index e48a1e9407..2edf2e257d 100644
--- a/db2/include/os_ext.h
+++ b/db2/include/os_ext.h
@@ -1,5 +1,8 @@
/* DO NOT EDIT: automatically built by dist/distrib. */
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_dirlist __P((const char *, char ***, int *));
void __os_dirfree __P((char **, int));
int __db_fileid __P((DB_ENV *, const char *, int, u_int8_t *));
@@ -14,6 +17,7 @@ int __db_read __P((int, void *, size_t, ssize_t *));
int __db_write __P((int, void *, size_t, ssize_t *));
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 __db_unlink __P((const char *));
diff --git a/db2/include/os_func.h b/db2/include/os_func.h
index 0a72942903..54b64ffaa2 100644
--- a/db2/include/os_func.h
+++ b/db2/include/os_func.h
@@ -4,12 +4,11 @@
* Copyright (c) 1997
* Sleepycat Software. All rights reserved.
*
- * @(#)os_func.h 10.2 (Sleepycat) 10/28/97
+ * @(#)os_func.h 10.4 (Sleepycat) 11/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 */
@@ -54,7 +53,6 @@ extern struct __db_jumptab __db_jump;
* 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
@@ -62,11 +60,9 @@ extern struct __db_jumptab __db_jump;
#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