diff options
author | jbj <devnull@localhost> | 2002-08-14 16:31:49 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-08-14 16:31:49 +0000 |
commit | d481ba55c02407124c499c7800ea556786137bc5 (patch) | |
tree | e0d3fdb7906ae3290f019999e0661cfc5b1b3f58 | |
parent | 9114d6ffea4ee330874ebc8febe225ce0e891eac (diff) | |
download | rpm-d481ba55c02407124c499c7800ea556786137bc5.tar.gz rpm-d481ba55c02407124c499c7800ea556786137bc5.tar.bz2 rpm-d481ba55c02407124c499c7800ea556786137bc5.zip |
Initial revision
CVS patchset: 5630
CVS date: 2002/08/14 16:31:49
463 files changed, 67112 insertions, 0 deletions
diff --git a/db/build_vxworks/dbdemo/README b/db/build_vxworks/dbdemo/README new file mode 100644 index 000000000..1a2c7c7d0 --- /dev/null +++ b/db/build_vxworks/dbdemo/README @@ -0,0 +1,39 @@ +This README describes the steps needed to run a demo example of BerkeleyDB. + +1. Read the pages in the Reference Guide that describe building + BerkeleyDB on VxWorks: + + $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/intro.html + $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/notes.html + $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/faq.html + +2. Launch Tornado 2.0 and open up the BerkeleyDB project. + +3. Add the demo project to that workspace: + + $(WIND_BASE)/target/src/BerkeleyDB/build_vxworks/demo/dbdemo.wpj + +4. Build BerkeleyDB as described in the Reference Guide. + +5. Build the dbdemo project. + +6. Download BerkeleyDB onto the target. + +7. Download the dbdemo project onto the target. + +8. Open a windsh to the target and run the demo: + + -> dbdemo "<pathname>/<dbname>" + + Where pathname is a pathname string pointing to a directory that the + demo can create a database in. That directory should already exist. + The dbname is the name for the database. For example: + + -> dbdemo "/tmp/demo.db" + +9. The demo program will ask for input. You can type in any string. + The program will add an entry to the database with that string as + the key and the reverse of that string as the data item for that key. + It will continue asking for input until you hit ^D or enter "quit". + Upon doing so, the demo program will display all the keys you have + entered as input and their data items. diff --git a/db/build_vxworks/dbdemo/dbdemo.c b/db/build_vxworks/dbdemo/dbdemo.c new file mode 100644 index 000000000..d821c0718 --- /dev/null +++ b/db/build_vxworks/dbdemo/dbdemo.c @@ -0,0 +1,170 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: ex_access.c,v 11.20 2002/04/10 21:48:20 bostic Exp + */ + +#include <sys/types.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef _WIN32 +extern int getopt(int, char * const *, const char *); +#else +#include <unistd.h> +#endif + +#include <db_int.h> + +#define DATABASE "access.db" +int dbdemo_main __P((int, char *[])); +int dbdemo_usage __P((void)); + +int +dbdemo(args) + char *args; +{ + int argc; + char **argv; + + __db_util_arg("dbdemo", args, &argc, &argv); + return (dbdemo_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS); +} + +#include <stdio.h> +#define ERROR_RETURN ERROR + +int +dbdemo_main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind, __db_getopt_reset; + DB *dbp; + DBC *dbcp; + DBT key, data; + u_int32_t len; + int ch, ret; + char *p, *t, buf[1024], rbuf[1024]; + const char *progname = "dbdemo"; /* Program name. */ + + __db_getopt_reset = 1; + while ((ch = getopt(argc, argv, "r")) != EOF) + switch (ch) { + case 'r': + (void)remove(DATABASE); + break; + case '?': + default: + return (dbdemo_usage()); + } + argc -= optind; + argv += optind; + + /* Create and initialize database object, open the database. */ + if ((ret = db_create(&dbp, NULL, 0)) != 0) { + fprintf(stderr, + "%s: db_create: %s\n", progname, db_strerror(ret)); + return (EXIT_FAILURE); + } + dbp->set_errfile(dbp, stderr); + dbp->set_errpfx(dbp, progname); + if ((ret = dbp->set_pagesize(dbp, 1024)) != 0) { + dbp->err(dbp, ret, "set_pagesize"); + goto err1; + } + if ((ret = dbp->set_cachesize(dbp, 0, 32 * 1024, 0)) != 0) { + dbp->err(dbp, ret, "set_cachesize"); + goto err1; + } + if ((ret = dbp->open(dbp, + NULL, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) { + dbp->err(dbp, ret, "%s: open", DATABASE); + goto err1; + } + + /* + * Insert records into the database, where the key is the user + * input and the data is the user input in reverse order. + */ + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + for (;;) { + printf("input> "); + fflush(stdout); + if (fgets(buf, sizeof(buf), stdin) == NULL) + break; + if (strcmp(buf, "exit\n") == 0 || strcmp(buf, "quit\n") == 0) + break; + if ((len = strlen(buf)) <= 1) + continue; + for (t = rbuf, p = buf + (len - 2); p >= buf;) + *t++ = *p--; + *t++ = '\0'; + + key.data = buf; + data.data = rbuf; + data.size = key.size = len - 1; + + switch (ret = + dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) { + case 0: + break; + default: + dbp->err(dbp, ret, "DB->put"); + if (ret != DB_KEYEXIST) + goto err1; + break; + } + } + printf("\n"); + + /* Acquire a cursor for the database. */ + if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) { + dbp->err(dbp, ret, "DB->cursor"); + goto err1; + } + + /* Initialize the key/data pair so the flags aren't set. */ + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Walk through the database and print out the key/data pairs. */ + while ((ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) == 0) + printf("%.*s : %.*s\n", + (int)key.size, (char *)key.data, + (int)data.size, (char *)data.data); + if (ret != DB_NOTFOUND) { + dbp->err(dbp, ret, "DBcursor->get"); + goto err2; + } + + /* Close everything down. */ + if ((ret = dbcp->c_close(dbcp)) != 0) { + dbp->err(dbp, ret, "DBcursor->close"); + goto err1; + } + if ((ret = dbp->close(dbp, 0)) != 0) { + fprintf(stderr, + "%s: DB->close: %s\n", progname, db_strerror(ret)); + return (EXIT_FAILURE); + } + return (EXIT_SUCCESS); + +err2: (void)dbcp->c_close(dbcp); +err1: (void)dbp->close(dbp, 0); + return (EXIT_FAILURE); +} + +int +dbdemo_usage() +{ + (void)fprintf(stderr, "usage: ex_access [-r]\n"); + return (EXIT_FAILURE); +} diff --git a/db/build_vxworks/dbdemo/dbdemo.wpj b/db/build_vxworks/dbdemo/dbdemo.wpj new file mode 100755 index 000000000..52eec5ed9 --- /dev/null +++ b/db/build_vxworks/dbdemo/dbdemo.wpj @@ -0,0 +1,160 @@ +Document file - DO NOT EDIT + +<BEGIN> BUILD_PENTIUMgnu_BUILDRULE +dbdemo.out +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_AR +ar386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE +$(PRJ_DIR)/PENTIUMgnu/dbdemo.a +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_AS +cc386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CC +cc386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP +cc386 -E -P -xc +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LD +ld386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS + +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS +-X -N +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_NM +nm386 -g +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE + +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS + +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE +size386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH +{$(WIND_BASE)/target/h/} \ + {$(WIND_BASE)/target/src/} \ + {$(WIND_BASE)/target/config/} +<END> + +<BEGIN> BUILD_PENTIUMgnu_TC +::tc_PENTIUMgnu +<END> + +<BEGIN> BUILD_RULE_archive + +<END> + +<BEGIN> BUILD_RULE_dbdemo.out + +<END> + +<BEGIN> BUILD_RULE_objects + +<END> + +<BEGIN> BUILD__CURRENT +PENTIUMgnu +<END> + +<BEGIN> BUILD__LIST +PENTIUMgnu +<END> + +<BEGIN> CORE_INFO_TYPE +::prj_vxApp +<END> + +<BEGIN> CORE_INFO_VERSION +2.0 +<END> + +<BEGIN> FILE_dbdemo.c_dependDone +FALSE +<END> + +<BEGIN> FILE_dbdemo.c_dependencies + +<END> + +<BEGIN> FILE_dbdemo.c_objects +dbdemo.o +<END> + +<BEGIN> FILE_dbdemo.c_tool +C/C++ compiler +<END> + +<BEGIN> PROJECT_FILES +$(PRJ_DIR)/dbdemo.c +<END> + +<BEGIN> userComments +dbdemo +<END> diff --git a/db/build_vxworks/dbdemo/dbdemo/Makefile.custom b/db/build_vxworks/dbdemo/dbdemo/Makefile.custom new file mode 100644 index 000000000..ca781f7b2 --- /dev/null +++ b/db/build_vxworks/dbdemo/dbdemo/Makefile.custom @@ -0,0 +1,51 @@ +# +# Custom Makefile shell +# +# This file may be edited freely, since it will not be regenerated +# by the project manager. +# +# Use this makefile to define rules to make external binaries +# and deposit them in the $(EXTERNAL_BINARIES_DIR) directory. +# +# If you have specified external modules during your component +# creation, you will find make rules already in place below. +# You will likely have to edit these to suit your individual +# build setup. +# +# You may wish to use the CPU, BUILD_SPEC or TOOL make variables in +# your Makefile to support builds for different architectures. Use +# the FORCE_EXTERNAL_MAKE phony target to ensure that your external +# make always runs. +# +# The example below assumes that your custom makefile is in the +# mySourceTree directory, and that the binary file it produces +# is placed into the $(BUILD_SPEC) sub-directory. +# +# EXTERNAL_SOURCE_BASE = /folk/me/mySourceTree +# EXTERNAL_MODULE = myLibrary.o +# EXTERNAL_MAKE = make +# +# $(EXTERNAL_BINARIES_DIR)/$(EXTERNAL_MODULE) : FORCE_EXTERNAL_MAKE +# $(EXTERNAL_MAKE) -C $(EXTERNAL_SOURCE_BASE) \ +# -f $(EXTERNAL_SOURCE_BASE)/Makefile \ +# CPU=$(CPU) BUILD_SPEC=$(BUILD_SPEC) $(@F) +# $(CP) $(subst /,$(DIRCHAR),$(EXTERNAL_SOURCE_BASE)/$(BUILD_SPEC)/$(@F) $@) +# +# If you are not adding your external modules from the component wizard, +# you will have to include them in your component yourself: +# +# From the GUI, you can do this with the Component's 'Add external module' +# dialog. +# +# If you are using the command line, add the module(s) by editing the +# MODULES line in component.cdf file, e.g. +# +# Component INCLUDE_MYCOMPONENT { +# +# MODULES foo.o goo.o \ +# myLibrary.o +# + + +# rules to build custom libraries + diff --git a/db/build_vxworks/dbdemo/dbdemo/component.cdf b/db/build_vxworks/dbdemo/dbdemo/component.cdf new file mode 100755 index 000000000..188b63bfa --- /dev/null +++ b/db/build_vxworks/dbdemo/dbdemo/component.cdf @@ -0,0 +1,30 @@ +/* component.cdf - dynamically updated configuration */ + +/* + * NOTE: you may edit this file to alter the configuration + * But all non-configuration information, including comments, + * will be lost upon rebuilding this project. + */ + +/* Component information */ + +Component INCLUDE_DBDEMO { + ENTRY_POINTS ALL_GLOBAL_SYMBOLS + MODULES dbdemo.o + NAME dbdemo + PREF_DOMAIN ANY + _INIT_ORDER usrComponentsInit +} + +/* EntryPoint information */ + +/* Module information */ + +Module dbdemo.o { + + NAME dbdemo.o + SRC_PATH_NAME $PRJ_DIR/../dbdemo.c +} + +/* Parameter information */ + diff --git a/db/build_vxworks/dbdemo/dbdemo/component.wpj b/db/build_vxworks/dbdemo/dbdemo/component.wpj new file mode 100755 index 000000000..b51ebce10 --- /dev/null +++ b/db/build_vxworks/dbdemo/dbdemo/component.wpj @@ -0,0 +1,475 @@ +Document file - DO NOT EDIT + +<BEGIN> CORE_INFO_TYPE +::prj_component +<END> + +<BEGIN> CORE_INFO_VERSION +AE1.1 +<END> + +<BEGIN> BUILD__CURRENT +PENTIUM2gnu.debug +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_CURRENT_TARGET +default +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_DEFAULTFORCPU +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_objects +dbdemo.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_objects +dbdemo.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CFLAGS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -I$(PRJ_DIR)/../.. \ + -I$(PRJ_DIR)/../../.. \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CFLAGS_AS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_TC +::tc_PENTIUM2gnu.debug +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_DEFAULTFORCPU +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/../dbdemo.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/../dbdemo.c_objects +dbdemo.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/../dbdemo.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CFLAGS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -O2 \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -I$(PRJ_DIR)/../.. \ + -I$(PRJ_DIR)/../../.. \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CFLAGS_AS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -O2 \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_RELEASE +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_RELEASE +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_TC +::tc_PENTIUM2gnu.release +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_DEFAULTFORCPU +1 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_objects +dbdemo.o +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/../dbdemo.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CFLAGS +-mcpu=pentium \ + -march=pentium \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -I$(PRJ_DIR)/../.. \ + -I$(PRJ_DIR)/../../.. \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CFLAGS_AS +-mcpu=pentium \ + -march=pentium \ + -ansi \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_TC +::tc_PENTIUMgnu.debug +<END> + +<BEGIN> BUILD__LIST +PENTIUM2gnu.debug PENTIUM2gnu.release PENTIUMgnu.debug +<END> + +<BEGIN> PROJECT_FILES +$(PRJ_DIR)/../dbdemo.c \ + $(PRJ_DIR)/compConfig.c +<END> + +<BEGIN> WCC__CDF_PATH +$(PRJ_DIR) +<END> + +<BEGIN> WCC__CURRENT +PENTIUM2gnu.debug +<END> + +<BEGIN> WCC__LIST +PENTIUM2gnu.debug +<END> + +<BEGIN> WCC__MXR_LIBS +lib$(CPU)$(TOOL)vx.a +<END> + +<BEGIN> WCC__OBJS_PATH +$(WIND_BASE)/target/lib/obj$CPU$TOOLvx +<END> + diff --git a/db/build_win32/build_all.dsp b/db/build_win32/build_all.dsp new file mode 100644 index 000000000..7ae1f9bb0 --- /dev/null +++ b/db/build_win32/build_all.dsp @@ -0,0 +1,96 @@ +# Microsoft Developer Studio Project File - Name="build_all" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Generic Project" 0x010a
+
+CFG=build_all - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "build_all.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "build_all.mak" CFG="build_all - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "build_all - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "build_all - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE "build_all - Win32 Release Static" (based on "Win32 (x86) External Target")
+!MESSAGE "build_all - Win32 Debug Static" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "build_all - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "echo DB Release version built."
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "build_all - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "echo DB Debug version built."
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "build_all - Win32 Release Static"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_static"
+# PROP BASE Intermediate_Dir "Release_static"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_static"
+# PROP Intermediate_Dir "Release_static"
+# PROP Cmd_Line "echo DB Release Static version built."
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "build_all - Win32 Debug Static"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_static"
+# PROP BASE Intermediate_Dir "Debug_Static"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_static"
+# PROP Intermediate_Dir "Debug_Static"
+# PROP Cmd_Line "echo DB Debug Static version built."
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "build_all - Win32 Release"
+# Name "build_all - Win32 Debug"
+# Name "build_all - Win32 Release Static"
+# Name "build_all - Win32 Debug Static"
+# End Target
+# End Project
diff --git a/db/build_win32/db_java_xa.dsp b/db/build_win32/db_java_xa.dsp new file mode 100644 index 000000000..9c700ffee --- /dev/null +++ b/db/build_win32/db_java_xa.dsp @@ -0,0 +1,85 @@ +# Microsoft Developer Studio Project File - Name="db_java_xa" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=db_java_xa - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "db_java_xa.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "db_java_xa.mak" CFG="db_java_xa - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "db_java_xa - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "db_java_xa - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "db_java_xa - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f db_java_xaj.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "db_java_xaj.exe"
+# PROP BASE Bsc_Name "db_java_xaj.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f db_java_xaj.mak Release/dbxa.jar"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "Release/dbxa.jar"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "db_java_xa - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f db_java_xaj.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "db_java_xaj.exe"
+# PROP BASE Bsc_Name "db_java_xaj.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f db_java_xaj.mak Debug/dbxa.jar"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "Debug/dbxa.jar"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "db_java_xa - Win32 Release"
+# Name "db_java_xa - Win32 Debug"
+
+!IF "$(CFG)" == "db_java_xa - Win32 Release"
+
+!ELSEIF "$(CFG)" == "db_java_xa - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\db_java_xaj.mak
+# End Source File
+# End Target
+# End Project
diff --git a/db/build_win32/db_java_xaj.mak b/db/build_win32/db_java_xaj.mak new file mode 100644 index 000000000..c2dbc920d --- /dev/null +++ b/db/build_win32/db_java_xaj.mak @@ -0,0 +1,21 @@ +JAVA_XADIR=../java/src/com/sleepycat/db/xa
+
+JAVA_XASRCS=\
+ $(JAVA_XADIR)/DbXAResource.java \
+ $(JAVA_XADIR)/DbXid.java
+
+Release/dbxa.jar : $(JAVA_XASRCS)
+ @echo compiling Berkeley DB XA classes
+ @javac -g -d ./Release/classes -classpath "$(CLASSPATH);./Release/classes" $(JAVA_XASRCS)
+ @echo creating jar file
+ @cd .\Release\classes
+ @jar cf ../dbxa.jar com\sleepycat\db\xa\*.class
+ @echo Java XA build finished
+
+Debug/dbxa.jar : $(JAVA_XASRCS)
+ @echo compiling Berkeley DB XA classes
+ @javac -g -d ./Debug/classes -classpath "$(CLASSPATH);./Debug/classes" $(JAVA_XASRCS)
+ @echo creating jar file
+ @cd .\Debug\classes
+ @jar cf ../dbxa.jar com\sleepycat\db\xa\*.class
+ @echo Java XA build finished
diff --git a/db/build_win32/db_lib.dsp b/db/build_win32/db_lib.dsp new file mode 100644 index 000000000..a7fb41579 --- /dev/null +++ b/db/build_win32/db_lib.dsp @@ -0,0 +1,92 @@ +# Microsoft Developer Studio Project File - Name="db_lib" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Generic Project" 0x010a
+
+CFG=db_lib - Win32 Debug Static
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "db_lib.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "db_lib.mak" CFG="db_lib - Win32 Debug Static"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "db_lib - Win32 Release" (based on "Win32 (x86) Generic Project")
+!MESSAGE "db_lib - Win32 Debug" (based on "Win32 (x86) Generic Project")
+!MESSAGE "db_lib - Win32 Release Static" (based on "Win32 (x86) Generic Project")
+!MESSAGE "db_lib - Win32 Debug Static" (based on "Win32 (x86) Generic Project")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "db_lib - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "db_lib - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "db_lib - Win32 Release Static"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_static"
+# PROP BASE Intermediate_Dir "Release_static"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_static"
+# PROP Intermediate_Dir "Release_static"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "db_lib - Win32 Debug Static"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_static"
+# PROP BASE Intermediate_Dir "Debug_Static"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_static"
+# PROP Intermediate_Dir "Debug_Static"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "db_lib - Win32 Release"
+# Name "db_lib - Win32 Debug"
+# Name "db_lib - Win32 Release Static"
+# Name "db_lib - Win32 Debug Static"
+# End Target
+# End Project
diff --git a/db/clib/strdup.c b/db/clib/strdup.c new file mode 100644 index 000000000..e82d2afcb --- /dev/null +++ b/db/clib/strdup.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: strdup.c,v 1.5 2002/05/01 18:40:05 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#endif + +/* + * strdup -- + * + * PUBLIC: #ifndef HAVE_STRDUP + * PUBLIC: char *strdup __P((const char *)); + * PUBLIC: #endif + */ +char * +strdup(str) + const char *str; +{ + size_t len; + char *copy; + + len = strlen(str) + 1; + if (!(copy = malloc((u_int)len))) + return (NULL); + memcpy(copy, str, len); + return (copy); +} diff --git a/db/common/db_idspace.c b/db/common/db_idspace.c new file mode 100644 index 000000000..7defde82b --- /dev/null +++ b/db/common/db_idspace.c @@ -0,0 +1,93 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_idspace.c,v 1.5 2002/02/01 18:15:29 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stdlib.h> +#endif + +#include "db_int.h" + +static int __db_idcmp __P((const void *, const void *)); + +static int +__db_idcmp(a, b) + const void *a; + const void *b; +{ + u_int32_t i, j; + + i = *(u_int32_t *)a; + j = *(u_int32_t *)b; + + if (i < j) + return (-1); + else if (i > j) + return (1); + else + return (0); +} + +/* + * __db_idspace -- + * + * On input, minp and maxp contain the minimum and maximum valid values for + * the name space and on return, they contain the minimum and maximum ids + * available (by finding the biggest gap). + * + * PUBLIC: void __db_idspace __P((u_int32_t *, int, u_int32_t *, u_int32_t *)); + */ +void +__db_idspace(inuse, n, minp, maxp) + u_int32_t *inuse; + int n; + u_int32_t *minp, *maxp; +{ + int i, low; + u_int32_t gap, t; + + /* A single locker ID is a special case. */ + if (n == 1) { + /* + * If the single item in use is the last one in the range, + * then we've got to perform wrap which means that we set + * the min to the minimum ID, which is what we came in with, + * so we don't do anything. + */ + if (inuse[0] != *maxp) + *minp = inuse[0]; + *maxp = inuse[0] - 1; + return; + } + + gap = 0; + low = 0; + qsort(inuse, n, sizeof(u_int32_t), __db_idcmp); + for (i = 0; i < n - 1; i++) + if ((t = (inuse[i + 1] - inuse[i])) > gap) { + gap = t; + low = i; + } + + /* Check for largest gap at the end of the space. */ + if ((*maxp - inuse[n - 1]) + (inuse[0] - *minp) > gap) { + /* Do same check as we do in the n == 1 case. */ + if (inuse[n - 1] != *maxp) + *minp = inuse[n - 1]; + *maxp = inuse[0]; + } else { + *minp = inuse[low]; + *maxp = inuse[low + 1]; + } +} diff --git a/db/common/util_cache.c b/db/common/util_cache.c new file mode 100644 index 000000000..c8af63062 --- /dev/null +++ b/db/common/util_cache.c @@ -0,0 +1,92 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: util_cache.c,v 1.3 2002/04/04 18:50:10 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stdlib.h> + +#include <string.h> +#include <unistd.h> +#endif + +#include "db_int.h" + +/* + * __db_util_cache -- + * Compute if we have enough cache. + * + * PUBLIC: int __db_util_cache __P((DB_ENV *, DB *, u_int32_t *, int *)); + */ +int +__db_util_cache(dbenv, dbp, cachep, resizep) + DB_ENV *dbenv; + DB *dbp; + u_int32_t *cachep; + int *resizep; +{ + DBTYPE type; + DB_BTREE_STAT *bsp; + DB_HASH_STAT *hsp; + DB_QUEUE_STAT *qsp; + u_int32_t pgsize; + int ret; + void *sp; + + /* + * The current cache size is in cachep. If it's insufficient, set the + * the memory referenced by resizep to 1 and set cachep to the minimum + * size needed. + */ + if ((ret = dbp->get_type(dbp, &type)) != 0) { + dbenv->err(dbenv, ret, "DB->get_type"); + return (ret); + } + + if ((ret = dbp->stat(dbp, &sp, DB_FAST_STAT)) != 0) { + dbenv->err(dbenv, ret, "DB->stat"); + return (ret); + } + + switch (type) { + case DB_QUEUE: + qsp = (DB_QUEUE_STAT *)sp; + pgsize = qsp->qs_pagesize; + break; + case DB_HASH: + hsp = (DB_HASH_STAT *)sp; + pgsize = hsp->hash_pagesize; + break; + case DB_BTREE: + case DB_RECNO: + bsp = (DB_BTREE_STAT *)sp; + pgsize = bsp->bt_pagesize; + break; + default: + dbenv->err(dbenv, ret, "unknown database type: %d", type); + return (EINVAL); + } + free(sp); + + /* + * Make sure our current cache is big enough. We want at least + * DB_MINPAGECACHE pages in the cache. + */ + if ((*cachep / pgsize) < DB_MINPAGECACHE) { + *resizep = 1; + *cachep = pgsize * DB_MINPAGECACHE; + } else + *resizep = 0; + + return (0); +} diff --git a/db/crypto/aes_method.c b/db/crypto/aes_method.c new file mode 100644 index 000000000..5cfc54b8c --- /dev/null +++ b/db/crypto/aes_method.c @@ -0,0 +1,276 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * + * Some parts of this code originally written by Adam Stubblefield, + * astubble@rice.edu. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: aes_method.c,v 1.16 2002/08/06 06:11:14 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/crypto.h" +#include "dbinc/hmac.h" + +static void __aes_err __P((DB_ENV *, int)); +static int __aes_derivekeys __P((DB_ENV *, DB_CIPHER *, u_int8_t *, size_t)); + +/* + * __aes_setup -- + * Setup AES functions. + * + * PUBLIC: int __aes_setup __P((DB_ENV *, DB_CIPHER *)); + */ +int +__aes_setup(dbenv, db_cipher) + DB_ENV *dbenv; + DB_CIPHER *db_cipher; +{ + AES_CIPHER *aes_cipher; + int ret; + + db_cipher->adj_size = __aes_adj_size; + db_cipher->close = __aes_close; + db_cipher->decrypt = __aes_decrypt; + db_cipher->encrypt = __aes_encrypt; + db_cipher->init = __aes_init; + if ((ret = __os_calloc(dbenv, 1, sizeof(AES_CIPHER), &aes_cipher)) != 0) + return (ret); + db_cipher->data = aes_cipher; + return (0); +} + +/* + * __aes_adj_size -- + * Given a size, return an addition amount needed to meet the + * "chunk" needs of the algorithm. + * + * PUBLIC: int __aes_adj_size __P((size_t)); + */ +int +__aes_adj_size(len) + size_t len; +{ + if (len % DB_AES_CHUNK == 0) + return (0); + return ((int)(DB_AES_CHUNK - (len % DB_AES_CHUNK))); +} + +/* + * __aes_close -- + * Destroy the AES encryption instantiation. + * + * PUBLIC: int __aes_close __P((DB_ENV *, void *)); + */ +int +__aes_close(dbenv, data) + DB_ENV *dbenv; + void *data; +{ + __os_free(dbenv, data); + return (0); +} + +/* + * __aes_decrypt -- + * Decrypt data with AES. + * + * PUBLIC: int __aes_decrypt __P((DB_ENV *, void *, void *, + * PUBLIC: u_int8_t *, size_t)); + */ +int +__aes_decrypt(dbenv, aes_data, iv, cipher, cipher_len) + DB_ENV *dbenv; + void *aes_data; + void *iv; + u_int8_t *cipher; + size_t cipher_len; +{ + AES_CIPHER *aes; + cipherInstance c; + int ret; + + aes = (AES_CIPHER *)aes_data; + if (iv == NULL || cipher == NULL) + return (EINVAL); + if ((cipher_len % DB_AES_CHUNK) != 0) + return (EINVAL); + /* + * Initialize the cipher + */ + if ((ret = __db_cipherInit(&c, MODE_CBC, iv)) < 0) { + __aes_err(dbenv, ret); + return (EAGAIN); + } + + /* Do the decryption */ + if ((ret = __db_blockDecrypt(&c, &aes->decrypt_ki, cipher, + cipher_len * 8, cipher)) < 0) { + __aes_err(dbenv, ret); + return (EAGAIN); + } + return (0); +} + +/* + * __aes_encrypt -- + * Encrypt data with AES. + * + * PUBLIC: int __aes_encrypt __P((DB_ENV *, void *, void *, + * PUBLIC: u_int8_t *, size_t)); + */ +int +__aes_encrypt(dbenv, aes_data, iv, data, data_len) + DB_ENV *dbenv; + void *aes_data; + void *iv; + u_int8_t *data; + size_t data_len; +{ + AES_CIPHER *aes; + cipherInstance c; + u_int32_t tmp_iv[DB_IV_BYTES/4]; + int ret; + + aes = (AES_CIPHER *)aes_data; + if (aes == NULL || data == NULL) + return (EINVAL); + if ((data_len % DB_AES_CHUNK) != 0) + return (EINVAL); + /* + * Generate the IV here. We store it in a tmp IV because + * the IV might be stored within the data we are encrypting + * and so we will copy it over to the given location after + * encryption is done. + * We don't do this outside of there because some encryption + * algorithms someone might add may not use IV's and we always + * want on here. + */ + if ((ret = __db_generate_iv(dbenv, tmp_iv)) != 0) + return (ret); + + /* + * Initialize the cipher + */ + if ((ret = __db_cipherInit(&c, MODE_CBC, (char *)tmp_iv)) < 0) { + __aes_err(dbenv, ret); + return (EAGAIN); + } + + /* Do the encryption */ + if ((ret = __db_blockEncrypt(&c, &aes->encrypt_ki, data, data_len * 8, + data)) < 0) { + __aes_err(dbenv, ret); + return (EAGAIN); + } + memcpy(iv, tmp_iv, DB_IV_BYTES); + return (0); +} + +/* + * __aes_init -- + * Initialize the AES encryption instantiation. + * + * PUBLIC: int __aes_init __P((DB_ENV *, DB_CIPHER *)); + */ +int +__aes_init(dbenv, db_cipher) + DB_ENV *dbenv; + DB_CIPHER *db_cipher; +{ + return (__aes_derivekeys(dbenv, db_cipher, (u_int8_t *)dbenv->passwd, + dbenv->passwd_len)); +} + +static int +__aes_derivekeys(dbenv, db_cipher, passwd, plen) + DB_ENV *dbenv; + DB_CIPHER *db_cipher; + u_int8_t *passwd; + size_t plen; +{ + SHA1_CTX ctx; + AES_CIPHER *aes; + int ret; + u_int32_t temp[DB_MAC_KEY/4]; + + if (passwd == NULL) + return (EINVAL); + + aes = (AES_CIPHER *)db_cipher->data; + + /* Derive the crypto keys */ + __db_SHA1Init(&ctx); + __db_SHA1Update(&ctx, passwd, plen); + __db_SHA1Update(&ctx, (u_int8_t *)DB_ENC_MAGIC, strlen(DB_ENC_MAGIC)); + __db_SHA1Update(&ctx, passwd, plen); + __db_SHA1Final((u_int8_t *)temp, &ctx); + + if ((ret = __db_makeKey(&aes->encrypt_ki, DIR_ENCRYPT, + DB_AES_KEYLEN, (char *)temp)) != TRUE) { + __aes_err(dbenv, ret); + return (EAGAIN); + } + if ((ret = __db_makeKey(&aes->decrypt_ki, DIR_DECRYPT, + DB_AES_KEYLEN, (char *)temp)) != TRUE) { + __aes_err(dbenv, ret); + return (EAGAIN); + } + return (0); +} + +/* + * __aes_err -- + * Handle AES-specific errors. Codes and messages derived from + * rijndael/rijndael-api-fst.h. + */ +static void +__aes_err(dbenv, err) + DB_ENV *dbenv; + int err; +{ + char *errstr; + + switch (err) { + case BAD_KEY_DIR: + errstr = "AES key direction is invalid"; + break; + case BAD_KEY_MAT: + errstr = "AES key material not of correct length"; + break; + case BAD_KEY_INSTANCE: + errstr = "AES key passwd not valid"; + break; + case BAD_CIPHER_MODE: + errstr = "AES cipher in wrong state (not initialized)"; + break; + case BAD_BLOCK_LENGTH: + errstr = "AES bad block length"; + break; + case BAD_CIPHER_INSTANCE: + errstr = "AES cipher instance is invalid"; + break; + case BAD_DATA: + errstr = "AES data contents are invalid"; + break; + case BAD_OTHER: + errstr = "AES unknown error"; + break; + default: + errstr = "AES error unrecognized"; + break; + } + __db_err(dbenv, errstr); + return; +} diff --git a/db/crypto/crypto.c b/db/crypto/crypto.c new file mode 100644 index 000000000..a47ca89bb --- /dev/null +++ b/db/crypto/crypto.c @@ -0,0 +1,340 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2001 + * Sleepycat Software. All rights reserved. + * + * Some parts of this code originally written by Adam Stubblefield + * - astubble@rice.edu + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: crypto.c,v 1.18 2002/08/06 06:11:14 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/crypto.h" + +/* + * __crypto_region_init -- + * Initialize crypto. + * + * PUBLIC: int __crypto_region_init __P((DB_ENV *)); + */ +int +__crypto_region_init(dbenv) + DB_ENV *dbenv; +{ + REGENV *renv; + REGINFO *infop; + CIPHER *cipher; + DB_CIPHER *db_cipher; + char *sh_passwd; + int ret; + + db_cipher = dbenv->crypto_handle; + + ret = 0; + infop = dbenv->reginfo; + renv = infop->primary; + MUTEX_LOCK(dbenv, &renv->mutex); + if (renv->cipher_off == INVALID_ROFF) { + if (!CRYPTO_ON(dbenv)) + goto out; + if (!F_ISSET(infop, REGION_CREATE)) { + __db_err(dbenv, + "Joining non-encrypted environment with encryption key"); + ret = EINVAL; + goto out; + } + if (F_ISSET(db_cipher, CIPHER_ANY)) { + __db_err(dbenv, "Encryption algorithm not supplied"); + ret = EINVAL; + goto out; + } + /* + * Must create the shared information. We need: + * Shared cipher information that contains the passwd. + * After we copy the passwd, we smash and free the one in the + * dbenv. + */ + if ((ret = __db_shalloc(infop->addr, + sizeof(CIPHER), MUTEX_ALIGN, &cipher)) != 0) + goto out; + memset(cipher, 0, sizeof(*cipher)); + if ((ret = __db_shalloc(infop->addr, + dbenv->passwd_len, 0, &sh_passwd)) != 0) { + __db_shalloc_free(infop->addr, cipher); + goto out; + } + memset(sh_passwd, 0, dbenv->passwd_len); + cipher->passwd = R_OFFSET(infop, sh_passwd); + cipher->passwd_len = dbenv->passwd_len; + cipher->flags = db_cipher->alg; + memcpy(sh_passwd, dbenv->passwd, cipher->passwd_len); + renv->cipher_off = R_OFFSET(infop, cipher); + } else { + if (!CRYPTO_ON(dbenv)) { + __db_err(dbenv, + "Encrypted environment: no encryption key supplied"); + ret = EINVAL; + goto out; + } + cipher = R_ADDR(infop, renv->cipher_off); + sh_passwd = R_ADDR(infop, cipher->passwd); + if ((cipher->passwd_len != dbenv->passwd_len) || + memcmp(dbenv->passwd, sh_passwd, cipher->passwd_len) != 0) { + __db_err(dbenv, "Invalid password"); + ret = EPERM; + goto out; + } + if (!F_ISSET(db_cipher, CIPHER_ANY) && + db_cipher->alg != cipher->flags) { + __db_err(dbenv, + "Environment encrypted using a different algorithm"); + ret = EINVAL; + goto out; + } + if (F_ISSET(db_cipher, CIPHER_ANY)) + /* + * We have CIPHER_ANY and we are joining the + * existing env. Setup our cipher structure + * for whatever algorithm this env has. + */ + if ((ret = __crypto_algsetup(dbenv, db_cipher, + cipher->flags, 0)) != 0) + goto out; + } + MUTEX_UNLOCK(dbenv, &renv->mutex); + ret = db_cipher->init(dbenv, db_cipher); + + /* + * On success, no matter if we allocated it or are using the + * already existing one, we are done with the passwd in the dbenv. + * We smash N-1 bytes so that we don't overwrite the nul. + */ + memset(dbenv->passwd, 0xff, dbenv->passwd_len-1); + __os_free(dbenv, dbenv->passwd); + dbenv->passwd = NULL; + dbenv->passwd_len = 0; + + if (0) { +out: MUTEX_UNLOCK(dbenv, &renv->mutex); + } + return (ret); +} + +/* + * __crypto_dbenv_close -- + * Crypto-specific destruction of DB_ENV structure. + * + * PUBLIC: int __crypto_dbenv_close __P((DB_ENV *)); + */ +int +__crypto_dbenv_close(dbenv) + DB_ENV *dbenv; +{ + DB_CIPHER *db_cipher; + int ret; + + ret = 0; + db_cipher = dbenv->crypto_handle; + if (dbenv->passwd != NULL) { + memset(dbenv->passwd, 0xff, dbenv->passwd_len-1); + __os_free(dbenv, dbenv->passwd); + dbenv->passwd = NULL; + } + if (!CRYPTO_ON(dbenv)) + return (0); + if (!F_ISSET(db_cipher, CIPHER_ANY)) + ret = db_cipher->close(dbenv, db_cipher->data); + __os_free(dbenv, db_cipher); + return (ret); +} + +/* + * __crypto_algsetup -- + * Given a db_cipher structure and a valid algorithm flag, call + * the specific algorithm setup function. + * + * PUBLIC: int __crypto_algsetup __P((DB_ENV *, DB_CIPHER *, u_int32_t, int)); + */ +int +__crypto_algsetup(dbenv, db_cipher, alg, do_init) + DB_ENV *dbenv; + DB_CIPHER *db_cipher; + u_int32_t alg; + int do_init; +{ + int ret; + + ret = 0; + if (!CRYPTO_ON(dbenv)) { + __db_err(dbenv, "No cipher structure given"); + return (EINVAL); + } + F_CLR(db_cipher, CIPHER_ANY); + switch (alg) { + case CIPHER_AES: + db_cipher->alg = CIPHER_AES; + ret = __aes_setup(dbenv, db_cipher); + break; + default: + __db_panic(dbenv, EINVAL); + /* NOTREACHED */ + } + if (do_init) + ret = db_cipher->init(dbenv, db_cipher); + return (ret); +} + +/* + * __crypto_decrypt_meta -- + * Perform decryption on a metapage if needed. + * + * PUBLIC: int __crypto_decrypt_meta __P((DB_ENV *, DB *, + * PUBLIC: u_int8_t *, size_t, int)); + */ +int +__crypto_decrypt_meta(dbenv, dbp, mbuf, len, do_metachk) + DB_ENV *dbenv; + DB *dbp; + u_int8_t *mbuf; + size_t len; + int do_metachk; +{ + DB_CIPHER *db_cipher; + DB dummydb; + DBMETA *meta; + size_t pg_off; + int ret; + u_int8_t *iv; + + DB_ASSERT(len >= DBMETASIZE); + /* + * If we weren't given a dbp, we just want to decrypt the page + * on behalf of some internal subsystem, not on behalf of a user + * with a dbp. Therefore, set up a dummy dbp so that the call + * to P_OVERHEAD below works. + */ + if (dbp == NULL) { + memset(&dummydb, 0, sizeof(DB)); + dbp = &dummydb; + } + /* + * Meta-pages may be encrypted for DBMETASIZE bytes. If + * we have a non-zero IV (that is written after encryption) + * then we decrypt (or error if the user isn't set up for + * security). We guarantee that the IV space on non-encrypted + * pages will be zero and a zero-IV is illegal for encryption. + * Therefore any non-zero IV means an encrypted database. + * This basically checks the passwd on the file + * if we cannot find a good magic number. + * We walk through all the algorithms we know about attempting + * to decrypt (and possibly byteswap). + * + * !!! + * All method meta pages have the IV and checksum at the + * exact same location, but not in DBMETA, use BTMETA. + */ + ret = 0; + meta = (DBMETA *)mbuf; + if (meta->encrypt_alg != 0) { + db_cipher = (DB_CIPHER *)dbenv->crypto_handle; + if (!F_ISSET(dbp, DB_AM_ENCRYPT)) { + if (!CRYPTO_ON(dbenv)) { + __db_err(dbenv, + "Encrypted database: no encryption flag specified"); + return (EINVAL); + } + /* + * User has a correct, secure env, but has + * encountered a database in that env that is + * secure, but user didn't dbp->set_flags. Since + * it is existing, use encryption if it is that + * way already. + */ + F_SET(dbp, DB_AM_ENCRYPT|DB_AM_CHKSUM); + } + /* + * This was checked in set_flags when DB_AM_ENCRYPT was set. + * So it better still be true here. + */ + DB_ASSERT(CRYPTO_ON(dbenv)); + if (!F_ISSET(db_cipher, CIPHER_ANY) && + meta->encrypt_alg != db_cipher->alg) { + __db_err(dbenv, + "Database encrypted using a different algorithm"); + return (EINVAL); + } + DB_ASSERT(F_ISSET(dbp, DB_AM_CHKSUM)); + iv = ((BTMETA *)mbuf)->iv; + /* + * For ALL pages, we do not encrypt the beginning + * of the page that contains overhead information. + * This is true of meta and all other pages. + */ + pg_off = P_OVERHEAD(dbp); +alg_retry: + /* + * If they asked for a specific algorithm, then + * use it. Otherwise walk through those we know. + */ + if (!F_ISSET(db_cipher, CIPHER_ANY)) { + if (do_metachk && (ret = db_cipher->decrypt(dbenv, + db_cipher->data, iv, mbuf + pg_off, + DBMETASIZE - pg_off))) + return (ret); + if (((BTMETA *)meta)->crypto_magic != + meta->magic) { + __db_err(dbenv, "Invalid password"); + return (EINVAL); + } + /* + * Success here. The algorithm asked for and the one + * on the file match. We've just decrypted the meta + * page and checked the magic numbers. They match, + * indicating the password is right. All is right + * with the world. + */ + return (0); + } + /* + * If we get here, CIPHER_ANY must be set. + */ + ret = __crypto_algsetup(dbenv, db_cipher, meta->encrypt_alg, 1); + goto alg_retry; + } else if (F_ISSET(dbp, DB_AM_ENCRYPT)) { + /* + * They gave us a passwd, but the database is not + * encrypted. This is an error. We do NOT want to + * silently allow them to write data in the clear when + * the user set up and expects encrypted data. + * + * This covers at least the following scenario. + * 1. User creates and sets up an encrypted database. + * 2. Attacker cannot read the actual data in the database + * because it is encrypted, but can remove/replace the file + * with an empty, unencrypted database file. + * 3. User sets encryption and we get to this code now. + * If we allowed the file to be used in the clear since + * it is that way on disk, the user would unsuspectingly + * write sensitive data in the clear. + * 4. Attacker reads data that user thought was encrypted. + * + * Therefore, asking for encryption with a database that + * was not encrypted is an error. + */ + __db_err(dbenv, + "Unencrypted database with a supplied encryption key"); + return (EINVAL); + } + return (ret); +} diff --git a/db/crypto/crypto.html b/db/crypto/crypto.html new file mode 100644 index 000000000..9475beb2a --- /dev/null +++ b/db/crypto/crypto.html @@ -0,0 +1,639 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; FreeBSD 4.3-RELEASE i386) [Netscape]"> +</head> +<body> + +<center> +<h1> + Security Interface for Berkeley DB</h1></center> + +<center><i>Susan LoVerso</i> +<br><i>sue@sleepycat.com</i> +<br><i>Rev 1.6</i> +<br><i>2002 Feb 26</i></center> + +<p>We provide an interface allowing secure access to Berkeley DB. +Our goal is to allow users to have encrypted secure databases. In +this document, the term <i>ciphering</i> means the act of encryption or +decryption. They are equal but opposite actions and the same issues +apply to both just in the opposite direction. +<h3> +Requirements</h3> +The overriding requirement is to provide a simple mechanism to allow users +to have a secure database. A secure database means that all of the +pages of a database will be encrypted, and all of the log files will be +encrypted. +<p>Falling out from this work will be a simple mechanism to allow users +to request that we checksum their data for additional error detection (without +encryption/decryption). +<p>We expect that data in process memory or stored in shared memory, potentially +backed by disk, is not encrypted or secure. +<h2> +<a NAME="DB Modifications"></a>DB Method Interface Modifications</h2> +With a logging environment, all database changes are recorded in the log +files. Therefore, users requiring secure databases in such environments +also require secure log files. +<p>A prior thought had been to allow different passwords on the environment +and the databases within. However, such a scheme, then requires that +the password be logged in order for recovery to be able to restore the +database. Therefore, any application having the password for the +log could get the password for any databases by reading the log. +So having a different password on a database does not gain any additional +security and it makes certain things harder and more complex. Some +of those more complex things include the need to handle database and env +passwords differently since they'd need to be stored and accessed from +different places. Also resolving the issue of how <i>db_checkpoint</i> +or <i>db_sync</i>, which flush database pages to disk, would find the passwords +of various databases without any dbps was unsolved. The feature didn't +gain anything and caused significant pain. Therefore the decision +is that there will be a single password protecting an environment and all +the logs and some databases within that environment. We do allow +users to have a secure environment and clear databases. Users that +want secure databases within a secure environment must set a flag. +<p>Users wishing to enable encryption on a database in a secure environment +or enable just checksumming on their database pages will use new flags +to <a href="../docs/api_c/db_set_flags.html">DB->set_flags()</a>. +Providing ciphering over an entire environment is accomplished by adding +a single environment method: <a href="../docs/api_c/env_set_encrypt.html">DBENV->set_encrypt()</a>. +Providing encryption for a database (not part of an environment) is accomplished +by adding a new database method: <a href="../docs/api_c/db_set_encrypt.html">DB->set_encrypt()</a>. +<p>Both of the <i>set_encrypt</i> methods must be called before their respective +<i>open</i> calls. The environment method must be before the environment +open because we must know about security before there is any possibility +of writing any log records out. The database method must be before +the database open in order to read the root page. The planned interfaces +for these methods are: +<pre>DBENV->set_encrypt(DBENV *dbenv, /* DB_ENV structure */ + char *passwd /* Password */ + u_int32_t flags); /* Flags */</pre> + +<pre>DB->set_encrypt(DB *dbp, /* DB structure */ + char *passwd /* Password */ + u_int32_t flags); /* Flags */</pre> +The flags accepted by these functions are: +<pre>#define DB_ENCRYPT_AES 0x00000001 /* Use the AES encryption algorithm */</pre> +Passwords are NULL-terminated strings. NULL or zero length strings +are illegal. These flags enable the checksumming and encryption using +the particular algorithms we have chosen for this implementation. +The flags are named such that there is a logical naming pattern if additional +checksum or encryption algorithms are used. If a user gives a flag of zero, +it will behave in a manner similar to DB_UNKNOWN. It will be illegal if +they are creating the environment or database, as an algorithm must be +specified. If they are joining an existing environment or opening an existing +database, they will use whatever algorithm is in force at the time. +Using DB_ENCRYPT_AES automatically implies SHA1 checksumming. +<p>These functions will perform several initialization steps. We +will allocate crypto_handle for our env handle and set up our function +pointers. We will allocate space and copy the password into our env +handle password area. Similar to <i>DB->set_cachesize</i>, calling +<i>DB->set_encrypt</i> +will actually reflect back into the local environment created by DB. +<p>Lastly, we will add a new flag, DB_OVERWRITE, to the <a href="../docs/api_c/env_remove.html">DBENV->remove</a> +method. The purpose of this flag is to force all of the memory used +by the shared regions to be overwritten before removal. We will use +<i>rm_overwrite</i>, +a function that overwrites and syncs a file 3 times with varying bit patterns +to really remove a file. Additionally, this flag will force a sync +of the overwritten regions to disk, if the regions are backed by the file +system. That way there is no residual information left in the clear +in memory or freed disk blocks. Although we expect that this flag +will be used by customers using security, primarily, its action is not +dependent on passwords or a secure setup, and so can be used by anyone. +<h4> +Initialization of the Environment</h4> +The setup of the security subsystem will be similar to replication initialization +since it is a sort of subsystem, but it does not have its own region. +When the environment handle is created via <i>db_env_create</i>, we initialize +our <i>set_encrypt</i> method to be the RPC or local version. Therefore +the <i>__dbenv</i> structure needs a new pointer: +<pre> void *crypto_handle; /* Security handle */</pre> +The crypto handle will really point to a new <i>__db_cipher</i> structure +that will contain a set of functions and a pointer to the in-memory information +needed by the specific encryption algorithm. It will look like: +<pre>typedef struct __db_cipher { + int (*init)__P((...)); /* Alg-specific initialization function */ + int (*encrypt)__P((...)); /* Alg-specific encryption algorithm */ + int (*decrypt)__P((...)); /* Alg-specific decryption function */ + void *data; /* Pointer to alg-specific information (AES_CIPHER) */ + u_int32_t flags; /* Cipher flags */ +} DB_CIPHER;</pre> + +<pre>#define DB_MAC_KEY 20 /* Size of the MAC key */ +typedef struct __aes_cipher { + keyInstance encrypt_ki; /* Encrypt keyInstance temp. */ + keyInstance decrypt_ki; /* Decrypt keyInstance temp. */ + u_int8_t mac_key[DB_MAC_KEY]; /* MAC key */ + u_int32_t flags; /* AES-specific flags */ +} AES_CIPHER;</pre> +It should be noted that none of these structures have their own mutex. +We hold the environment region locked while we are creating this, but once +this is set up, it is read-only forever. +<p>During <a href="../docs/api_c/env_set_encrypt.html">dbenv->set_encrypt</a>, +we set the encryption, decryption and checksumming methods to the appropriate +functions based on the flags. This function will allocate us a crypto +handle that we store in the <i>__dbenv</i> structure just like all the +other subsystems. For now, only AES ciphering functions and SHA1 +checksumming functions are supported. Also we will copy the password +into the <i>__dbenv</i> structure. We ultimately need to keep the +password in the environment's shared memory region or compare this one +against the one that is there, if we are joining an existing environment, +but we do not have it yet because open has not yet been called. We +will allocate a structure that will be used in initialization and set up +the function pointers to point to the algorithm-specific functions. +<p>In the <i>__dbenv_open</i> path, in <i>__db_e_attach</i>, if we +are creating the region and the <i>dbenv->passwd</i> field is set, we need +to use the length of the password in the initial computation of the environment's +size. This guarantees sufficient space for storing the password in +shared memory. Then we will call a new function to initialize the +security region, <i>__crypto_region_init</i> in <i>__dbenv_open</i>. +If we are the creator, we will allocate space in the shared region to store +the password and copy the password into that space. Or, if we are +not the creator we will compare the password stored in the dbenv with the +one in shared memory. Additionally, we will compare the ciphering +algorithm to the one stored in the shared region.We'll smash the dbenv +password and free it. If they do not match, we return an error. +If we are the creator we store the offset into the REGENV structure. +Then <i>__crypto_region_init </i> will call the initialization function +set up earlier based on the ciphering algorithm specified. For now +we will call <i>__aes_init</i>. Additionally this function will allocate +and set up the per-process state vector for this encryption's IVs. +See <a href="#Generating the Initialization Vector">Generating the Initialization +Vector</a> for a detailed description of the IV and state vector. +<p>In the AES-specific initialization function, <i>__aes_init</i>, +we will initialize it by calling +<i>__aes_derivekeys</i> in order to fill +in the keyInstance and mac_key fields in that structure. The REGENV +structure will have one additional item +<pre> roff_t passwd_off; /* Offset of passwd */</pre> + +<h4> +Initializing a Database</h4> +During <a href="../docs/api_c/db_set_encrypt.html">db->set_encrypt</a>, +we set the encryption, decryption and checksumming methods to the appropriate +functions based on the flags. Basically, we test that we are not +in an existing environment and we haven't called open. Then we just +call through the environment handle to set the password. +<p>Also, we will need to add a flag in the database meta-data page that +indicates that the database is encrypted and what its algorithm is. +This will be used when the meta-page is read after reopening a file. We +need this information on the meta-page in order to detect a user opening +a secure database without a password. I propose using the first unused1 +byte (renaming it too) in the meta page for this purpose. +<p>All pages will not be encrypted for the first 64 bytes of data. +Database meta-pages will be encrypted on the first 512 bytes only. +All meta-page types will have an IV and checksum added within the first +512 bytes as well as a crypto magic number. This will expand the +size of the meta-page from 256 bytes to 512 bytes. The page in/out routines, +<i>__db_pgin</i> and <i>__db_pgout</i> know the page type of the page and +will apply the 512 bytes ciphering to meta pages. In <i>__db_pgout</i>, +if we have a crypto handle in our (private) environment, we will apply +ciphering to either the entire page, or the first 512 bytes if it is a +meta-page. In <i>__db_pgin</i>, we will decrypt if the page we have +a crypto handle. +<p>When multiple processes share a database, all must use the same password +as the database creator. Using an existing database requires several conditions +to be true. First, if the creator of the database did not create +with security, then opening later with security is an error. Second, +if the creator did create it with security, then opening later without +security is an error. Third, we need to be able to test and check +that when another process opens a secure database that the password they +provided is the same as the one in use by the creator. +<p>When reading the meta-page, in <i>__db_file_setup</i>, we do not go +through the paging functions, but directly read via <i>__os_read</i>. +It is at this point that we will determine if the user is configured correctly. +If the meta-page we read has an IV and checksum, they better have a crypto +handle. If they have a crypto handle, then the meta-page must have +an IV and checksum. If both of those are true, we test the password. +We compare the unencrypted magic number to the newly-decrypted crypto magic +number and if they are not the same, then we report that the user gave +us a bad password. +<p>On a mostly unrelated topic, even when we go to very large pagesizes, +the meta information will still be within a disk sector. So, after +talking it over with Keith and Margo, we determined that unencrypted meta-pages +still will not need a checksum. +<h3> +Encryption and Checksum Routines</h3> +These routines are provided to us by Adam Stubblefield at Rice University +(astubble@rice.edu). The functional interfaces are: +<pre>__aes_derivekeys(DB_ENV *dbenv, /* dbenv */ + u_int8_t *passwd, /* Password */ + size_t passwd_len, /* Length of passwd */ + u_int8_t *mac_key, /* 20 byte array to store MAC key */ + keyInstance *encrypt_key, /* Encryption key of passwd */ + keyInstance *decrypt_key); /* Decryption key of passwd */</pre> +This is the only function requiring the textual user password. From +the password, this function generates a key used in the checksum function, +<i>__db_chksum</i>. +It also fills in <i>keyInstance</i> structures which are then used in the +encryption and decryption routines. The keyInstance structures must +already be allocated. These will be stored in the AES_CIPHER structure. +<pre> __db_chksum(u_int8_t *data, /* Data to checksum */ + size_t data_len, /* Length of data */ + u_int8_t *mac_key, /* 20 byte array from __db_derive_keys */ + u_int8_t *checksum); /* 20 byte array to store checksum */</pre> +This function generates a checksum on the data given. This function +will do double-duty for users that simply want error detection on their +pages. When users are using encryption, the <i>mac_key </i>will contain +the 20-byte key set up in <i>__aes_derivekeys</i>. If they just want +checksumming, then <i>mac_key</i> will be NULL. According to Adam, +we can safely use the first N-bytes of the checksum. So for seeding +the generator for initialization vectors, we'll hash the time and then +send in the first 4 bytes for the seed. I believe we can probably +do the same thing for checksumming log records. We can only use 4 +bytes for the checksum in the non-secure case. So when we want to +verify the log checksum we can compute the mac but just compare the first +4 bytes to the one we read. All locations where we generate or check +log record checksums that currently call <i>__ham_func4</i> will now call +<i>__db_chksum</i>. +I believe there are 5 such locations, +<i>__log_put, __log_putr, __log_newfile, +__log_rep_put +</i>and<i> __txn_force_abort.</i> +<pre>__aes_encrypt(DB_ENV *dbenv, /* dbenv */ + keyInstance *key, /* Password key instance from __db_derive_keys */ + u_int8_t *iv, /* Initialization vector */ + u_int8_t *data, /* Data to encrypt */ + size_t data_len); /* Length of data to encrypt - 16 byte multiple */</pre> +This is the function to encrypt data. It will be called to encrypt +pages and log records. The <i>key</i> instance is initialized in +<i>__aes_derivekeys</i>. +The initialization vector, <i>iv</i>, is the 16 byte random value set up +by the Mersenne Twister pseudo-random generator. Lastly, we pass +in a pointer to the <i>data</i> to encrypt and its length in <i>data_len</i>. +The <i>data_len</i> must be a multiple of 16 bytes. The encryption is done +in-place so that when the encryption code returns our encrypted data is +in the same location as the original data. +<pre>__aes_decrypt(DB_ENV *dbenv, /* dbenv */ + keyInstance *key, /* Password key instance from __db_derive_keys */ + u_int8_t *iv, /* Initialization vector */ + u_int8_t *data, /* Data to decrypt */ + size_t data_len); /* Length of data to decrypt - 16 byte multiple */</pre> +This is the function to decrypt the data. It is exactly the same +as the encryption function except for the action it performs. All +of the args and issues are the same. It also decrypts in place. +<h3> +<a NAME="Generating the Initialization Vector"></a>Generating the Initialization +Vector</h3> +Internally, we need to provide a unique initialization vector (IV) of 16 +bytes every time we encrypt any data with the same password. For +the IV we are planning on using mt19937, the Mersenne Twister, a random +number generator that has a period of 2**19937-1. This package can be found +at <a href="http://www.math.keio.ac.jp/~matumoto/emt.html">http://www.math.keio.ac.jp/~matumoto/emt.html</a>. +Tests show that although it repeats a single integer every once in a while, +that after several million iterations, it doesn't repeat any 4 integers +that we'd be stuffing into our 16-byte IV. We plan on seeding this +generator with the time (tv_sec) hashed through SHA1 when we create the +environment. This package uses a global state vector that contains +624 unsigned long integers. We do not allow a 16-byte IV of zero. +It is simpler just to reject any 4-byte value of 0 and if we get one, just +call the generator again and get a different number. We need to detect +holes in files and if we read an IV of zero that is a simple indication +that we need to check for an entire page of zero. The IVs are stored +on the page after encryption and are not encrypted themselves so it is +not possible for an entire encrypted page to be read as all zeroes, unless +it was a hole in a file. See <a href="#Holes in Files">Holes in Files</a> +for more details. +<p>We will not be holding any locks when we need to generate our IV but +we need to protect access to the state vector and the index. Calls +to the MT code will come while encrypting some data in <i>__aes_encrypt.</i> +The MT code will assume that all necessary locks are held in the caller. +We will have per-process state vectors that are set up when a process begins. +That way we minimize the contention and only multi-threaded processes need +acquire locks for the IV. We will have the state vector in the environment +handle in heap memory, as well as the index and there will be a mutex protecting +it for threaded access. This will be added to the <i>__dbenv</i> +structure: +<pre> DB_MUTEX *mt_mutexp; /* Mersenne Twister mutex */ + int *mti; /* MT index */ + u_long *mt; /* MT state vector */</pre> +This portion of the environment will be initialized at the end of _<i>_dbenv_open</i>, +right after we initialize the other mutex for the <i>dblist</i>. When we +allocate the space, we will generate our initial state vector. If we are +multi-threaded we'll allocate and initialize our mutex also. +<p>We need to make changes to the MT code to make it work in our namespace +and to take a pointer to the location of the state vector and +the index. There will be a wrapper function <i>__db_generate_iv</i> +that DB will call and it will call the appropriate MT function. I +am also going to change the default seed to use a hashed time instead of +a hard coded value. I have looked at other implementations of the +MT code available on the web site. The C++ version does a hash on +the current time. I will modify our MT code to seed with the hashed +time as well. That way the code to seed is contained within the MT +code and we can just write the wrapper to get an IV. We will not +be changing the core computational code of MT. +<h2> +DB Internal Issues</h2> + +<h4> +When do we Cipher?</h4> +All of the page ciphering is done in the <i>__db_pgin/__db_pgout</i> functions. +We will encrypt after the method-specific function on page-out and decrypt +before the method-specfic function on page-in. We do not hold any +locks when entering these functions. We determine that we need to +cipher based on the existence of the encryption flag in the dbp. +<p>For ciphering log records, the encryption will be done as the first +thing (or a new wrapper) in <i>__log_put. </i>See <a href="#Log Record Encryption">Log +Record Encryption</a> for those details. +<br> +<h4> +Page Changes</h4> +The checksum and IV values will be stored prior to the first index of the +page. We have a new P_INP macro that replaces use of inp[X] in the +code. This macro takes a dbp as an argument and determines where +our first index is based on whether we have DB_AM_CHKSUM and DB_AM_ENCRYPT +set. If neither is set, then our first index is where it always was. + If just checksumming is set, then we reserve a 4-byte checksum. +If encryption is set, then we reserve 36 bytes for our checksum/IV as well +as some space to get proper alignment to encrypt on a 16-byte boundary. +<p>Since several paging macros use inp[X] in them, those macros must now +take a dbp. There are a lot of changes to make all the necessary +paging macros take a dbp, although these changes are trivial in nature. +<p>Also, there is a new function <i>__db_chk_meta</i> to perform checksumming +and decryption checking on meta pages specifically. This function +is where we check that the database algorithm matches what the user gave +(or if they set DB_CIPHER_ANY then we set it), and other encryption related +testing for bad combinations of what is in the file versus what is in the +user structures. +<h4> +Verification</h4> +The verification code will also need to be updated to deal with secure +pages. Basically when the verification code reads in the meta page +it will call <i>__db_chk_meta</i> to perform any checksumming and decryption. +<h4> +<a NAME="Holes in Files"></a>Holes in Files</h4> +Holes in files will be dealt with rather simply. We need to be able +to distinguish reading a hole in a file from an encrypted page that happened +to encrypt to all zero's. If we read a hole in a file, we do not +want to send that empty page through the decryption routine. This +can be determined simply without incurring the performance penalty of comparing +every byte on a page on every read until we get a non-zero byte. +<br>The __db_pgin function is only given an invalid page P_INVALID in this +case. So, if the page type, which is always unencrypted, is +P_INVALID, then we do not perform any checksum verification or decryption. +<h4> +Errors and Recovery</h4> +Dealing with a checksum error is tricky. Ultimately, if a checksum +error occurs it is extremely likely that the user must do catastrophic +recovery. There is no other failure return other than DB_RUNRECOVERY +for indicating that the user should run catastrophic recovery. We +do not want to add a new error return for applications to check because +a lot of applications already look for and deal with DB_RUNRECOVERY as +an error condition and we want to fit ourselves into that application model. +We already indicate to the user that when they get that error, then they +need to run recovery. If recovery fails, then they need to run catastrophic +recovery. We need to get ourselves to the point where users will +run catastrophic recovery. +<p>If we get a checksum error, then we need to log a message stating a +checksum error occurred on page N. In <i>__db_pgin</i>, we can check +if logging is on in the environment. If so, we want to log the message. +<p>When the application gets the DB_RUNRECOVERY error, they'll have to +shut down their application and run recovery. When the recovery encounters +the record indicating checksum failure, then normal recovery will fail +and the user will have to perform catastrophic recovery. When catastrophic +recovery encounters that record, it will simply ignore it. +<h4> +<a NAME="Log Record Encryption"></a>Log Record Encryption</h4> +Log records will be ciphered. It might make sense to wrap <i>__log_put</i> +to encrypt the DBT we send down. The <i>__log_put </i>function is +where the checksum is computed before acquiring the region lock. +But also this function is where we call <i>__rep_send_message</i> to send +the DBT to the replication clients. Therefore, we need the DBT to +be encrypted prior to there. We also need it encrypted before checksumming. +I think <i>__log_put </i>will become <i>__log_put_internal</i>, and the +new <i>__log_put</i> will encrypt if needed and then call <i>__log_put_internal +</i>(the +function formerly known as <i>__log_put</i>). Log records are kept +in a shared memory region buffer prior to going out to disk. Records +in the buffer will be encrypted. No locks are held at the time we +will need to encrypt. +<p>On reading the log, via log cursors, the log code stores log records +in the log buffer. Records in that buffer will be encrypted, so decryption +will occur no matter whether we are returning records from the buffer or +if we are returning log records directly from the disk. Current checksum +checking is done in +<i>__log_get_c_int.</i> Decryption will be done +after the checksum is checked. +<p>There are currently two nasty issues with encrypted log records. +The first is that <i>__txn_force_abort</i> overwrites a commit record in +the log buffer with an abort record. Well, our log buffer will be +encrypted. Therefore, <i>__txn_force_abort</i> is going to need to +do encryption of its new record. This can be accomplished by sending +in the dbenv handle to the function. It is available to us in <i>__log_flush_commit</i> +and we can just pass it in. I don't like putting log encryption in +the txn code, but the layering violation is already there. +<p>The second issue is that the encryption code requires data that is a +multiple of 16 bytes and log record lengths are variable. We will +need to pad log records to meet the requirement. Since the callers +of <i>__log_put</i> set up the given DBT it is a logical place to pad if +necessary. We will modify the gen_rec.awk script to have all of the generated +logging functions pad for us if we have a crypto handle. This padding will +also expand the size of log files. Anyone calling <i>log_put</i> and using +security from the application will have to pad on their own or it will +return an error. +<p>When ciphering the log file, we will need a different header than the +current one. The current header only has space for a 4 byte checksum. +Our secure header will need space for the 16 byte IV and 20 byte checksum. +This will blow up our log files when running securely since every single +log record header will now consume 32 additional bytes. I believe +that the log header does not need to be encrypted. It contains an +offset, a length and our IV and checksum. Our IV and checksum are +never encrypted. I don't believe there to be any risk in having the +offset and length in the clear. +<p>I would prefer not to have two types of log headers that are incompatible +with each other. It is not acceptable to increase the log headers +of all users from 12 bytes to 44 bytes. Such a change would also +make log files incompatible with earlier releases. Worse even, is +that the <i>cksum</i> field of the header is in between the offset and +len. It would be really convenient if we could have just made a bigger +cksum portion without affecting the location of the other fields. +Oh well. Most customers will not be using encryption and we won't +make them pay the price of the expanded header. Keith indicates that +the log file format is changing with the next release so I will move the +cksum field so it can at least be overlaid. +<p>One method around this would be to have a single internal header that +contains all the information both mechanisms need, but when we write out +the header we choose which pieces to write. By appending the security +information to the end of the existing structure, and adding a size field, +we can modify a few places to use the size field to write out only the +current first 12 bytes, or the entire security header needed. +<h4> +Replication</h4> +Replication clients are going to need to start all of their individual +environment handles with the same password. The log records are going +to be sent to the clients decrypted and the clients will have to encrypt +them on their way to the client log files. We cannot send encrypted +log records to clients. The reason is that the checksum and IV are +stored in the log header and the master only sends the log record itself +to the client. Therefore, the client has no way to decrypt a log +record from the master. Therefore, anyone wanting to use truly secure +replication is going to have to have a secure transport mechanism. +By not encrypting records, clients can theoretically have different passwords +and DB won't care. +<p>On the master side we must copy the DBT sent in. We encrypt the +original and send to clients the clear record. On the client side, +support for encryption is added into <i>__log_rep_put</i>. +<h4> +Sharing the Environment</h4> +When multiple processes join the environment, all must use the same password +as the creator. +<p>Joining an existing environment requires several conditions to be true. +First, if the creator of the environment did not create with security, +then joining later with security is an error. Second, if the creator +did create it with security, then joining later without security is an +error. Third, we need to be able to test and check that when another +process joins a secure environment that the password they provided is the +same as the one in use by the creator. +<p>The first two scenarios should be fairly trivial to determine, if we +aren't creating the environment, we can compare what is there with what +we have. In the third case, the <i>__crypto_region_init</i> function +will see that the environment region has a valid passwd_off and we'll then +compare that password to the one we have in our dbenv handle. In +any case we'll smash the dbenv handle's passwd and free that memory before +returning whether we have a password match or not. +<p>We need to store the passwords themselves in the region because multiple +calls to the <i>__aes_derivekeys </i>function with the same password yields +different keyInstance contents. Therefore we don't have any way to +check passwords other than retaining and comparing the actual passwords. +<h4> +Other APIs</h4> +All of the other APIs will need interface enhancements to support the new +security methods. The Java and C++ interfaces will likely be done +by Michael Cahill and Sue will implement the Tcl and RPC changes. +Tcl will need the changes for testing purposes but the interface should +be public, not test-only. RPC should fully support security. +The biggest risk that I can see is that the client will send the password +to the server in the clear. Anyone sniffing the wires or running +tcpdump or other packet grabbing code could grab that. Someone really +interested in using security over RPC probably ought to add authentication +and other measures to the RPC server as well. +<h4> +<a NAME="Utilities"></a>Utilities</h4> +All should take a -P flag to specify a password for the environment or +password. Those that take an env and a database might need something +more to distinguish between env passwds and db passwds. Here is what we +do for each utility: +<ul> +<li> +berkeley_db_svc - Needs -P after each -h specified.</li> + +<li> +db_archive - Needs -P if the env is encrypted.</li> + +<li> +db_checkpoint - Needs -P if the env is encrypted.</li> + +<li> +db_deadlock - No changes</li> + +<li> +db_dump - Needs -P if the env or database is encrypted.</li> + +<li> +db_load - Needs -P if the env or database is encrypted.</li> + +<li> +db_printlog - Needs -P if the env is encrypted.</li> + +<li> +db_recover - Needs -P if the env is encrypted.</li> + +<li> +db_stat - Needs -P if the env or database is encrypted.</li> + +<li> +db_upgrade - Needs -P if the env or database is encrypted.</li> + +<li> +db_verify - Needs -P if the env or database is encrypted.</li> +</ul> + +<h2> +Testing</h2> +All testing should be able to be accomplished via Tcl. The following +tests (and probably others I haven't thought of yet) should be performed: +<ul> +<li> +Basic functionality - basically a test001 but encrypted without an env</li> + +<li> +Basic functionality, w/ env - like the previous test but with an env.</li> + +<li> +Basic functionality, multiple processes - like first test, but make sure +others can correctly join.</li> + +<li> +Basic functionality, mult. processes - like above test, but initialize/close +environment/database first so that the next test processes are all joiners +of an existing env, but creator no longer exists and the shared region +must be opened.</li> + +<li> +Recovery test - Run recovery over an encrypted environment.</li> + +<li> +Subdb test - Run with subdbs that are encrypted.</li> + +<li> +Utility test - Verify the new options to all the utilities.</li> + +<li> +Error handling - Test the basic setup errors for both env's and databases +with multiple processes. They are:</li> + +<ol> +<li> +Attempt to set a NULL or zero-length passwd.</li> + +<li> +Create Env w/ security and attempt to create database w/ its own password.</li> + +<li> +Env/DB creates with security. Proc2 joins without - should get an +error.</li> + +<li> +Env/DB creates without security. Proc2 joins with - should get an +error.</li> + +<li> +Env/DB creates with security. Proc2 joins with different password +- should get an error.</li> + +<li> +Env/DB creates with security. Closes. Proc2 reopens with different +password - should get an error.</li> + +<li> +Env/DB creates with security. Closes. Tcl overwrites a page +of the database with garbage. Proc2 reopens with the correct password. +Code should detect checksum error.</li> + +<li> +Env/DB creates with security. Open a 2nd identical DB with a different +password. Put the exact same data into both databases. Close. +Overwrite the identical page of DB1 with the one from DB2. Reopen +the database with correct DB1 password. Code should detect an encryption +error on that page.</li> +</ol> +</ul> + +<h2> +Risks</h2> +There are several holes in this design. It is important to document +them clearly. +<p>The first is that all of the pages are stored in memory and possibly +the file system in the clear. The password is stored in the shared +data regions in the clear. Therefore if an attacker can read the +process memory, they can do whatever they want. If the attacker can +read system memory or swap they can access the data as well. Since +everything in the shared data regions (with the exception of the buffered +log) will be in the clear, it is important to realize that file backed +regions will be written in the clear, including the portion of the regions +containing passwords. We recommend to users that they use system +memory instead of file backed shared memory. +</body> +</html> diff --git a/db/crypto/mersenne/mt19937db.c b/db/crypto/mersenne/mt19937db.c new file mode 100644 index 000000000..07af61dc3 --- /dev/null +++ b/db/crypto/mersenne/mt19937db.c @@ -0,0 +1,196 @@ +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: mt19937db.c,v 1.8 2002/03/27 04:31:10 bostic Exp "; +#endif /* not lint */ + +#include "db_int.h" +#include "dbinc/crypto.h" +#include "dbinc/hmac.h" +#include "dbinc/mutex.h" +#include "dbinc_auto/os_ext.h" + +/* A C-program for MT19937: Integer version (1999/10/28) */ +/* genrand() generates one pseudorandom unsigned integer (32bit) */ +/* which is uniformly distributed among 0 to 2^32-1 for each */ +/* call. sgenrand(seed) sets initial values to the working area */ +/* of 624 words. Before genrand(), sgenrand(seed) must be */ +/* called once. (seed is any 32-bit integer.) */ +/* Coded by Takuji Nishimura, considering the suggestions by */ +/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ + +/* This library is free software under the Artistic license: */ +/* see the file COPYING distributed together with this code. */ +/* For the verification of the code, its output sequence file */ +/* mt19937int.out is attached (2001/4/2) */ + +/* Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. */ +/* Any feedback is very welcome. For any question, comments, */ +/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */ +/* matumoto@math.keio.ac.jp */ + +/* REFERENCE */ +/* M. Matsumoto and T. Nishimura, */ +/* "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform */ +/* Pseudo-Random Number Generator", */ +/* ACM Transactions on Modeling and Computer Simulation, */ +/* Vol. 8, No. 1, January 1998, pp 3--30. */ + +/* Period parameters */ +#define N 624 +#define M 397 +#define MATRIX_A 0x9908b0df /* constant vector a */ +#define UPPER_MASK 0x80000000 /* most significant w-r bits */ +#define LOWER_MASK 0x7fffffff /* least significant r bits */ + +/* Tempering parameters */ +#define TEMPERING_MASK_B 0x9d2c5680 +#define TEMPERING_MASK_C 0xefc60000 +#define TEMPERING_SHIFT_U(y) (y >> 11) +#define TEMPERING_SHIFT_S(y) (y << 7) +#define TEMPERING_SHIFT_T(y) (y << 15) +#define TEMPERING_SHIFT_L(y) (y >> 18) + +static void __db_sgenrand __P((unsigned long, unsigned long *, int *)); +#ifdef NOT_USED +static void __db_lsgenrand __P((unsigned long *, unsigned long *, int *)); +#endif +static unsigned long __db_genrand __P((DB_ENV *)); + +/* + * __db_generate_iv -- + * Generate an initialization vector (IV) + * + * PUBLIC: int __db_generate_iv __P((DB_ENV *, u_int32_t *)); + */ +int +__db_generate_iv(dbenv, iv) + DB_ENV *dbenv; + u_int32_t *iv; +{ + int i, n, ret; + + ret = 0; + n = DB_IV_BYTES / sizeof(u_int32_t); + MUTEX_THREAD_LOCK(dbenv, dbenv->mt_mutexp); + if (dbenv->mt == NULL) { + if ((ret = __os_calloc(dbenv, 1, N*sizeof(unsigned long), + &dbenv->mt)) != 0) + return (ret); + /* mti==N+1 means mt[N] is not initialized */ + dbenv->mti = N + 1; + } + for (i = 0; i < n; i++) +{ + /* + * We do not allow 0. If we get one just try again. + */ + do { + iv[i] = (u_int32_t)__db_genrand(dbenv); + } while (iv[i] == 0); +} + + MUTEX_THREAD_UNLOCK(dbenv, dbenv->mt_mutexp); + return (0); +} + +/* Initializing the array with a seed */ +static void +__db_sgenrand(seed, mt, mtip) + unsigned long seed; + unsigned long mt[]; + int *mtip; +{ + int i; + + DB_ASSERT(seed != 0); + for (i=0;i<N;i++) { + mt[i] = seed & 0xffff0000; + seed = 69069 * seed + 1; + mt[i] |= (seed & 0xffff0000) >> 16; + seed = 69069 * seed + 1; + } + *mtip = N; +} + +#ifdef NOT_USED +/* Initialization by "sgenrand()" is an example. Theoretically, */ +/* there are 2^19937-1 possible states as an intial state. */ +/* This function allows to choose any of 2^19937-1 ones. */ +/* Essential bits in "seed_array[]" is following 19937 bits: */ +/* (seed_array[0]&UPPER_MASK), seed_array[1], ..., seed_array[N-1]. */ +/* (seed_array[0]&LOWER_MASK) is discarded. */ +/* Theoretically, */ +/* (seed_array[0]&UPPER_MASK), seed_array[1], ..., seed_array[N-1] */ +/* can take any values except all zeros. */ +static void +__db_lsgenrand(seed_array, mt, mtip) + unsigned long seed_array[]; + unsigned long mt[]; + int *mtip; + /* the length of seed_array[] must be at least N */ +{ + int i; + + for (i=0;i<N;i++) + mt[i] = seed_array[i]; + *mtip=N; +} +#endif + +static unsigned long +__db_genrand(dbenv) + DB_ENV *dbenv; +{ + unsigned long i, s, y; + static unsigned long mag01[2]={0x0, MATRIX_A}; + /* mag01[x] = x * MATRIX_A for x=0,1 */ + u_int32_t secs, usecs; + u_int8_t mac[DB_MAC_KEY]; + + /* + * We are called with the mt_mutexp locked + */ + if (dbenv->mti >= N) { /* generate N words at one time */ + int kk; + + if (dbenv->mti == N+1) { /* if sgenrand() has not been called, */ + /* + * Seed the generator with the hashed time. The __db_mac + * function returns a 20 byte value, but we can safely + * just use the first 4 bytes for the seed. + */ + do { + if (__os_clock(dbenv, &secs, &usecs) != 0) + return (0); /* 0 is the only invalid return */ + __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL, mac); + s = 0; + for (i = 0; i < DB_MAC_KEY && s == 0; + i += sizeof(unsigned long)) + s = mac[i]; + } while (s == 0); + __db_sgenrand(s, dbenv->mt, &dbenv->mti); + } + + for (kk=0;kk<N-M;kk++) { + y = (dbenv->mt[kk]&UPPER_MASK)|(dbenv->mt[kk+1]&LOWER_MASK); + dbenv->mt[kk] = dbenv->mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1]; + } + for (;kk<N-1;kk++) { + y = (dbenv->mt[kk]&UPPER_MASK)|(dbenv->mt[kk+1]&LOWER_MASK); + dbenv->mt[kk] = dbenv->mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1]; + } + y = (dbenv->mt[N-1]&UPPER_MASK)|(dbenv->mt[0]&LOWER_MASK); + dbenv->mt[N-1] = dbenv->mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1]; + + dbenv->mti = 0; + } + + y = dbenv->mt[dbenv->mti++]; + y ^= TEMPERING_SHIFT_U(y); + y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; + y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; + y ^= TEMPERING_SHIFT_L(y); + + return y; +} diff --git a/db/crypto/rijndael/rijndael-alg-fst.c b/db/crypto/rijndael/rijndael-alg-fst.c new file mode 100644 index 000000000..89bf4621f --- /dev/null +++ b/db/crypto/rijndael/rijndael-alg-fst.c @@ -0,0 +1,1466 @@ +/** + * rijndael-alg-fst.c + * + * @version 3.0 (December 2000) + * + * Optimised ANSI C code for the Rijndael cipher (now AES) + * + * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> + * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> + * @author Paulo Barreto <paulo.barreto@terra.com.br> + * + * This code is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "db_config.h" + +#include "db_int.h" +#include "dbinc/crypto.h" + +#include "crypto/rijndael/rijndael-alg-fst.h" + +/* +Te0[x] = S [x].[02, 01, 01, 03]; +Te1[x] = S [x].[03, 02, 01, 01]; +Te2[x] = S [x].[01, 03, 02, 01]; +Te3[x] = S [x].[01, 01, 03, 02]; +Te4[x] = S [x].[01, 01, 01, 01]; + +Td0[x] = Si[x].[0e, 09, 0d, 0b]; +Td1[x] = Si[x].[0b, 0e, 09, 0d]; +Td2[x] = Si[x].[0d, 0b, 0e, 09]; +Td3[x] = Si[x].[09, 0d, 0b, 0e]; +Td4[x] = Si[x].[01, 01, 01, 01]; +*/ + +static const u32 Te0[256] = { + 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, + 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, + 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, + 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, + 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, + 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, + 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, + 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, + 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, + 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, + 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, + 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, + 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, + 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, + 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, + 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, + 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, + 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, + 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, + 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, + 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, + 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, + 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, + 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, + 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, + 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, + 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, + 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, + 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, + 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, + 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, + 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, + 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, + 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, + 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, + 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, + 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, + 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, + 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, + 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, + 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, + 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, + 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, + 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, + 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, + 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, + 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, + 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, + 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, + 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, + 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, + 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, + 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, + 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, + 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, + 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, + 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, + 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, + 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, + 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, + 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, + 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, + 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, + 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, +}; +static const u32 Te1[256] = { + 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, + 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, + 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, + 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, + 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, + 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, + 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, + 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, + 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, + 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, + 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, + 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, + 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, + 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, + 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, + 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, + 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, + 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, + 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, + 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, + 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, + 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, + 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, + 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, + 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, + 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, + 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, + 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, + 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, + 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, + 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, + 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, + 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, + 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, + 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, + 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, + 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, + 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, + 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, + 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, + 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, + 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, + 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, + 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, + 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, + 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, + 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, + 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, + 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, + 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, + 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, + 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, + 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, + 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, + 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, + 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, + 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, + 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, + 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, + 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, + 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, + 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, + 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, + 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, +}; +static const u32 Te2[256] = { + 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, + 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, + 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, + 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, + 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, + 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, + 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, + 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, + 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, + 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, + 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, + 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, + 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, + 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, + 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, + 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, + 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, + 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, + 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, + 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, + 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, + 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, + 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, + 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, + 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, + 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, + 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, + 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, + 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, + 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, + 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, + 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, + 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, + 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, + 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, + 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, + 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, + 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, + 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, + 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, + 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, + 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, + 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, + 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, + 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, + 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, + 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, + 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, + 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, + 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, + 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, + 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, + 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, + 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, + 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, + 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, + 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, + 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, + 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, + 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, + 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, + 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, + 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, + 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, +}; +static const u32 Te3[256] = { + + 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, + 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, + 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, + 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, + 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, + 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, + 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, + 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, + 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, + 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, + 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, + 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, + 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, + 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, + 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, + 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, + 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, + 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, + 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, + 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, + 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, + 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, + 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, + 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, + 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, + 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, + 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, + 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, + 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, + 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, + 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, + 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, + 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, + 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, + 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, + 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, + 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, + 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, + 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, + 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, + 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, + 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, + 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, + 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, + 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, + 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, + 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, + 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, + 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, + 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, + 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, + 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, + 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, + 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, + 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, + 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, + 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, + 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, + 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, + 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, + 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, + 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, + 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, + 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, +}; +static const u32 Te4[256] = { + 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, + 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, + 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, + 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, + 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, + 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, + 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, + 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, + 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, + 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, + 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, + 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, + 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, + 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, + 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, + 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, + 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, + 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, + 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, + 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, + 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, + 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, + 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, + 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, + 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, + 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, + 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, + 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, + 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, + 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, + 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, + 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, + 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, + 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, + 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, + 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, + 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, + 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, + 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, + 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, + 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, + 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, + 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, + 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, + 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, + 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, + 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, + 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, + 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, + 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, + 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, + 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, + 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, + 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, + 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, + 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, + 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, + 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, + 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, + 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, + 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, + 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, + 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, + 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, +}; +static const u32 Td0[256] = { + 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, + 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, + 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, + 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, + 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, + 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, + 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, + 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, + 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, + 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, + 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, + 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, + 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, + 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, + 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, + 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, + 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, + 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, + 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, + 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, + 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, + 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, + 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, + 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, + 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, + 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, + 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, + 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, + 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, + 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, + 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, + 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, + 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, + 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, + 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, + 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, + 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, + 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, + 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, + 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, + 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, + 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, + 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, + 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, + 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, + 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, + 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, + 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, + 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, + 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, + 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, + 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, + 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, + 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, + 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, + 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, + 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, + 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, + 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, + 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, + 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, + 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, + 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, + 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, +}; +static const u32 Td1[256] = { + 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, + 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, + 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, + 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, + 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, + 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, + 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, + 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, + 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, + 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, + 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, + 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, + 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, + 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, + 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, + 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, + 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, + 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, + 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, + 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, + 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, + 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, + 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, + 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, + 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, + 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, + 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, + 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, + 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, + 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, + 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, + 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, + 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, + 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, + 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, + 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, + 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, + 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, + 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, + 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, + 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, + 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, + 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, + 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, + 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, + 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, + 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, + 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, + 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, + 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, + 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, + 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, + 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, + 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, + 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, + 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, + 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, + 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, + 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, + 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, + 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, + 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, + 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, + 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, +}; +static const u32 Td2[256] = { + 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, + 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, + 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, + 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, + 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, + 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, + 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, + 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, + 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, + 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, + 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, + 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, + 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, + 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, + 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, + 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, + 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, + 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, + 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, + 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, + + 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, + 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, + 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, + 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, + 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, + 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, + 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, + 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, + 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, + 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, + 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, + 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, + 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, + 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, + 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, + 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, + 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, + 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, + 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, + 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, + 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, + 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, + 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, + 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, + 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, + 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, + 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, + 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, + 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, + 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, + 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, + 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, + 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, + 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, + 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, + 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, + 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, + 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, + 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, + 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, + 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, + 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, + 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, + 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, +}; +static const u32 Td3[256] = { + 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, + 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, + 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, + 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, + 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, + 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, + 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, + 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, + 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, + 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, + 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, + 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, + 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, + 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, + 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, + 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, + 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, + 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, + 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, + 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, + 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, + 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, + 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, + 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, + 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, + 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, + 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, + 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, + 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, + 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, + 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, + 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, + 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, + 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, + 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, + 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, + 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, + 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, + 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, + 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, + 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, + 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, + 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, + 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, + 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, + 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, + 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, + 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, + 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, + 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, + 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, + 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, + 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, + 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, + 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, + 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, + 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, + 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, + 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, + 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, + 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, + 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, + 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, + 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, +}; +static const u32 Td4[256] = { + 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, + 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, + 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, + 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, + 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, + 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, + 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, + 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, + 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, + 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, + 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, + 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, + 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, + 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, + 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, + 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, + 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, + 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, + 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, + 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, + 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, + 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, + 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, + 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, + 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, + 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, + 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, + 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, + 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, + 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, + 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, + 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, + 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, + 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, + 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, + 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, + 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, + 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, + 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, + 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, + 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, + 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, + 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, + 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, + 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, + 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, + 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, + 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, + 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, + 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, + 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, + 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, + 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, + 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, + 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, + 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, + 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, + 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, + 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, + 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, + 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, + 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, + 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, + 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, +}; +static const u32 rcon[] = { + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000, + 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ +}; + +#define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) + +#ifdef _MSC_VER +#define GETU32(p) SWAP(*((u32 *)(p))) +#define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } +#else +#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) +#define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } +#endif + +/** + * Expand the cipher key into the encryption key schedule. + * + * @return the number of rounds for the given cipher key size. + */ +/* + * __db_rijndaelKeySetupEnc -- + * + * PUBLIC: int __db_rijndaelKeySetupEnc __P((u32 *, const u8 *, int)); + */ +int +__db_rijndaelKeySetupEnc(rk, cipherKey, keyBits) + u32 *rk; /* rk[4*(Nr + 1)] */ + const u8 *cipherKey; + int keyBits; +{ + int i = 0; + u32 temp; + + rk[0] = GETU32(cipherKey ); + rk[1] = GETU32(cipherKey + 4); + rk[2] = GETU32(cipherKey + 8); + rk[3] = GETU32(cipherKey + 12); + if (keyBits == 128) { + for (;;) { + temp = rk[3]; + rk[4] = rk[0] ^ + (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ + (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ + (Te4[(temp ) & 0xff] & 0x0000ff00) ^ + (Te4[(temp >> 24) ] & 0x000000ff) ^ + rcon[i]; + rk[5] = rk[1] ^ rk[4]; + rk[6] = rk[2] ^ rk[5]; + rk[7] = rk[3] ^ rk[6]; + if (++i == 10) { + return 10; + } + rk += 4; + } + } + rk[4] = GETU32(cipherKey + 16); + rk[5] = GETU32(cipherKey + 20); + if (keyBits == 192) { + for (;;) { + temp = rk[ 5]; + rk[ 6] = rk[ 0] ^ + (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ + (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ + (Te4[(temp ) & 0xff] & 0x0000ff00) ^ + (Te4[(temp >> 24) ] & 0x000000ff) ^ + rcon[i]; + rk[ 7] = rk[ 1] ^ rk[ 6]; + rk[ 8] = rk[ 2] ^ rk[ 7]; + rk[ 9] = rk[ 3] ^ rk[ 8]; + if (++i == 8) { + return 12; + } + rk[10] = rk[ 4] ^ rk[ 9]; + rk[11] = rk[ 5] ^ rk[10]; + rk += 6; + } + } + rk[6] = GETU32(cipherKey + 24); + rk[7] = GETU32(cipherKey + 28); + if (keyBits == 256) { + for (;;) { + temp = rk[ 7]; + rk[ 8] = rk[ 0] ^ + (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ + (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ + (Te4[(temp ) & 0xff] & 0x0000ff00) ^ + (Te4[(temp >> 24) ] & 0x000000ff) ^ + rcon[i]; + rk[ 9] = rk[ 1] ^ rk[ 8]; + rk[10] = rk[ 2] ^ rk[ 9]; + rk[11] = rk[ 3] ^ rk[10]; + if (++i == 7) { + return 14; + } + temp = rk[11]; + rk[12] = rk[ 4] ^ + (Te4[(temp >> 24) ] & 0xff000000) ^ + (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(temp ) & 0xff] & 0x000000ff); + rk[13] = rk[ 5] ^ rk[12]; + rk[14] = rk[ 6] ^ rk[13]; + rk[15] = rk[ 7] ^ rk[14]; + + rk += 8; + } + } + return 0; +} + +/** + * Expand the cipher key into the decryption key schedule. + * + * @return the number of rounds for the given cipher key size. + */ +/* + * __db_rijndaelKeySetupDec -- + * + * PUBLIC: int __db_rijndaelKeySetupDec __P((u32 *, const u8 *, int)); + */ +int +__db_rijndaelKeySetupDec(rk, cipherKey, keyBits) + u32 *rk; /* rk[4*(Nr + 1)] */ + const u8 *cipherKey; + int keyBits; +{ + int Nr, i, j; + u32 temp; + + /* expand the cipher key: */ + Nr = __db_rijndaelKeySetupEnc(rk, cipherKey, keyBits); + /* invert the order of the round keys: */ + for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { + temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; + temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; + temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; + temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; + } + /* apply the inverse MixColumn transform to all round keys but the first and the last: */ + for (i = 1; i < Nr; i++) { + rk += 4; + rk[0] = + Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[0] ) & 0xff] & 0xff]; + rk[1] = + Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[1] ) & 0xff] & 0xff]; + rk[2] = + Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[2] ) & 0xff] & 0xff]; + rk[3] = + Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[3] ) & 0xff] & 0xff]; + } + return Nr; +} + +/* + * __db_rijndaelEncrypt -- + * + * PUBLIC: void __db_rijndaelEncrypt __P((u32 *, int, const u8 *, u8 *)); + */ +void +__db_rijndaelEncrypt(rk, Nr, pt, ct) + u32 *rk; /* rk[4*(Nr + 1)] */ + int Nr; + const u8 *pt; + u8 *ct; +{ + u32 s0, s1, s2, s3, t0, t1, t2, t3; +#ifndef FULL_UNROLL + int r; +#endif /* ?FULL_UNROLL */ + + /* + * map byte array block to cipher state + * and add initial round key: + */ + s0 = GETU32(pt ) ^ rk[0]; + s1 = GETU32(pt + 4) ^ rk[1]; + s2 = GETU32(pt + 8) ^ rk[2]; + s3 = GETU32(pt + 12) ^ rk[3]; +#ifdef FULL_UNROLL + /* round 1: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7]; + /* round 2: */ + s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8]; + s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9]; + s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10]; + s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11]; + /* round 3: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15]; + /* round 4: */ + s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16]; + s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17]; + s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18]; + s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19]; + /* round 5: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23]; + /* round 6: */ + s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24]; + s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25]; + s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26]; + s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27]; + /* round 7: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31]; + /* round 8: */ + s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32]; + s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33]; + s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34]; + s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35]; + /* round 9: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39]; + if (Nr > 10) { + /* round 10: */ + s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40]; + s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41]; + s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42]; + s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43]; + /* round 11: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47]; + if (Nr > 12) { + /* round 12: */ + s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48]; + s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49]; + s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50]; + s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51]; + /* round 13: */ + t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52]; + t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53]; + t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54]; + t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55]; + } + } + rk += Nr << 2; +#else /* !FULL_UNROLL */ + /* + * Nr - 1 full rounds: + */ + r = Nr >> 1; + for (;;) { + t0 = + Te0[(s0 >> 24) ] ^ + Te1[(s1 >> 16) & 0xff] ^ + Te2[(s2 >> 8) & 0xff] ^ + Te3[(s3 ) & 0xff] ^ + rk[4]; + t1 = + Te0[(s1 >> 24) ] ^ + Te1[(s2 >> 16) & 0xff] ^ + Te2[(s3 >> 8) & 0xff] ^ + Te3[(s0 ) & 0xff] ^ + rk[5]; + t2 = + Te0[(s2 >> 24) ] ^ + Te1[(s3 >> 16) & 0xff] ^ + Te2[(s0 >> 8) & 0xff] ^ + Te3[(s1 ) & 0xff] ^ + rk[6]; + t3 = + Te0[(s3 >> 24) ] ^ + Te1[(s0 >> 16) & 0xff] ^ + Te2[(s1 >> 8) & 0xff] ^ + Te3[(s2 ) & 0xff] ^ + rk[7]; + + rk += 8; + if (--r == 0) { + break; + } + + s0 = + Te0[(t0 >> 24) ] ^ + Te1[(t1 >> 16) & 0xff] ^ + Te2[(t2 >> 8) & 0xff] ^ + Te3[(t3 ) & 0xff] ^ + rk[0]; + s1 = + Te0[(t1 >> 24) ] ^ + Te1[(t2 >> 16) & 0xff] ^ + Te2[(t3 >> 8) & 0xff] ^ + Te3[(t0 ) & 0xff] ^ + rk[1]; + s2 = + Te0[(t2 >> 24) ] ^ + Te1[(t3 >> 16) & 0xff] ^ + Te2[(t0 >> 8) & 0xff] ^ + Te3[(t1 ) & 0xff] ^ + rk[2]; + s3 = + Te0[(t3 >> 24) ] ^ + Te1[(t0 >> 16) & 0xff] ^ + Te2[(t1 >> 8) & 0xff] ^ + Te3[(t2 ) & 0xff] ^ + rk[3]; + } +#endif /* ?FULL_UNROLL */ + /* + * apply last round and + * map cipher state to byte array block: + */ + s0 = + (Te4[(t0 >> 24) ] & 0xff000000) ^ + (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t3 ) & 0xff] & 0x000000ff) ^ + rk[0]; + PUTU32(ct , s0); + s1 = + (Te4[(t1 >> 24) ] & 0xff000000) ^ + (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t0 ) & 0xff] & 0x000000ff) ^ + rk[1]; + PUTU32(ct + 4, s1); + s2 = + (Te4[(t2 >> 24) ] & 0xff000000) ^ + (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t1 ) & 0xff] & 0x000000ff) ^ + rk[2]; + PUTU32(ct + 8, s2); + s3 = + (Te4[(t3 >> 24) ] & 0xff000000) ^ + (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t2 ) & 0xff] & 0x000000ff) ^ + rk[3]; + PUTU32(ct + 12, s3); +} + +/* + * __db_rijndaelDecrypt -- + * + * PUBLIC: void __db_rijndaelDecrypt __P((u32 *, int, const u8 *, u8 *)); + */ +void +__db_rijndaelDecrypt(rk, Nr, ct, pt) + u32 *rk; /* rk[4*(Nr + 1)] */ + int Nr; + const u8 *ct; + u8 *pt; +{ + u32 s0, s1, s2, s3, t0, t1, t2, t3; +#ifndef FULL_UNROLL + int r; +#endif /* ?FULL_UNROLL */ + + /* + * map byte array block to cipher state + * and add initial round key: + */ + s0 = GETU32(ct ) ^ rk[0]; + s1 = GETU32(ct + 4) ^ rk[1]; + s2 = GETU32(ct + 8) ^ rk[2]; + s3 = GETU32(ct + 12) ^ rk[3]; +#ifdef FULL_UNROLL + /* round 1: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7]; + /* round 2: */ + s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8]; + s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9]; + s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10]; + s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11]; + /* round 3: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15]; + /* round 4: */ + s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16]; + s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17]; + s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18]; + s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19]; + /* round 5: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23]; + /* round 6: */ + s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24]; + s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25]; + s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26]; + s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27]; + /* round 7: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31]; + /* round 8: */ + s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32]; + s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33]; + s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34]; + s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35]; + /* round 9: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39]; + if (Nr > 10) { + /* round 10: */ + s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40]; + s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41]; + s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42]; + s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43]; + /* round 11: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47]; + if (Nr > 12) { + /* round 12: */ + s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48]; + s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49]; + s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50]; + s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51]; + /* round 13: */ + t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52]; + t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53]; + t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54]; + t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55]; + } + } + rk += Nr << 2; +#else /* !FULL_UNROLL */ + /* + * Nr - 1 full rounds: + */ + r = Nr >> 1; + for (;;) { + t0 = + Td0[(s0 >> 24) ] ^ + Td1[(s3 >> 16) & 0xff] ^ + Td2[(s2 >> 8) & 0xff] ^ + Td3[(s1 ) & 0xff] ^ + rk[4]; + t1 = + Td0[(s1 >> 24) ] ^ + Td1[(s0 >> 16) & 0xff] ^ + Td2[(s3 >> 8) & 0xff] ^ + Td3[(s2 ) & 0xff] ^ + rk[5]; + t2 = + Td0[(s2 >> 24) ] ^ + Td1[(s1 >> 16) & 0xff] ^ + Td2[(s0 >> 8) & 0xff] ^ + Td3[(s3 ) & 0xff] ^ + rk[6]; + t3 = + Td0[(s3 >> 24) ] ^ + Td1[(s2 >> 16) & 0xff] ^ + Td2[(s1 >> 8) & 0xff] ^ + Td3[(s0 ) & 0xff] ^ + rk[7]; + + rk += 8; + if (--r == 0) { + break; + } + + s0 = + Td0[(t0 >> 24) ] ^ + Td1[(t3 >> 16) & 0xff] ^ + Td2[(t2 >> 8) & 0xff] ^ + Td3[(t1 ) & 0xff] ^ + rk[0]; + s1 = + Td0[(t1 >> 24) ] ^ + Td1[(t0 >> 16) & 0xff] ^ + Td2[(t3 >> 8) & 0xff] ^ + Td3[(t2 ) & 0xff] ^ + rk[1]; + s2 = + Td0[(t2 >> 24) ] ^ + Td1[(t1 >> 16) & 0xff] ^ + Td2[(t0 >> 8) & 0xff] ^ + Td3[(t3 ) & 0xff] ^ + rk[2]; + s3 = + Td0[(t3 >> 24) ] ^ + Td1[(t2 >> 16) & 0xff] ^ + Td2[(t1 >> 8) & 0xff] ^ + Td3[(t0 ) & 0xff] ^ + rk[3]; + } +#endif /* ?FULL_UNROLL */ + /* + * apply last round and + * map cipher state to byte array block: + */ + s0 = + (Td4[(t0 >> 24) ] & 0xff000000) ^ + (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t1 ) & 0xff] & 0x000000ff) ^ + rk[0]; + PUTU32(pt , s0); + s1 = + (Td4[(t1 >> 24) ] & 0xff000000) ^ + (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t2 ) & 0xff] & 0x000000ff) ^ + rk[1]; + PUTU32(pt + 4, s1); + s2 = + (Td4[(t2 >> 24) ] & 0xff000000) ^ + (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t3 ) & 0xff] & 0x000000ff) ^ + rk[2]; + PUTU32(pt + 8, s2); + s3 = + (Td4[(t3 >> 24) ] & 0xff000000) ^ + (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t0 ) & 0xff] & 0x000000ff) ^ + rk[3]; + PUTU32(pt + 12, s3); +} + +#ifdef INTERMEDIATE_VALUE_KAT + +/* + * __db_rijndaelEncryptRound -- + * + * PUBLIC: void __db_rijndaelEncryptRound __P((const u32 *, int, u8 *, int)); + */ +void +__db_rijndaelEncryptRound(rk, Nr, pt, ct) + const u32 *rk; /* rk[4*(Nr + 1)] */ + int Nr; + u8 *block; + int rounds; +{ + int r; + u32 s0, s1, s2, s3, t0, t1, t2, t3; + + /* + * map byte array block to cipher state + * and add initial round key: + */ + s0 = GETU32(block ) ^ rk[0]; + s1 = GETU32(block + 4) ^ rk[1]; + s2 = GETU32(block + 8) ^ rk[2]; + s3 = GETU32(block + 12) ^ rk[3]; + rk += 4; + + /* + * Nr - 1 full rounds: + */ + for (r = (rounds < Nr ? rounds : Nr - 1); r > 0; r--) { + t0 = + Te0[(s0 >> 24) ] ^ + Te1[(s1 >> 16) & 0xff] ^ + Te2[(s2 >> 8) & 0xff] ^ + Te3[(s3 ) & 0xff] ^ + rk[0]; + t1 = + Te0[(s1 >> 24) ] ^ + Te1[(s2 >> 16) & 0xff] ^ + Te2[(s3 >> 8) & 0xff] ^ + Te3[(s0 ) & 0xff] ^ + rk[1]; + t2 = + Te0[(s2 >> 24) ] ^ + Te1[(s3 >> 16) & 0xff] ^ + Te2[(s0 >> 8) & 0xff] ^ + Te3[(s1 ) & 0xff] ^ + rk[2]; + t3 = + Te0[(s3 >> 24) ] ^ + Te1[(s0 >> 16) & 0xff] ^ + Te2[(s1 >> 8) & 0xff] ^ + Te3[(s2 ) & 0xff] ^ + rk[3]; + + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + rk += 4; + + } + + /* + * apply last round and + * map cipher state to byte array block: + */ + if (rounds == Nr) { + t0 = + (Te4[(s0 >> 24) ] & 0xff000000) ^ + (Te4[(s1 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(s2 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(s3 ) & 0xff] & 0x000000ff) ^ + rk[0]; + t1 = + (Te4[(s1 >> 24) ] & 0xff000000) ^ + (Te4[(s2 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(s3 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(s0 ) & 0xff] & 0x000000ff) ^ + rk[1]; + t2 = + (Te4[(s2 >> 24) ] & 0xff000000) ^ + (Te4[(s3 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(s0 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(s1 ) & 0xff] & 0x000000ff) ^ + rk[2]; + t3 = + (Te4[(s3 >> 24) ] & 0xff000000) ^ + (Te4[(s0 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(s1 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(s2 ) & 0xff] & 0x000000ff) ^ + rk[3]; + + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + + PUTU32(block , s0); + PUTU32(block + 4, s1); + PUTU32(block + 8, s2); + PUTU32(block + 12, s3); +} + +/* + * __db_rijndaelDecryptRound -- + * + * PUBLIC: void __db_rijndaelDecryptRound __P((const u32 *, int, u8 *, int)); + */ +void +__db_rijndaelDecryptRound(rk, Nr, pt, ct) + const u32 *rk; /* rk[4*(Nr + 1)] */ + int Nr; + u8 *block; + int rounds; +{ + int r; + u32 s0, s1, s2, s3, t0, t1, t2, t3; + + /* + * map byte array block to cipher state + * and add initial round key: + */ + s0 = GETU32(block ) ^ rk[0]; + s1 = GETU32(block + 4) ^ rk[1]; + s2 = GETU32(block + 8) ^ rk[2]; + s3 = GETU32(block + 12) ^ rk[3]; + rk += 4; + + /* + * Nr - 1 full rounds: + */ + for (r = (rounds < Nr ? rounds : Nr) - 1; r > 0; r--) { + t0 = + Td0[(s0 >> 24) ] ^ + Td1[(s3 >> 16) & 0xff] ^ + Td2[(s2 >> 8) & 0xff] ^ + Td3[(s1 ) & 0xff] ^ + rk[0]; + t1 = + Td0[(s1 >> 24) ] ^ + Td1[(s0 >> 16) & 0xff] ^ + Td2[(s3 >> 8) & 0xff] ^ + Td3[(s2 ) & 0xff] ^ + rk[1]; + t2 = + Td0[(s2 >> 24) ] ^ + Td1[(s1 >> 16) & 0xff] ^ + Td2[(s0 >> 8) & 0xff] ^ + Td3[(s3 ) & 0xff] ^ + rk[2]; + t3 = + Td0[(s3 >> 24) ] ^ + Td1[(s2 >> 16) & 0xff] ^ + Td2[(s1 >> 8) & 0xff] ^ + Td3[(s0 ) & 0xff] ^ + rk[3]; + + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + rk += 4; + + } + + /* + * complete the last round and + * map cipher state to byte array block: + */ + t0 = + (Td4[(s0 >> 24) ] & 0xff000000) ^ + (Td4[(s3 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(s2 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(s1 ) & 0xff] & 0x000000ff); + t1 = + (Td4[(s1 >> 24) ] & 0xff000000) ^ + (Td4[(s0 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(s3 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(s2 ) & 0xff] & 0x000000ff); + t2 = + (Td4[(s2 >> 24) ] & 0xff000000) ^ + (Td4[(s1 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(s0 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(s3 ) & 0xff] & 0x000000ff); + t3 = + (Td4[(s3 >> 24) ] & 0xff000000) ^ + (Td4[(s2 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(s1 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(s0 ) & 0xff] & 0x000000ff); + + if (rounds == Nr) { + t0 ^= rk[0]; + t1 ^= rk[1]; + t2 ^= rk[2]; + t3 ^= rk[3]; + } + + PUTU32(block , t0); + PUTU32(block + 4, t1); + PUTU32(block + 8, t2); + PUTU32(block + 12, t3); +} + +#endif /* INTERMEDIATE_VALUE_KAT */ diff --git a/db/crypto/rijndael/rijndael-alg-fst.h b/db/crypto/rijndael/rijndael-alg-fst.h new file mode 100644 index 000000000..81751ed5c --- /dev/null +++ b/db/crypto/rijndael/rijndael-alg-fst.h @@ -0,0 +1,40 @@ +/* + * Id: rijndael-alg-fst.h,v 1.2 2002/01/08 18:53:37 sue Exp + */ +/** + * rijndael-alg-fst.h + * + * @version 3.0 (December 2000) + * + * Optimised ANSI C code for the Rijndael cipher (now AES) + * + * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> + * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> + * @author Paulo Barreto <paulo.barreto@terra.com.br> + * + * This code is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __RIJNDAEL_ALG_FST_H +#define __RIJNDAEL_ALG_FST_H + +#define MAXKC (256/32) +#define MAXKB (256/8) +#define MAXNR 14 + +typedef u_int8_t u8; +typedef u_int16_t u16; +typedef u_int32_t u32; + +#endif /* __RIJNDAEL_ALG_FST_H */ diff --git a/db/crypto/rijndael/rijndael-api-fst.c b/db/crypto/rijndael/rijndael-api-fst.c new file mode 100644 index 000000000..2f75e197c --- /dev/null +++ b/db/crypto/rijndael/rijndael-api-fst.c @@ -0,0 +1,496 @@ +/** + * rijndael-api-fst.c + * + * @version 2.9 (December 2000) + * + * Optimised ANSI C code for the Rijndael cipher (now AES) + * + * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> + * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> + * @author Paulo Barreto <paulo.barreto@terra.com.br> + * + * This code is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Acknowledgements: + * + * We are deeply indebted to the following people for their bug reports, + * fixes, and improvement suggestions to this implementation. Though we + * tried to list all contributions, we apologise in advance for any + * missing reference. + * + * Andrew Bales <Andrew.Bales@Honeywell.com> + * Markus Friedl <markus.friedl@informatik.uni-erlangen.de> + * John Skodon <skodonj@webquill.com> + */ + +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/crypto.h" + +#include "crypto/rijndael/rijndael-alg-fst.h" +#include "crypto/rijndael/rijndael-api-fst.h" + +/* + * __db_makeKey -- + * + * PUBLIC: int __db_makeKey __P((keyInstance *, int, int, char *)); + */ +int +__db_makeKey(key, direction, keyLen, keyMaterial) + keyInstance *key; + int direction; + int keyLen; + char *keyMaterial; +{ + u8 cipherKey[MAXKB]; + + if (key == NULL) { + return BAD_KEY_INSTANCE; + } + + if ((direction == DIR_ENCRYPT) || (direction == DIR_DECRYPT)) { + key->direction = direction; + } else { + return BAD_KEY_DIR; + } + + if ((keyLen == 128) || (keyLen == 192) || (keyLen == 256)) { + key->keyLen = keyLen; + } else { + return BAD_KEY_MAT; + } + + if (keyMaterial != NULL) { + memcpy(cipherKey, keyMaterial, key->keyLen/4); + } + + if (direction == DIR_ENCRYPT) { + key->Nr = __db_rijndaelKeySetupEnc(key->rk, cipherKey, keyLen); + } else { + key->Nr = __db_rijndaelKeySetupDec(key->rk, cipherKey, keyLen); + } + __db_rijndaelKeySetupEnc(key->ek, cipherKey, keyLen); + return TRUE; +} + +/* + * __db_cipherInit -- + * + * PUBLIC: int __db_cipherInit __P((cipherInstance *, int, char *)); + */ +int +__db_cipherInit(cipher, mode, IV) + cipherInstance *cipher; + int mode; + char *IV; +{ + if ((mode == MODE_ECB) || (mode == MODE_CBC) || (mode == MODE_CFB1)) { + cipher->mode = mode; + } else { + return BAD_CIPHER_MODE; + } + if (IV != NULL) { + memcpy(cipher->IV, IV, MAX_IV_SIZE); + } + return TRUE; +} + +/* + * __db_blockEncrypt -- + * + * PUBLIC: int __db_blockEncrypt __P((cipherInstance *, keyInstance *, BYTE *, + * PUBLIC: size_t, BYTE *)); + */ +int +__db_blockEncrypt(cipher, key, input, inputLen, outBuffer) + cipherInstance *cipher; + keyInstance *key; + BYTE *input; + size_t inputLen; + BYTE *outBuffer; +{ + int i, k, t, numBlocks; + u8 block[16], *iv; + u32 tmpiv[4]; + + if (cipher == NULL || + key == NULL || + key->direction == DIR_DECRYPT) { + return BAD_CIPHER_STATE; + } + if (input == NULL || inputLen <= 0) { + return 0; /* nothing to do */ + } + + numBlocks = (int)(inputLen/128); + + switch (cipher->mode) { + case MODE_ECB: + for (i = numBlocks; i > 0; i--) { + __db_rijndaelEncrypt(key->rk, key->Nr, input, outBuffer); + input += 16; + outBuffer += 16; + } + break; + + case MODE_CBC: + iv = cipher->IV; + for (i = numBlocks; i > 0; i--) { + memcpy(tmpiv, iv, MAX_IV_SIZE); + ((u32*)block)[0] = ((u32*)input)[0] ^ tmpiv[0]; + ((u32*)block)[1] = ((u32*)input)[1] ^ tmpiv[1]; + ((u32*)block)[2] = ((u32*)input)[2] ^ tmpiv[2]; + ((u32*)block)[3] = ((u32*)input)[3] ^ tmpiv[3]; + __db_rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); + iv = outBuffer; + input += 16; + outBuffer += 16; + } + break; + + case MODE_CFB1: + iv = cipher->IV; + for (i = numBlocks; i > 0; i--) { + memcpy(outBuffer, input, 16); + for (k = 0; k < 128; k++) { + __db_rijndaelEncrypt(key->ek, key->Nr, iv, block); + outBuffer[k >> 3] ^= (block[0] & 0x80U) >> (k & 7); + for (t = 0; t < 15; t++) { + iv[t] = (iv[t] << 1) | (iv[t + 1] >> 7); + } + iv[15] = (iv[15] << 1) | ((outBuffer[k >> 3] >> (7 - (k & 7))) & 1); + } + outBuffer += 16; + input += 16; + } + break; + + default: + return BAD_CIPHER_STATE; + } + + return 128*numBlocks; +} + +/** + * Encrypt data partitioned in octets, using RFC 2040-like padding. + * + * @param input data to be encrypted (octet sequence) + * @param inputOctets input length in octets (not bits) + * @param outBuffer encrypted output data + * + * @return length in octets (not bits) of the encrypted output buffer. + */ +/* + * __db_padEncrypt -- + * + * PUBLIC: int __db_padEncrypt __P((cipherInstance *, keyInstance *, BYTE *, + * PUBLIC: int, BYTE *)); + */ +int +__db_padEncrypt(cipher, key, input, inputOctets, outBuffer) + cipherInstance *cipher; + keyInstance *key; + BYTE *input; + int inputOctets; + BYTE *outBuffer; +{ + int i, numBlocks, padLen; + u8 block[16], *iv; + u32 tmpiv[4]; + + if (cipher == NULL || + key == NULL || + key->direction == DIR_DECRYPT) { + return BAD_CIPHER_STATE; + } + if (input == NULL || inputOctets <= 0) { + return 0; /* nothing to do */ + } + + numBlocks = inputOctets/16; + + switch (cipher->mode) { + case MODE_ECB: + for (i = numBlocks; i > 0; i--) { + __db_rijndaelEncrypt(key->rk, key->Nr, input, outBuffer); + input += 16; + outBuffer += 16; + } + padLen = 16 - (inputOctets - 16*numBlocks); + DB_ASSERT(padLen > 0 && padLen <= 16); + memcpy(block, input, 16 - padLen); + memset(block + 16 - padLen, padLen, padLen); + __db_rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); + break; + + case MODE_CBC: + iv = cipher->IV; + for (i = numBlocks; i > 0; i--) { + memcpy(tmpiv, iv, MAX_IV_SIZE); + ((u32*)block)[0] = ((u32*)input)[0] ^ tmpiv[0]; + ((u32*)block)[1] = ((u32*)input)[1] ^ tmpiv[1]; + ((u32*)block)[2] = ((u32*)input)[2] ^ tmpiv[2]; + ((u32*)block)[3] = ((u32*)input)[3] ^ tmpiv[3]; + __db_rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); + iv = outBuffer; + input += 16; + outBuffer += 16; + } + padLen = 16 - (inputOctets - 16*numBlocks); + DB_ASSERT(padLen > 0 && padLen <= 16); + for (i = 0; i < 16 - padLen; i++) { + block[i] = input[i] ^ iv[i]; + } + for (i = 16 - padLen; i < 16; i++) { + block[i] = (BYTE)padLen ^ iv[i]; + } + __db_rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); + break; + + default: + return BAD_CIPHER_STATE; + } + + return 16*(numBlocks + 1); +} + +/* + * __db_blockDecrypt -- + * + * PUBLIC: int __db_blockDecrypt __P((cipherInstance *, keyInstance *, BYTE *, + * PUBLIC: size_t, BYTE *)); + */ +int +__db_blockDecrypt(cipher, key, input, inputLen, outBuffer) + cipherInstance *cipher; + keyInstance *key; + BYTE *input; + size_t inputLen; + BYTE *outBuffer; +{ + int i, k, t, numBlocks; + u8 block[16], *iv; + u32 tmpiv[4]; + + if (cipher == NULL || + key == NULL || + (cipher->mode != MODE_CFB1 && key->direction == DIR_ENCRYPT)) { + return BAD_CIPHER_STATE; + } + if (input == NULL || inputLen <= 0) { + return 0; /* nothing to do */ + } + + numBlocks = (int)(inputLen/128); + + switch (cipher->mode) { + case MODE_ECB: + for (i = numBlocks; i > 0; i--) { + __db_rijndaelDecrypt(key->rk, key->Nr, input, outBuffer); + input += 16; + outBuffer += 16; + } + break; + + case MODE_CBC: + memcpy(tmpiv, cipher->IV, MAX_IV_SIZE); + for (i = numBlocks; i > 0; i--) { + __db_rijndaelDecrypt(key->rk, key->Nr, input, block); + ((u32*)block)[0] ^= tmpiv[0]; + ((u32*)block)[1] ^= tmpiv[1]; + ((u32*)block)[2] ^= tmpiv[2]; + ((u32*)block)[3] ^= tmpiv[3]; + memcpy(tmpiv, input, 16); + memcpy(outBuffer, block, 16); + input += 16; + outBuffer += 16; + } + break; + + case MODE_CFB1: + iv = cipher->IV; + for (i = numBlocks; i > 0; i--) { + memcpy(outBuffer, input, 16); + for (k = 0; k < 128; k++) { + __db_rijndaelEncrypt(key->ek, key->Nr, iv, block); + for (t = 0; t < 15; t++) { + iv[t] = (iv[t] << 1) | (iv[t + 1] >> 7); + } + iv[15] = (iv[15] << 1) | ((input[k >> 3] >> (7 - (k & 7))) & 1); + outBuffer[k >> 3] ^= (block[0] & 0x80U) >> (k & 7); + } + outBuffer += 16; + input += 16; + } + break; + + default: + return BAD_CIPHER_STATE; + } + + return 128*numBlocks; +} + +/* + * __db_padDecrypt -- + * + * PUBLIC: int __db_padDecrypt __P((cipherInstance *, keyInstance *, BYTE *, + * PUBLIC: int, BYTE *)); + */ +int +__db_padDecrypt(cipher, key, input, inputOctets, outBuffer) + cipherInstance *cipher; + keyInstance *key; + BYTE *input; + int inputOctets; + BYTE *outBuffer; +{ + int i, numBlocks, padLen; + u8 block[16]; + u32 tmpiv[4]; + + if (cipher == NULL || + key == NULL || + key->direction == DIR_ENCRYPT) { + return BAD_CIPHER_STATE; + } + if (input == NULL || inputOctets <= 0) { + return 0; /* nothing to do */ + } + if (inputOctets % 16 != 0) { + return BAD_DATA; + } + + numBlocks = inputOctets/16; + + switch (cipher->mode) { + case MODE_ECB: + /* all blocks but last */ + for (i = numBlocks - 1; i > 0; i--) { + __db_rijndaelDecrypt(key->rk, key->Nr, input, outBuffer); + input += 16; + outBuffer += 16; + } + /* last block */ + __db_rijndaelDecrypt(key->rk, key->Nr, input, block); + padLen = block[15]; + if (padLen >= 16) { + return BAD_DATA; + } + for (i = 16 - padLen; i < 16; i++) { + if (block[i] != padLen) { + return BAD_DATA; + } + } + memcpy(outBuffer, block, 16 - padLen); + break; + + case MODE_CBC: + /* all blocks but last */ + memcpy(tmpiv, cipher->IV, MAX_IV_SIZE); + for (i = numBlocks - 1; i > 0; i--) { + __db_rijndaelDecrypt(key->rk, key->Nr, input, block); + ((u32*)block)[0] ^= tmpiv[0]; + ((u32*)block)[1] ^= tmpiv[1]; + ((u32*)block)[2] ^= tmpiv[2]; + ((u32*)block)[3] ^= tmpiv[3]; + memcpy(tmpiv, input, 16); + memcpy(outBuffer, block, 16); + input += 16; + outBuffer += 16; + } + /* last block */ + __db_rijndaelDecrypt(key->rk, key->Nr, input, block); + ((u32*)block)[0] ^= tmpiv[0]; + ((u32*)block)[1] ^= tmpiv[1]; + ((u32*)block)[2] ^= tmpiv[2]; + ((u32*)block)[3] ^= tmpiv[3]; + padLen = block[15]; + if (padLen <= 0 || padLen > 16) { + return BAD_DATA; + } + for (i = 16 - padLen; i < 16; i++) { + if (block[i] != padLen) { + return BAD_DATA; + } + } + memcpy(outBuffer, block, 16 - padLen); + break; + + default: + return BAD_CIPHER_STATE; + } + + return 16*numBlocks - padLen; +} + +#ifdef INTERMEDIATE_VALUE_KAT +/** + * cipherUpdateRounds: + * + * Encrypts/Decrypts exactly one full block a specified number of rounds. + * Only used in the Intermediate Value Known Answer Test. + * + * Returns: + * TRUE - on success + * BAD_CIPHER_STATE - cipher in bad state (e.g., not initialized) + */ +/* + * __db_cipherUpdateRounds -- + * + * PUBLIC: int __db_cipherUpdateRounds __P((cipherInstance *, keyInstance *, + * PUBLIC: BYTE *, int, BYTE *, int)); + */ +int +__db_cipherUpdateRounds(cipher, key, input, inputLen, outBuffer, rounds) + cipherInstance *cipher; + keyInstance *key; + BYTE *input; + size_t inputLen; + BYTE *outBuffer; + int rounds; +{ + u8 block[16]; + + if (cipher == NULL || key == NULL) { + return BAD_CIPHER_STATE; + } + + memcpy(block, input, 16); + + switch (key->direction) { + case DIR_ENCRYPT: + __db_rijndaelEncryptRound(key->rk, key->Nr, block, rounds); + break; + + case DIR_DECRYPT: + __db_rijndaelDecryptRound(key->rk, key->Nr, block, rounds); + break; + + default: + return BAD_KEY_DIR; + } + + memcpy(outBuffer, block, 16); + + return TRUE; +} +#endif /* INTERMEDIATE_VALUE_KAT */ diff --git a/db/crypto/rijndael/rijndael-api-fst.h b/db/crypto/rijndael/rijndael-api-fst.h new file mode 100644 index 000000000..5f948ef62 --- /dev/null +++ b/db/crypto/rijndael/rijndael-api-fst.h @@ -0,0 +1,93 @@ +/* + * Id: rijndael-api-fst.h,v 1.4 2002/03/27 04:31:12 bostic Exp + */ +/** + * rijndael-api-fst.h + * + * @version 2.9 (December 2000) + * + * Optimised ANSI C code for the Rijndael cipher (now AES) + * + * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> + * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> + * @author Paulo Barreto <paulo.barreto@terra.com.br> + * + * This code is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Acknowledgements: + * + * We are deeply indebted to the following people for their bug reports, + * fixes, and improvement suggestions to this implementation. Though we + * tried to list all contributions, we apologise in advance for any + * missing reference. + * + * Andrew Bales <Andrew.Bales@Honeywell.com> + * Markus Friedl <markus.friedl@informatik.uni-erlangen.de> + * John Skodon <skodonj@webquill.com> + */ + +#ifndef __RIJNDAEL_API_FST_H +#define __RIJNDAEL_API_FST_H + +#include "crypto/rijndael/rijndael-alg-fst.h" + +/* Generic Defines */ +#define DIR_ENCRYPT 0 /* Are we encrpyting? */ +#define DIR_DECRYPT 1 /* Are we decrpyting? */ +#define MODE_ECB 1 /* Are we ciphering in ECB mode? */ +#define MODE_CBC 2 /* Are we ciphering in CBC mode? */ +#define MODE_CFB1 3 /* Are we ciphering in 1-bit CFB mode? */ +#undef TRUE +#define TRUE 1 +#undef FALSE +#define FALSE 0 +#define BITSPERBLOCK 128 /* Default number of bits in a cipher block */ + +/* Error Codes */ +#define BAD_KEY_DIR -1 /* Key direction is invalid, e.g., unknown value */ +#define BAD_KEY_MAT -2 /* Key material not of correct length */ +#define BAD_KEY_INSTANCE -3 /* Key passed is not valid */ +#define BAD_CIPHER_MODE -4 /* Params struct passed to cipherInit invalid */ +#define BAD_CIPHER_STATE -5 /* Cipher in wrong state (e.g., not initialized) */ +#define BAD_BLOCK_LENGTH -6 +#define BAD_CIPHER_INSTANCE -7 +#define BAD_DATA -8 /* Data contents are invalid, e.g., invalid padding */ +#define BAD_OTHER -9 /* Unknown error */ + +/* Algorithm-specific Defines */ +#define MAX_KEY_SIZE 64 /* # of ASCII char's needed to represent a key */ +#define MAX_IV_SIZE 16 /* # bytes needed to represent an IV */ + +/* Typedefs */ + +typedef unsigned char BYTE; + +/* The structure for key information */ +typedef struct { + BYTE direction; /* Key used for encrypting or decrypting? */ + int keyLen; /* Length of the key */ + char keyMaterial[MAX_KEY_SIZE+1]; /* Raw key data in ASCII, e.g., user input or KAT values */ + int Nr; /* key-length-dependent number of rounds */ + u32 rk[4*(MAXNR + 1)]; /* key schedule */ + u32 ek[4*(MAXNR + 1)]; /* CFB1 key schedule (encryption only) */ +} keyInstance; + +/* The structure for cipher information */ +typedef struct { /* changed order of the components */ + BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ + BYTE IV[MAX_IV_SIZE]; /* A possible Initialization Vector for ciphering */ +} cipherInstance; + +#endif /* __RIJNDAEL_API_FST_H */ diff --git a/db/db/db_open.c b/db/db/db_open.c new file mode 100644 index 000000000..66ea247cb --- /dev/null +++ b/db/db/db_open.c @@ -0,0 +1,706 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_open.c,v 11.214 2002/08/07 16:16:47 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/db_shash.h" +#include "dbinc/db_swap.h" +#include "dbinc/btree.h" +#include "dbinc/crypto.h" +#include "dbinc/hmac.h" +#include "dbinc/fop.h" +#include "dbinc/hash.h" +#include "dbinc/lock.h" +#include "dbinc/log.h" +#include "dbinc/qam.h" +#include "dbinc/txn.h" + +static int __db_openchk __P((DB *, + DB_TXN *, const char *, const char *, DBTYPE, u_int32_t)); + +/* + * __db_open -- + * Main library interface to the DB access methods. + * + * PUBLIC: int __db_open __P((DB *, DB_TXN *, + * PUBLIC: const char *, const char *, DBTYPE, u_int32_t, int)); + */ +int +__db_open(dbp, txn, name, subdb, type, flags, mode) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb; + DBTYPE type; + u_int32_t flags; + int mode; +{ + DB_ENV *dbenv; + int remove_master, remove_me, ret, t_ret, txn_local; + + dbenv = dbp->dbenv; + remove_me = remove_master = txn_local = 0; + + PANIC_CHECK(dbenv); + + if ((ret = __db_openchk(dbp, txn, name, subdb, type, flags)) != 0) + return (ret); + + /* + * Create local transaction as necessary, check for consistent + * transaction usage. + */ + if (IS_AUTO_COMMIT(dbenv, txn, flags)) { + if ((ret = __db_txn_auto(dbp, &txn)) != 0) + return (ret); + txn_local = 1; + } else + if (txn != NULL && !TXN_ON(dbenv)) + return (__db_not_txn_env(dbenv)); + + /* + * If the environment was configured with threads, the DB handle + * must also be free-threaded, so we force the DB_THREAD flag on. + * (See SR #2033 for why this is a requirement--recovery needs + * to be able to grab a dbp using __db_fileid_to_dbp, and it has + * no way of knowing which dbp goes with which thread, so whichever + * one it finds has to be usable in any of them.) + */ + if (F_ISSET(dbenv, DB_ENV_THREAD)) + LF_SET(DB_THREAD); + + /* Convert any DB->open flags. */ + if (LF_ISSET(DB_RDONLY)) + F_SET(dbp, DB_AM_RDONLY); + if (LF_ISSET(DB_DIRTY_READ)) + F_SET(dbp, DB_AM_DIRTY); + + /* Fill in the type. */ + dbp->type = type; + + /* + * If we're opening a subdatabase, we have to open (and potentially + * create) the main database, and then get (and potentially store) + * our base page number in that database. Then, we can finally open + * the subdatabase. + */ + if ((ret = __db_dbopen( + dbp, txn, name, subdb, flags, mode, PGNO_BASE_MD)) != 0) + goto err; + + /* + * You can open the database that describes the subdatabases in the + * rest of the file read-only. The content of each key's data is + * unspecified and applications should never be adding new records + * or updating existing records. However, during recovery, we need + * to open these databases R/W so we can redo/undo changes in them. + * Likewise, we need to open master databases read/write during + * rename and remove so we can be sure they're fully sync'ed, so + * we provide an override flag for the purpose. + */ + if (subdb == NULL && !IS_RECOVERING(dbenv) && !LF_ISSET(DB_RDONLY) && + !LF_ISSET(DB_RDWRMASTER) && F_ISSET(dbp, DB_AM_SUBDB)) { + __db_err(dbenv, + "files containing multiple databases may only be opened read-only"); + ret = EINVAL; + goto err; + } + +err: /* If we were successful, don't discard the file on close. */ + if (ret == 0) + /* If we were successful, don't discard the file on close. */ + F_CLR(dbp, DB_AM_DISCARD | DB_AM_CREATED | DB_AM_CREATED_MSTR); + else { + /* + * If we are not transactional, we need to remove the + * databases/subdatabases. If we are transactional, then + * the abort of the child transaction should take care of + * cleaning them up. + */ + remove_me = txn == NULL && F_ISSET(dbp, DB_AM_CREATED); + remove_master = txn == NULL && F_ISSET(dbp, DB_AM_CREATED_MSTR); + + /* + * If we had an error, it may have happened before or after + * we actually logged the open. If it happened before, then + * abort won't know anything about it and won't close or + * refresh the dbp, so we need to do it explicitly. + */ + (void)__db_refresh(dbp, txn, DB_NOSYNC); + } + + /* Remove anyone we created. */ + if (remove_master || (subdb == NULL && remove_me)) + /* Remove file. */ + (void)dbenv->dbremove(dbenv, txn, name, NULL, 0); + else if (remove_me) + /* Remove subdatabase. */ + (void)dbenv->dbremove(dbenv, txn, name, subdb, 0); + + /* Commit for DB_AUTO_COMMIT. */ + if (txn_local) { + if (ret == 0) + ret = txn->commit(txn, 0); + else + if ((t_ret = txn->abort(txn)) != 0) + ret = __db_panic(dbenv, t_ret); + } + + return (ret); +} + +/* + * __db_dbopen -- + * Open a database. This routine gets called in three different ways. + * 1. It can be called to open a file/database. In this case, subdb will + * be NULL and meta_pgno will be PGNO_BASE_MD. + * 2. It can be called to open a subdatabase during normal operation. In + * this case, name and subname will both be non-NULL and meta_pgno will + * be PGNO_BAS_MD (also PGNO_INVALID). + * 3. It can be called during recovery to open a subdatabase in which case + * name will be non-NULL, subname mqy be NULL and meta-pgno will be + * a valid pgno (i.e., not PGNO_BASE_MD). + * + * PUBLIC: int __db_dbopen __P((DB *, DB_TXN *, + * PUBLIC: const char *, const char *, u_int32_t, int, db_pgno_t)); + */ +int +__db_dbopen(dbp, txn, name, subdb, flags, mode, meta_pgno) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb; + u_int32_t flags; + int mode; + db_pgno_t meta_pgno; +{ + DB_ENV *dbenv; + int ret; + u_int32_t id; + + dbenv = dbp->dbenv; + id = TXN_INVALID; + if (txn != NULL) + F_SET(dbp, DB_AM_TXN); + + DB_TEST_RECOVERY(dbp, DB_TEST_PREOPEN, ret, name); + /* + * If name is NULL, it's always a create, so make sure that we + * have a type specified. It would be nice if this checking + * were done in __db_open where most of the interface checking + * is done, but this interface (__db_dbopen) is used by the + * recovery and limbo system, so we need to safeguard this + * interface as well. + */ + if (name == NULL) { + F_SET(dbp, DB_AM_INMEM); + + if (dbp->type == DB_UNKNOWN) { + __db_err(dbenv, + "DBTYPE of unknown without existing file"); + return (EINVAL); + } + + if (dbp->pgsize == 0) + dbp->pgsize = DB_DEF_IOSIZE; + + /* + * If the file is a temporary file and we're doing locking, + * then we have to create a unique file ID. We can't use our + * normal dev/inode pair (or whatever this OS uses in place of + * dev/inode pairs) because no backing file will be created + * until the mpool cache is filled forcing the buffers to disk. + * Grab a random locker ID to use as a file ID. The created + * ID must never match a potential real file ID -- we know it + * won't because real file IDs contain a time stamp after the + * dev/inode pair, and we're simply storing a 4-byte value. + * + * !!! + * Store the locker in the file id structure -- we can get it + * from there as necessary, and it saves having two copies. + */ + if (LOCKING_ON(dbenv) && (ret = dbenv->lock_id(dbenv, + (u_int32_t *)dbp->fileid)) != 0) + return (ret); + } else if (subdb == NULL && meta_pgno == PGNO_BASE_MD) { + /* Open/create the underlying file. Acquire locks. */ + if ((ret = + __fop_file_setup(dbp, txn, name, mode, flags, &id)) != 0) + return (ret); + } else { + if ((ret = __fop_subdb_setup(dbp, + txn, name, subdb, mode, flags)) != 0) + return (ret); + meta_pgno = dbp->meta_pgno; + } + + /* + * If we created the file, set the truncate flag for the mpool. This + * isn't for anything we've done, it's protection against stupid user + * tricks: if the user deleted a file behind Berkeley DB's back, we + * may still have pages in the mpool that match the file's "unique" ID. + * + * Note that if we're opening a subdatabase, we don't want to set + * the TRUNCATE flag even if we just created the file--we already + * opened and updated the master using access method interfaces, + * so we don't want to get rid of any pages that are in the mpool. + * If we created the file when we opened the master, we already hit + * this check in a non-subdb context then. + */ + if (subdb == NULL && F_ISSET(dbp, DB_AM_CREATED)) + LF_SET(DB_TRUNCATE); + + /* Set up the underlying environment. */ + if ((ret = __db_dbenv_setup(dbp, txn, name, id, flags)) != 0) + return (ret); + + /* + * Set the open flag. We use it to mean that the dbp has gone + * through mpf setup, including dbreg_register. Also, below, + * the underlying access method open functions may want to do + * things like acquire cursors, so the open flag has to be set + * before calling them. + */ + F_SET(dbp, DB_AM_OPEN_CALLED); + + /* + * For unnamed files, we need to actually create the file now + * that the mpool is open. + */ + if (name == NULL && (ret = __db_new_file(dbp, txn, NULL, NULL)) != 0) + return (ret); + + switch (dbp->type) { + case DB_BTREE: + ret = __bam_open(dbp, txn, name, meta_pgno, flags); + break; + case DB_HASH: + ret = __ham_open(dbp, txn, name, meta_pgno, flags); + break; + case DB_RECNO: + ret = __ram_open(dbp, txn, name, meta_pgno, flags); + break; + case DB_QUEUE: + ret = __qam_open(dbp, txn, name, meta_pgno, mode, flags); + break; + case DB_UNKNOWN: + return (__db_unknown_type(dbenv, "__db_dbopen", dbp->type)); + } + if (ret != 0) + goto err; + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTOPEN, ret, name); + + /* + * Unnamed files don't need handle locks, so we only have to check + * for a handle lock downgrade or lockevent in the case of named + * files. + */ + if (!F_ISSET(dbp, DB_AM_RECOVER) && + name != NULL && LOCK_ISSET(dbp->handle_lock)) { + if (txn != NULL) { + ret = __txn_lockevent(dbenv, + txn, dbp, &dbp->handle_lock, dbp->lid); + } else if (LOCKING_ON(dbenv)) + /* Trade write handle lock for read handle lock. */ + ret = __lock_downgrade(dbenv, + &dbp->handle_lock, DB_LOCK_READ, 0); + } +DB_TEST_RECOVERY_LABEL +err: + return (ret); +} + +/* + * __db_new_file -- + * Create a new database file. + * + * PUBLIC: int __db_new_file __P((DB *, DB_TXN *, DB_FH *, const char *)); + */ +int +__db_new_file(dbp, txn, fhp, name) + DB *dbp; + DB_TXN *txn; + DB_FH *fhp; + const char *name; +{ + int ret; + + switch (dbp->type) { + case DB_BTREE: + case DB_RECNO: + ret = __bam_new_file(dbp, txn, fhp, name); + break; + case DB_HASH: + ret = __ham_new_file(dbp, txn, fhp, name); + break; + case DB_QUEUE: + ret = __qam_new_file(dbp, txn, fhp, name); + break; + default: + __db_err(dbp->dbenv, + "%s: Invalid type %d specified", name, dbp->type); + ret = EINVAL; + break; + } + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTLOGMETA, ret, name); + /* Sync the file in preparation for moving it into place. */ + if (ret == 0 && fhp != NULL) + ret = __os_fsync(dbp->dbenv, fhp); + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTSYNC, ret, name); + +DB_TEST_RECOVERY_LABEL + return (ret); +} + +/* + * __db_init_subdb -- + * Initialize the dbp for a subdb. + * + * PUBLIC: int __db_init_subdb __P((DB *, DB *, const char *, DB_TXN *)); + */ +int +__db_init_subdb(mdbp, dbp, name, txn) + DB *mdbp, *dbp; + const char *name; + DB_TXN *txn; +{ + DBMETA *meta; + DB_MPOOLFILE *mpf; + int ret, t_ret; + + ret = 0; + if (!F_ISSET(dbp, DB_AM_CREATED)) { + /* Subdb exists; read meta-data page and initialize. */ + mpf = mdbp->mpf; + if ((ret = mpf->get(mpf, &dbp->meta_pgno, 0, &meta)) != 0) + goto err; + ret = __db_meta_setup(mdbp->dbenv, dbp, name, meta, 0, 0); + if ((t_ret = mpf->put(mpf, meta, 0)) != 0 && ret == 0) + ret = t_ret; + /* + * If __db_meta_setup found that the meta-page hadn't + * been written out during recovery, we can just return. + */ + if (ret == ENOENT) + ret = 0; + goto err; + } + + /* Handle the create case here. */ + switch (dbp->type) { + case DB_BTREE: + case DB_RECNO: + ret = __bam_new_subdb(mdbp, dbp, txn); + break; + case DB_HASH: + ret = __ham_new_subdb(mdbp, dbp, txn); + break; + case DB_QUEUE: + ret = EINVAL; + break; + default: + __db_err(dbp->dbenv, + "Invalid subdatabase type %d specified", dbp->type); + return (EINVAL); + } + +err: return (ret); +} + +/* + * __db_chk_meta -- + * Take a buffer containing a meta-data page and check it for a checksum + * (and verify the checksum if necessary) and possibly decrypt it. + * + * Return 0 on success, >0 (errno) on error, -1 on checksum mismatch. + * + * PUBLIC: int __db_chk_meta __P((DB_ENV *, DB *, DBMETA *, int)); + */ +int +__db_chk_meta(dbenv, dbp, meta, do_metachk) + DB_ENV *dbenv; + DB *dbp; + DBMETA *meta; + int do_metachk; +{ + int is_hmac, ret; + u_int8_t *chksum; + + ret = 0; + + if (FLD_ISSET(meta->metaflags, DBMETA_CHKSUM)) { + if (dbp != NULL) + F_SET(dbp, DB_AM_CHKSUM); + + is_hmac = meta->encrypt_alg == 0 ? 0 : 1; + chksum = ((BTMETA *)meta)->chksum; + if (do_metachk && ((ret = __db_check_chksum(dbenv, + (DB_CIPHER *)dbenv->crypto_handle, chksum, meta, + DBMETASIZE, is_hmac)) != 0)) + return (ret); + } + +#ifdef HAVE_CRYPTO + ret = __crypto_decrypt_meta(dbenv, dbp, (u_int8_t *)meta, + DBMETASIZE, do_metachk); +#endif + return (ret); +} + +/* + * __db_meta_setup -- + * + * Take a buffer containing a meta-data page and figure out if it's + * valid, and if so, initialize the dbp from the meta-data page. + * + * PUBLIC: int __db_meta_setup __P((DB_ENV *, + * PUBLIC: DB *, const char *, DBMETA *, u_int32_t, int)); + */ +int +__db_meta_setup(dbenv, dbp, name, meta, oflags, do_metachk) + DB_ENV *dbenv; + DB *dbp; + const char *name; + DBMETA *meta; + u_int32_t oflags; + int do_metachk; +{ + u_int32_t flags, magic; + int ret; + + ret = 0; + + /* + * Figure out what access method we're dealing with, and then + * call access method specific code to check error conditions + * based on conflicts between the found file and application + * arguments. A found file overrides some user information -- + * we don't consider it an error, for example, if the user set + * an expected byte order and the found file doesn't match it. + */ + F_CLR(dbp, DB_AM_SWAP); + magic = meta->magic; + +swap_retry: + switch (magic) { + case DB_BTREEMAGIC: + case DB_HASHMAGIC: + case DB_QAMMAGIC: + case DB_RENAMEMAGIC: + break; + case 0: + /* + * The only time this should be 0 is if we're in the + * midst of opening a subdb during recovery and that + * subdatabase had its meta-data page allocated, but + * not yet initialized. + */ + if (F_ISSET(dbp, DB_AM_SUBDB) && ((IS_RECOVERING(dbenv) && + F_ISSET((DB_LOG *) dbenv->lg_handle, DBLOG_FORCE_OPEN)) || + meta->pgno != PGNO_INVALID)) + return (ENOENT); + + goto bad_format; + default: + if (F_ISSET(dbp, DB_AM_SWAP)) + goto bad_format; + + M_32_SWAP(magic); + F_SET(dbp, DB_AM_SWAP); + goto swap_retry; + } + + /* + * We can only check the meta page if we are sure we have a meta page. + * If it is random data, then this check can fail. So only now can we + * checksum and decrypt. Don't distinguish between configuration and + * checksum match errors here, because we haven't opened the database + * and even a checksum error isn't a reason to panic the environment. + */ + if ((ret = __db_chk_meta(dbenv, dbp, meta, do_metachk)) != 0) { + if (ret == -1) { + __db_err(dbenv, + "%s: metadata page checksum error", name); + ret = EINVAL; + } + goto bad_format; + } + + switch (magic) { + case DB_BTREEMAGIC: + flags = meta->flags; + if (F_ISSET(dbp, DB_AM_SWAP)) + M_32_SWAP(flags); + if (LF_ISSET(BTM_RECNO)) + dbp->type = DB_RECNO; + else + dbp->type = DB_BTREE; + if ((oflags & DB_TRUNCATE) == 0 && (ret = + __bam_metachk(dbp, name, (BTMETA *)meta)) != 0) + return (ret); + break; + case DB_HASHMAGIC: + dbp->type = DB_HASH; + if ((oflags & DB_TRUNCATE) == 0 && (ret = + __ham_metachk(dbp, name, (HMETA *)meta)) != 0) + return (ret); + break; + case DB_QAMMAGIC: + dbp->type = DB_QUEUE; + if ((oflags & DB_TRUNCATE) == 0 && (ret = + __qam_metachk(dbp, name, (QMETA *)meta)) != 0) + return (ret); + break; + case DB_RENAMEMAGIC: + F_SET(dbp, DB_AM_IN_RENAME); + break; + } + return (0); + +bad_format: + __db_err(dbenv, "%s: unexpected file type or format", name); + return (ret); +} + +/* + * __db_openchk -- + * Interface error checking for open calls. + */ +static int +__db_openchk(dbp, txn, name, subdb, type, flags) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb; + DBTYPE type; + u_int32_t flags; +{ + DB_ENV *dbenv; + int ret; + u_int32_t ok_flags; + + dbenv = dbp->dbenv; + + /* Validate arguments. */ +#define OKFLAGS \ + (DB_AUTO_COMMIT | DB_CREATE | DB_DIRTY_READ | DB_EXCL | \ + DB_FCNTL_LOCKING | DB_NOMMAP | DB_RDONLY | DB_RDWRMASTER | \ + DB_THREAD | DB_TRUNCATE | DB_WRITEOPEN) + if ((ret = __db_fchk(dbenv, "DB->open", flags, OKFLAGS)) != 0) + return (ret); + if (LF_ISSET(DB_EXCL) && !LF_ISSET(DB_CREATE)) + return (__db_ferr(dbenv, "DB->open", 1)); + if (LF_ISSET(DB_RDONLY) && LF_ISSET(DB_CREATE)) + return (__db_ferr(dbenv, "DB->open", 1)); + +#ifdef HAVE_VXWORKS + if (LF_ISSET(DB_TRUNCATE)) { + __db_err(dbenv, "DB_TRUNCATE unsupported in VxWorks"); + return (__db_eopnotsup(dbenv)); + } +#endif + switch (type) { + case DB_UNKNOWN: + if (LF_ISSET(DB_CREATE|DB_TRUNCATE)) { + __db_err(dbenv, + "%s: DB_UNKNOWN type specified with DB_CREATE or DB_TRUNCATE", + name); + return (EINVAL); + } + ok_flags = 0; + break; + case DB_BTREE: + ok_flags = DB_OK_BTREE; + break; + case DB_HASH: + ok_flags = DB_OK_HASH; + break; + case DB_QUEUE: + ok_flags = DB_OK_QUEUE; + break; + case DB_RECNO: + ok_flags = DB_OK_RECNO; + break; + default: + __db_err(dbenv, "unknown type: %lu", (u_long)type); + return (EINVAL); + } + if (ok_flags) + DB_ILLEGAL_METHOD(dbp, ok_flags); + + /* The environment may have been created, but never opened. */ + if (!F_ISSET(dbenv, DB_ENV_DBLOCAL | DB_ENV_OPEN_CALLED)) { + __db_err(dbenv, "environment not yet opened"); + return (EINVAL); + } + + /* + * Historically, you could pass in an environment that didn't have a + * mpool, and DB would create a private one behind the scenes. This + * no longer works. + */ + if (!F_ISSET(dbenv, DB_ENV_DBLOCAL) && !MPOOL_ON(dbenv)) { + __db_err(dbenv, "environment did not include a memory pool"); + return (EINVAL); + } + + /* + * You can't specify threads during DB->open if subsystems in the + * environment weren't configured with them. + */ + if (LF_ISSET(DB_THREAD) && + !F_ISSET(dbenv, DB_ENV_DBLOCAL | DB_ENV_THREAD)) { + __db_err(dbenv, "environment not created using DB_THREAD"); + return (EINVAL); + } + + /* DB_TRUNCATE is not transaction recoverable. */ + if (LF_ISSET(DB_TRUNCATE) && txn != NULL) { + __db_err(dbenv, + "DB_TRUNCATE illegal with transaction specified"); + return (EINVAL); + } + + /* Subdatabase checks. */ + if (subdb != NULL) { + /* Subdatabases must be created in named files. */ + if (name == NULL) { + __db_err(dbenv, + "multiple databases cannot be created in temporary files"); + return (EINVAL); + } + + /* Truncate is a physical file operation */ + if (LF_ISSET(DB_TRUNCATE)) { + __db_err(dbenv, + "DB_TRUNCATE illegal with multiple databases"); + return (EINVAL); + } + + /* QAM can't be done as a subdatabase. */ + if (type == DB_QUEUE) { + __db_err(dbenv, "Queue databases must be one-per-file"); + return (EINVAL); + } + } + + return (0); +} diff --git a/db/db/db_remove.c b/db/db/db_remove.c new file mode 100644 index 000000000..ef8aeb4ae --- /dev/null +++ b/db/db/db_remove.c @@ -0,0 +1,321 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_remove.c,v 11.201 2002/08/11 02:11:22 margo Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/fop.h" +#include "dbinc/btree.h" +#include "dbinc/hash.h" +#include "dbinc/db_shash.h" +#include "dbinc/lock.h" + +static int __db_subdb_remove __P((DB *, DB_TXN *, const char *, const char *)); +static int __db_dbtxn_remove __P((DB *, DB_TXN *, const char *)); + +/* + * __dbenv_dbremove + * Remove method for DB_ENV. + * + * PUBLIC: int __dbenv_dbremove __P((DB_ENV *, + * PUBLIC: DB_TXN *, const char *, const char *, u_int32_t)); + */ +int +__dbenv_dbremove(dbenv, txn, name, subdb, flags) + DB_ENV *dbenv; + DB_TXN *txn; + const char *name, *subdb; + u_int32_t flags; +{ + DB *dbp; + int ret, t_ret, txn_local; + + txn_local = 0; + + PANIC_CHECK(dbenv); + ENV_ILLEGAL_BEFORE_OPEN(dbenv, "DB_ENV->dbremove"); + + /* Validate arguments. */ + if ((ret = __db_fchk(dbenv, "DB->remove", flags, DB_AUTO_COMMIT)) != 0) + return (ret); + + if ((ret = db_create(&dbp, dbenv, 0)) != 0) + return (ret); + + /* + * Create local transaction as necessary, check for consistent + * transaction usage. + */ + if (IS_AUTO_COMMIT(dbenv, txn, flags)) { + if ((ret = __db_txn_auto(dbp, &txn)) != 0) + return (ret); + txn_local = 1; + } else + if (txn != NULL && !TXN_ON(dbenv)) + return (__db_not_txn_env(dbenv)); + + ret = __db_remove_i(dbp, txn, name, subdb); + + /* Commit for DB_AUTO_COMMIT. */ + if (txn_local) { + if (ret == 0) + ret = txn->commit(txn, 0); + else + if ((t_ret = txn->abort(txn)) != 0) + ret = __db_panic(dbenv, t_ret); + /* + * We created the DBP here and when we committed/aborted, + * we release all the tranasctional locks, which includes + * the handle lock; mark the handle cleared explicitly. + */ + LOCK_INIT(dbp->handle_lock); + dbp->lid = DB_LOCK_INVALIDID; + } + + /* + * We never opened this dbp for real, so don't call the transactional + * version of DB->close, and use NOSYNC to avoid calling into mpool. + */ + if ((t_ret = dbp->close(dbp, DB_NOSYNC)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} + +/* + * __db_remove + * Remove method for DB. + * + * PUBLIC: int __db_remove __P((DB *, const char *, const char *, u_int32_t)); + */ +int +__db_remove(dbp, name, subdb, flags) + DB *dbp; + const char *name, *subdb; + u_int32_t flags; +{ + DB_ENV *dbenv; + int ret, t_ret; + + dbenv = dbp->dbenv; + + PANIC_CHECK(dbenv); + + /* + * Validate arguments, continuing to destroy the handle on failure. + * + * Cannot use DB_ILLEGAL_AFTER_OPEN directly because it returns. + * + * !!! + * We have a serious problem if we're here with a handle used to open + * a database -- we'll destroy the handle, and the application won't + * ever be able to close the database. + */ + if (F_ISSET(dbp, DB_AM_OPEN_CALLED)) { + ret = __db_mi_open(dbenv, "DB->remove", 1); + goto err; + } + + /* Validate arguments. */ + if ((ret = __db_fchk(dbenv, "DB->remove", flags, 0)) != 0) + goto err; + + /* Check for consistent transaction usage. */ + if ((ret = __db_check_txn(dbp, NULL, DB_LOCK_INVALIDID, 0)) != 0) + goto err; + + /* Remove the file. */ + ret = __db_remove_i(dbp, NULL, name, subdb); + + /* + * We never opened this dbp for real, use NOSYNC to avoid calling into + * mpool. + */ +err: if ((t_ret = dbp->close(dbp, DB_NOSYNC)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} + +/* + * __db_remove_i + * Internal remove method for DB. + * + * PUBLIC: int __db_remove_i __P((DB *, DB_TXN *, const char *, const char *)); + */ +int +__db_remove_i(dbp, txn, name, subdb) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb; +{ + DB_ENV *dbenv; + DB_LSN newlsn; + int ret; + char *real_name; + + dbenv = dbp->dbenv; + real_name = NULL; + + /* Handle subdatabase removes separately. */ + if (subdb != NULL) + return (__db_subdb_remove(dbp, txn, name, subdb)); + + /* Handle transactional file removes separately. */ + if (txn != NULL) + return (__db_dbtxn_remove(dbp, txn, name)); + + /* + * The remaining case is a non-transactional file remove. + * + * Find the real name of the file. + */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, name, 0, NULL, &real_name)) != 0) + return (ret); + + if ((ret = __fop_remove_setup(dbp, NULL, real_name, 0)) != 0) + goto err; + + if (dbp->db_am_remove != NULL && + (ret = dbp->db_am_remove(dbp, NULL, name, subdb, &newlsn)) != 0) + goto err; + + ret = __fop_remove(dbenv, NULL, dbp->fileid, name, DB_APP_DATA); + +err: + if (real_name != NULL) + __os_free(dbenv, real_name); + + return (ret); +} + +/* + * __db_subdb_remove -- + * Remove a subdatabase. + */ +static int +__db_subdb_remove(dbp, txn, name, subdb) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb; +{ + DB *mdbp, *sdbp; + DB_ENV *dbenv; + int ret, t_ret; + + mdbp = sdbp = NULL; + dbenv = dbp->dbenv; + + /* Open the subdatabase. */ + if ((ret = db_create(&sdbp, dbp->dbenv, 0)) != 0) + goto err; + if ((ret = __db_open(sdbp, + txn, name, subdb, DB_UNKNOWN, DB_WRITEOPEN, 0)) != 0) + goto err; + + DB_TEST_RECOVERY(sdbp, DB_TEST_PREDESTROY, ret, name); + + /* Free up the pages in the subdatabase. */ + switch (sdbp->type) { + case DB_BTREE: + case DB_RECNO: + if ((ret = __bam_reclaim(sdbp, txn)) != 0) + goto err; + break; + case DB_HASH: + if ((ret = __ham_reclaim(sdbp, txn)) != 0) + goto err; + break; + default: + ret = __db_unknown_type( + sdbp->dbenv, "__db_subdb_remove", sdbp->type); + goto err; + } + + /* + * Remove the entry from the main database and free the subdatabase + * metadata page. + */ + if ((ret = __db_master_open(sdbp, txn, name, 0, 0, &mdbp)) != 0) + goto err; + + if ((ret = __db_master_update( + mdbp, sdbp, txn, subdb, sdbp->type, MU_REMOVE, NULL, 0)) != 0) + goto err; + + DB_TEST_RECOVERY(sdbp, DB_TEST_POSTDESTROY, ret, name); + +DB_TEST_RECOVERY_LABEL +err: + /* Close the main and subdatabases. */ + if ((t_ret = __db_close_i(sdbp, txn, 0)) != 0 && ret == 0) + ret = t_ret; + + if (mdbp != NULL && + (t_ret = __db_close_i(mdbp, txn, 0)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} + +static int +__db_dbtxn_remove(dbp, txn, name) + DB *dbp; + DB_TXN *txn; + const char *name; +{ + DB_ENV *dbenv; + DB_LSN newlsn; + int ret; + char *tmpname; + + dbenv = dbp->dbenv; + tmpname = NULL; + + /* + * This is a transactional rename, so we have to keep the name + * of the file locked until the transaction commits. As a result, + * we implement remove by renaming the file to some other name + * (which creates a dummy named file as a placeholder for the + * file being rename/dremoved) and then deleting that file as + * a delayed remove at commit. + */ + if ((ret = + __db_backup_name(dbenv, name, txn, &tmpname, &txn->last_lsn)) != 0) + return (ret); + + DB_TEST_RECOVERY(dbp, DB_TEST_PREDESTROY, ret, name); + + if ((ret = __db_rename_i(dbp, txn, name, NULL, tmpname)) != 0) + goto err; + + /* The internal removes will also translate into delayed removes. */ + if (dbp->db_am_remove != NULL && + (ret = dbp->db_am_remove(dbp, txn, tmpname, NULL, &newlsn)) != 0) + goto err; + + ret = __fop_remove(dbenv, txn, dbp->fileid, tmpname, DB_APP_DATA); + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTDESTROY, ret, name); + +err: +DB_TEST_RECOVERY_LABEL + if (tmpname != NULL) + __os_free(dbenv, tmpname); + + return (ret); +} diff --git a/db/db/db_rename.c b/db/db/db_rename.c new file mode 100644 index 000000000..bb81e2cd1 --- /dev/null +++ b/db/db/db_rename.c @@ -0,0 +1,297 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_rename.c,v 11.203 2002/08/07 16:16:47 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/db_shash.h" +#include "dbinc/db_am.h" +#include "dbinc/fop.h" +#include "dbinc/lock.h" +#include "dbinc/log.h" + +static int __db_subdb_rename __P(( DB *, DB_TXN *, + const char *, const char *, const char *)); + +/* + * __dbenv_dbrename + * Rename method for DB_ENV. + * + * PUBLIC: int __dbenv_dbrename __P((DB_ENV *, DB_TXN *, + * PUBLIC: const char *, const char *, const char *, u_int32_t)); + */ +int +__dbenv_dbrename(dbenv, txn, name, subdb, newname, flags) + DB_ENV *dbenv; + DB_TXN *txn; + const char *name, *subdb, *newname; + u_int32_t flags; +{ + DB *dbp; + int ret, t_ret, txn_local; + + txn_local = 0; + + PANIC_CHECK(dbenv); + ENV_ILLEGAL_BEFORE_OPEN(dbenv, "DB_ENV->dbrename"); + + /* Validate arguments. */ + if ((ret = __db_fchk(dbenv, "DB->rename", flags, DB_AUTO_COMMIT)) != 0) + return (ret); + + if ((ret = db_create(&dbp, dbenv, 0)) != 0) + return (ret); + + /* + * Create local transaction as necessary, check for consistent + * transaction usage. + */ + if (IS_AUTO_COMMIT(dbenv, txn, flags)) { + if ((ret = __db_txn_auto(dbp, &txn)) != 0) + return (ret); + txn_local = 1; + } else + if (txn != NULL && !TXN_ON(dbenv)) + return (__db_not_txn_env(dbenv)); + + ret = __db_rename_i(dbp, txn, name, subdb, newname); + + /* Commit for DB_AUTO_COMMIT. */ + if (txn_local) { + if (ret == 0) + ret = txn->commit(txn, 0); + else + if ((t_ret = txn->abort(txn)) != 0) + ret = __db_panic(dbenv, t_ret); + + /* + * We created the DBP here and when we committed/aborted, + * we release all the tranasctional locks, which includes + * the handle lock; mark the handle cleared explicitly. + */ + LOCK_INIT(dbp->handle_lock); + dbp->lid = DB_LOCK_INVALIDID; + } + + /* + * We never opened this dbp for real, so don't call the transactional + * version of DB->close, and use NOSYNC to avoid calling into mpool. + */ + if ((t_ret = dbp->close(dbp, DB_NOSYNC)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} + +/* + * __db_rename + * Rename method for DB. + * + * PUBLIC: int __db_rename __P((DB *, + * PUBLIC: const char *, const char *, const char *, u_int32_t)); + */ +int +__db_rename(dbp, name, subdb, newname, flags) + DB *dbp; + const char *name, *subdb, *newname; + u_int32_t flags; +{ + DB_ENV *dbenv; + int ret, t_ret; + + dbenv = dbp->dbenv; + + PANIC_CHECK(dbenv); + + /* + * Validate arguments, continuing to destroy the handle on failure. + * + * Cannot use DB_ILLEGAL_AFTER_OPEN directly because it returns. + * + * !!! + * We have a serious problem if we're here with a handle used to open + * a database -- we'll destroy the handle, and the application won't + * ever be able to close the database. + */ + if (F_ISSET(dbp, DB_AM_OPEN_CALLED)) { + ret = __db_mi_open(dbenv, "DB->rename", 1); + goto err; + } + + /* Validate arguments. */ + if ((ret = __db_fchk(dbenv, "DB->rename", flags, 0)) != 0) + goto err; + + /* Check for consistent transaction usage. */ + if ((ret = __db_check_txn(dbp, NULL, DB_LOCK_INVALIDID, 0)) != 0) + goto err; + + /* Rename the file. */ + ret = __db_rename_i(dbp, NULL, name, subdb, newname); + + /* + * We never opened this dbp for real, use NOSYNC to avoid calling into + * mpool. + */ +err: if ((t_ret = dbp->close(dbp, DB_NOSYNC)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} + +/* + * __db_rename_i + * Internal rename method for DB. + * + * PUBLIC: int __db_rename_i __P((DB *, + * PUBLIC: DB_TXN *, const char *, const char *, const char *)); + */ +int +__db_rename_i(dbp, txn, name, subdb, newname) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb, *newname; +{ + DB_ENV *dbenv; + int ret; + char *real_name; + + dbenv = dbp->dbenv; + real_name = NULL; + + DB_TEST_RECOVERY(dbp, DB_TEST_PREDESTROY, ret, name); + + if (subdb != NULL) { + ret = __db_subdb_rename(dbp, txn, name, subdb, newname); + goto err; + } + + /* From here on down, this pertains to files. */ + + /* Find the real name of the file. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, name, 0, NULL, &real_name)) != 0) + goto err; + + if ((ret = __fop_remove_setup(dbp, txn, real_name, 0)) != 0) + goto err; + + if (dbp->db_am_rename != NULL && + (ret = dbp->db_am_rename(dbp, txn, name, subdb, newname)) != 0) + goto err; + + /* + * The transactional case and non-transactional case are + * quite different. In the non-transactional case, we simply + * do the rename. In the transactional case, since we need + * the ability to back out and maintain locking, we have to + * create a temporary object as a placeholder. This is all + * taken care of in the fop layer. + */ + if (txn != NULL) { + if ((ret = __fop_dummy(dbp, txn, name, newname, 0)) != 0) + goto err; + } else { + if ((ret = __fop_dbrename(dbp, name, newname)) != 0) + goto err; + } + + /* + * I am pretty sure that we haven't gotten a dbreg id, so calling + * dbreg_filelist_update is not necessary. + */ + DB_ASSERT(dbp->log_filename == NULL || + dbp->log_filename->id == DB_LOGFILEID_INVALID); + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTDESTROY, ret, newname); + +DB_TEST_RECOVERY_LABEL +err: + if (real_name != NULL) + __os_free(dbenv, real_name); + + return (ret); +} + +/* + * __db_subdb_rename -- + * Rename a subdatabase. + */ +static int +__db_subdb_rename(dbp, txn, name, subdb, newname) + DB *dbp; + DB_TXN *txn; + const char *name, *subdb, *newname; +{ + DB *mdbp; + DB_ENV *dbenv; + PAGE *meta; + int ret, t_ret; + + mdbp = NULL; + meta = NULL; + dbenv = dbp->dbenv; + + /* + * We have not opened this dbp so it isn't marked as a subdb, + * but it ought to be. + */ + F_SET(dbp, DB_AM_SUBDB); + + /* + * Rename the entry in the main database. We need to first + * get the meta-data page number (via MU_OPEN) so that we can + * read the meta-data page and obtain a handle lock. Once we've + * done that, we can proceed to do the rename in the master. + */ + if ((ret = __db_master_open(dbp, txn, name, 0, 0, &mdbp)) != 0) + goto err; + + if ((ret = __db_master_update(mdbp, dbp, txn, subdb, dbp->type, + MU_OPEN, NULL, 0)) != 0) + goto err; + + if ((ret = mdbp->mpf->get(mdbp->mpf, &dbp->meta_pgno, 0, &meta)) != 0) + goto err; + memcpy(&dbp->fileid, ((DBMETA *)meta)->uid, DB_FILE_ID_LEN); + if ((ret = __fop_lock_handle(dbenv, + dbp, mdbp->lid, DB_LOCK_WRITE, NULL, 0)) != 0) + goto err; + + ret = mdbp->mpf->put(mdbp->mpf, meta, 0); + meta = NULL; + if (ret != 0) + goto err; + + if ((ret = __db_master_update(mdbp, dbp, txn, + subdb, dbp->type, MU_RENAME, newname, 0)) != 0) + goto err; + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTDESTROY, ret, name); + +DB_TEST_RECOVERY_LABEL +err: + if (meta != NULL && + (t_ret = mdbp->mpf->put(mdbp->mpf, meta, 0)) != 0 && ret == 0) + ret = t_ret; + + if (mdbp != NULL && + (t_ret = __db_close_i(mdbp, txn, 0)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} diff --git a/db/db/db_truncate.c b/db/db/db_truncate.c new file mode 100644 index 000000000..bd0998882 --- /dev/null +++ b/db/db/db_truncate.c @@ -0,0 +1,95 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_truncate.c,v 11.185 2002/08/07 16:16:48 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/btree.h" +#include "dbinc/hash.h" +#include "dbinc/qam.h" + +/* + * __db_truncate + * truncate method for DB. + * + * PUBLIC: int __db_truncate __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); + */ +int +__db_truncate(dbp, txn, countp, flags) + DB *dbp; + DB_TXN *txn; + u_int32_t *countp, flags; +{ + DB_ENV *dbenv; + int ret, t_ret, txn_local; + + dbenv = dbp->dbenv; + ret = txn_local = 0; + + PANIC_CHECK(dbenv); + + /* Check for invalid flags. */ + if ((ret = + __db_fchk(dbenv, "DB->truncate", flags, DB_AUTO_COMMIT)) != 0) + return (ret); + + /* + * Create local transaction as necessary, check for consistent + * transaction usage. + */ + if (IS_AUTO_COMMIT(dbenv, txn, flags)) { + if ((ret = __db_txn_auto(dbp, &txn)) != 0) + return (ret); + txn_local = 1; + } else + if (txn != NULL && !TXN_ON(dbenv)) + return (__db_not_txn_env(dbenv)); + + DB_TEST_RECOVERY(dbp, DB_TEST_PREDESTROY, ret, NULL); + switch (dbp->type) { + case DB_BTREE: + case DB_RECNO: + if ((ret = __bam_truncate(dbp, txn, countp)) != 0) + goto err; + break; + case DB_HASH: + if ((ret = __ham_truncate(dbp, txn, countp)) != 0) + goto err; + break; + case DB_QUEUE: + if ((ret = __qam_truncate(dbp, txn, countp)) != 0) + goto err; + break; + default: + ret = __db_unknown_type( + dbenv, "__db_truncate", dbp->type); + goto err; + } + DB_TEST_RECOVERY(dbp, DB_TEST_POSTDESTROY, ret, NULL); + +DB_TEST_RECOVERY_LABEL +err: + /* Commit for DB_AUTO_COMMIT. */ + if (txn_local) { + if (ret == 0) + ret = txn->commit(txn, 0); + else + if ((t_ret = txn->abort(txn)) != 0) + ret = __db_panic(dbenv, t_ret); + } + + return (ret); +} diff --git a/db/db_printlog/logstat.awk b/db/db_printlog/logstat.awk new file mode 100644 index 000000000..dc9231c9c --- /dev/null +++ b/db/db_printlog/logstat.awk @@ -0,0 +1,36 @@ +# Id: logstat.awk,v 1.1 2002/05/10 15:19:13 bostic Exp +# +# Output accumulated log record count/size statistics. +BEGIN { + l_file = 0; + l_offset = 0; +} + +/^\[/{ + gsub("[][: ]", " ", $1) + split($1, a) + + if (a[1] == l_file) { + l[a[3]] += a[2] - l_offset + ++n[a[3]] + } else + ++s[a[3]] + + l_file = a[1] + l_offset = a[2] +} + +END { + # We can't figure out the size of the first record in each log file, + # use the average for other records we found as an estimate. + for (i in s) + if (s[i] != 0 && n[i] != 0) { + l[i] += s[i] * (l[i]/n[i]) + n[i] += s[i] + delete s[i] + } + for (i in l) + printf "%s: %d (n: %d, avg: %.2f)\n", i, l[i], n[i], l[i]/n[i] + for (i in s) + printf "%s: unknown (n: %d, unknown)\n", i, s[i] +} diff --git a/db/dbinc/btree.h b/db/dbinc/btree.h new file mode 100644 index 000000000..0e0a198ff --- /dev/null +++ b/db/dbinc/btree.h @@ -0,0 +1,320 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995, 1996 + * Keith Bostic. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Mike Olson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Id: btree.h,v 11.45 2002/08/06 06:11:21 bostic Exp + */ +#ifndef _DB_BTREE_H_ +#define _DB_BTREE_H_ + +/* Forward structure declarations. */ +struct __btree; typedef struct __btree BTREE; +struct __cursor; typedef struct __cursor BTREE_CURSOR; +struct __epg; typedef struct __epg EPG; +struct __recno; typedef struct __recno RECNO; + +#define DEFMINKEYPAGE (2) + +/* + * A recno order of 0 indicates that we don't have an order, not that we've + * an order less than 1. + */ +#define INVALID_ORDER 0 + +#define ISINTERNAL(p) (TYPE(p) == P_IBTREE || TYPE(p) == P_IRECNO) +#define ISLEAF(p) (TYPE(p) == P_LBTREE || \ + TYPE(p) == P_LRECNO || TYPE(p) == P_LDUP) + +/* Flags for __bam_cadjust_log(). */ +#define CAD_UPDATEROOT 0x01 /* Root page count was updated. */ + +/* Flags for __bam_split_log(). */ +#define SPL_NRECS 0x01 /* Split tree has record count. */ + +/* Flags for __bam_iitem(). */ +#define BI_DELETED 0x01 /* Key/data pair only placeholder. */ + +/* Flags for __bam_stkrel(). */ +#define STK_CLRDBC 0x01 /* Clear dbc->page reference. */ +#define STK_NOLOCK 0x02 /* Don't retain locks. */ + +/* Flags for __ram_ca(). These get logged, so make the values explicit. */ +typedef enum { + CA_DELETE = 0, /* Delete the current record. */ + CA_IAFTER = 1, /* Insert before the current record. */ + CA_IBEFORE = 2, /* Insert after the current record. */ + CA_ICURRENT = 3 /* Overwrite the current record. */ +} ca_recno_arg; + +/* + * Flags for __bam_search() and __bam_rsearch(). + * + * Note, internal page searches must find the largest record less than key in + * the tree so that descents work. Leaf page searches must find the smallest + * record greater than key so that the returned index is the record's correct + * position for insertion. + * + * The flags parameter to the search routines describes three aspects of the + * search: the type of locking required (including if we're locking a pair of + * pages), the item to return in the presence of duplicates and whether or not + * to return deleted entries. To simplify both the mnemonic representation + * and the code that checks for various cases, we construct a set of bitmasks. + */ +#define S_READ 0x00001 /* Read locks. */ +#define S_WRITE 0x00002 /* Write locks. */ + +#define S_APPEND 0x00040 /* Append to the tree. */ +#define S_DELNO 0x00080 /* Don't return deleted items. */ +#define S_DUPFIRST 0x00100 /* Return first duplicate. */ +#define S_DUPLAST 0x00200 /* Return last duplicate. */ +#define S_EXACT 0x00400 /* Exact items only. */ +#define S_PARENT 0x00800 /* Lock page pair. */ +#define S_STACK 0x01000 /* Need a complete stack. */ +#define S_PAST_EOF 0x02000 /* If doing insert search (or keyfirst + * or keylast operations), or a split + * on behalf of an insert, it's okay to + * return an entry one past end-of-page. + */ +#define S_STK_ONLY 0x04000 /* Just return info in the stack */ + +#define S_DELETE (S_WRITE | S_DUPFIRST | S_DELNO | S_EXACT | S_STACK) +#define S_FIND (S_READ | S_DUPFIRST | S_DELNO) +#define S_FIND_WR (S_WRITE | S_DUPFIRST | S_DELNO) +#define S_INSERT (S_WRITE | S_DUPLAST | S_PAST_EOF | S_STACK) +#define S_KEYFIRST (S_WRITE | S_DUPFIRST | S_PAST_EOF | S_STACK) +#define S_KEYLAST (S_WRITE | S_DUPLAST | S_PAST_EOF | S_STACK) +#define S_WRPAIR (S_WRITE | S_DUPLAST | S_PAST_EOF | S_PARENT) + +/* + * Various routines pass around page references. A page reference is + * a pointer to the page, and the indx indicates an item on the page. + * Each page reference may include a lock. + */ +struct __epg { + PAGE *page; /* The page. */ + db_indx_t indx; /* The index on the page. */ + db_indx_t entries; /* The number of entries on page */ + DB_LOCK lock; /* The page's lock. */ + db_lockmode_t lock_mode; /* The lock mode. */ +}; + +/* + * We maintain a stack of the pages that we're locking in the tree. Grow + * the stack as necessary. + * + * XXX + * Temporary fix for #3243 -- clear the page and lock from the stack entry. + * The correct fix is to never release a stack that doesn't hold items. + */ +#define BT_STK_CLR(c) do { \ + (c)->csp = (c)->sp; \ + (c)->csp->page = NULL; \ + LOCK_INIT((c)->csp->lock); \ +} while (0) + +#define BT_STK_ENTER(dbenv, c, pagep, page_indx, l, mode, ret) do { \ + if ((ret = \ + (c)->csp == (c)->esp ? __bam_stkgrow(dbenv, c) : 0) == 0) { \ + (c)->csp->page = pagep; \ + (c)->csp->indx = page_indx; \ + (c)->csp->entries = NUM_ENT(pagep); \ + (c)->csp->lock = l; \ + (c)->csp->lock_mode = mode; \ + } \ +} while (0) + +#define BT_STK_PUSH(dbenv, c, pagep, page_indx, lock, mode, ret) do { \ + BT_STK_ENTER(dbenv, c, pagep, page_indx, lock, mode, ret); \ + ++(c)->csp; \ +} while (0) + +#define BT_STK_NUM(dbenv, c, pagep, page_indx, ret) do { \ + if ((ret = \ + (c)->csp == (c)->esp ? __bam_stkgrow(dbenv, c) : 0) == 0) { \ + (c)->csp->page = NULL; \ + (c)->csp->indx = page_indx; \ + (c)->csp->entries = NUM_ENT(pagep); \ + LOCK_INIT((c)->csp->lock); \ + (c)->csp->lock_mode = DB_LOCK_NG; \ + } \ +} while (0) + +#define BT_STK_NUMPUSH(dbenv, c, pagep, page_indx, ret) do { \ + BT_STK_NUM(dbenv, cp, pagep, page_indx, ret); \ + ++(c)->csp; \ +} while (0) + +#define BT_STK_POP(c) \ + ((c)->csp == (c)->sp ? NULL : --(c)->csp) + +/* Btree/Recno cursor. */ +struct __cursor { + /* struct __dbc_internal */ + __DBC_INTERNAL + + /* btree private part */ + EPG *sp; /* Stack pointer. */ + EPG *csp; /* Current stack entry. */ + EPG *esp; /* End stack pointer. */ + EPG stack[5]; + + db_indx_t ovflsize; /* Maximum key/data on-page size. */ + + db_recno_t recno; /* Current record number. */ + u_int32_t order; /* Relative order among deleted curs. */ + + /* + * Btree: + * We set a flag in the cursor structure if the underlying object has + * been deleted. It's not strictly necessary, we could get the same + * information by looking at the page itself, but this method doesn't + * require us to retrieve the page on cursor delete. + * + * Recno: + * When renumbering recno databases during deletes, cursors referencing + * "deleted" records end up positioned between two records, and so must + * be specially adjusted on the next operation. + */ +#define C_DELETED 0x0001 /* Record was deleted. */ + /* + * There are three tree types that require maintaining record numbers. + * Recno AM trees, Btree AM trees for which the DB_RECNUM flag was set, + * and Btree off-page duplicate trees. + */ +#define C_RECNUM 0x0002 /* Tree requires record counts. */ + /* + * Recno trees have immutable record numbers by default, but optionally + * support mutable record numbers. Off-page duplicate Recno trees have + * mutable record numbers. All Btrees with record numbers (including + * off-page duplicate trees) are mutable by design, no flag is needed. + */ +#define C_RENUMBER 0x0004 /* Tree records are mutable. */ + u_int32_t flags; +}; + +/* + * Threshhold value, as a function of bt_minkey, of the number of + * bytes a key/data pair can use before being placed on an overflow + * page. Assume every item requires the maximum alignment for + * padding, out of sheer paranoia. + */ +#define B_MINKEY_TO_OVFLSIZE(dbp, minkey, pgsize) \ + ((u_int16_t)(((pgsize) - P_OVERHEAD(dbp)) / ((minkey) * P_INDX) -\ + (BKEYDATA_PSIZE(0) + ALIGN(1, sizeof(int32_t))))) + +/* + * The maximum space that a single item can ever take up on one page. + * Used by __bam_split to determine whether a split is still necessary. + */ +#define B_MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define B_MAXSIZEONPAGE(ovflsize) \ + (B_MAX(BOVERFLOW_PSIZE, BKEYDATA_PSIZE(ovflsize))) + +/* + * The in-memory, per-tree btree/recno data structure. + */ +struct __btree { /* Btree access method. */ + /* + * !!! + * These fields are write-once (when the structure is created) and + * so are ignored as far as multi-threading is concerned. + */ + db_pgno_t bt_meta; /* Database meta-data page. */ + db_pgno_t bt_root; /* Database root page. */ + + u_int32_t bt_maxkey; /* Maximum keys per page. */ + u_int32_t bt_minkey; /* Minimum keys per page. */ + + /* Btree comparison function. */ + int (*bt_compare) __P((DB *, const DBT *, const DBT *)); + /* Btree prefix function. */ + size_t (*bt_prefix) __P((DB *, const DBT *, const DBT *)); + + /* Recno access method. */ + int re_pad; /* Fixed-length padding byte. */ + int re_delim; /* Variable-length delimiting byte. */ + u_int32_t re_len; /* Length for fixed-length records. */ + char *re_source; /* Source file name. */ + + /* + * !!! + * The bt_lpgno field is NOT protected by any mutex, and for this + * reason must be advisory only, so, while it is read/written by + * multiple threads, DB is completely indifferent to the quality + * of its information. + */ + db_pgno_t bt_lpgno; /* Last insert location. */ + + /* + * !!! + * The re_modified field is NOT protected by any mutex, and for this + * reason cannot be anything more complicated than a zero/non-zero + * value. The actual writing of the backing source file cannot be + * threaded, so clearing the flag isn't a problem. + */ + int re_modified; /* If the tree was modified. */ + + /* + * !!! + * These fields are ignored as far as multi-threading is concerned. + * There are no transaction semantics associated with backing files, + * nor is there any thread protection. + */ + FILE *re_fp; /* Source file handle. */ + int re_eof; /* Backing source file EOF reached. */ + db_recno_t re_last; /* Last record number read. */ +}; + +/* + * Modes for the __bam_curadj recovery records (btree_curadj). + * These appear in log records, so we wire the values and + * do not leave it up to the compiler. + */ +typedef enum { + DB_CA_DI = 1, + DB_CA_DUP = 2, + DB_CA_RSPLIT = 3, + DB_CA_SPLIT = 4 +} db_ca_mode; + +#include "dbinc_auto/btree_auto.h" +#include "dbinc_auto/btree_ext.h" +#include "dbinc/db_am.h" +#endif /* !_DB_BTREE_H_ */ diff --git a/db/dbinc/crypto.h b/db/dbinc/crypto.h new file mode 100644 index 000000000..75718a670 --- /dev/null +++ b/db/dbinc/crypto.h @@ -0,0 +1,78 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: crypto.h,v 1.9 2002/08/06 06:37:07 bostic Exp + */ + +#ifndef _DB_CRYPTO_H_ +#define _DB_CRYPTO_H_ + +/* + * !!! + * These are the internal representations of the algorithm flags. + * They are used in both the DB_CIPHER structure and the CIPHER + * structure so we can tell if users specified both passwd and alg + * correctly. + * + * CIPHER_ANY is used when an app joins an existing env but doesn't + * know the algorithm originally used. This is only valid in the + * DB_CIPHER structure until we open and can set the alg. + */ +/* + * We store the algorithm in an 8-bit field on the meta-page. So we + * use a numeric value, not bit fields. + * now we are limited to 8 algorithms before we cannot use bits and + * need numeric values. That should be plenty. It is okay for the + * CIPHER_ANY flag to go beyond that since that is never stored on disk. + */ + +/* + * This structure is per-process, not in shared memory. + */ +struct __db_cipher { + int (*adj_size) __P((size_t)); + int (*close) __P((DB_ENV *, void *)); + int (*decrypt) __P((DB_ENV *, void *, void *, u_int8_t *, size_t)); + int (*encrypt) __P((DB_ENV *, void *, void *, u_int8_t *, size_t)); + int (*init) __P((DB_ENV *, DB_CIPHER *)); + + u_int8_t mac_key[DB_MAC_KEY]; /* MAC key. */ + void *data; /* Algorithm-specific information */ + +#define CIPHER_AES 1 /* AES algorithm */ + u_int8_t alg; /* Algorithm used - See above */ + u_int8_t spare[3]; /* Spares */ + +#define CIPHER_ANY 0x00000001 /* Only for DB_CIPHER */ + u_int32_t flags; /* Other flags */ +}; + +#ifdef HAVE_CRYPTO + +#include "crypto/rijndael/rijndael-api-fst.h" + +/* + * Shared ciphering structure + * No DB_MUTEX needed because all information is read-only after creation. + */ +typedef struct __cipher { + roff_t passwd; /* Offset to shared passwd */ + size_t passwd_len; /* Length of passwd */ + u_int32_t flags; /* Algorithm used - see above */ +} CIPHER; + +#define DB_AES_KEYLEN 128 /* AES key length */ +#define DB_AES_CHUNK 16 /* AES byte unit size */ + +typedef struct __aes_cipher { + keyInstance decrypt_ki; /* Decryption key instance */ + keyInstance encrypt_ki; /* Encryption key instance */ + u_int32_t flags; /* AES-specific flags */ +} AES_CIPHER; + +#include "dbinc_auto/crypto_ext.h" +#endif /* HAVE_CRYPTO */ +#endif /* !_DB_CRYPTO_H_ */ diff --git a/db/dbinc/cxx_common.h b/db/dbinc/cxx_common.h new file mode 100644 index 000000000..6607d543d --- /dev/null +++ b/db/dbinc/cxx_common.h @@ -0,0 +1,45 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: cxx_common.h,v 11.2 2002/01/11 15:52:23 bostic Exp + */ + +#ifndef _CXX_COMMON_H_ +#define _CXX_COMMON_H_ + +// +// Common definitions used by all of Berkeley DB's C++ include files. +// + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Mechanisms for declaring classes +// + +// +// Every class defined in this file has an _exported next to the class name. +// This is needed for WinTel machines so that the class methods can +// be exported or imported in a DLL as appropriate. Users of the DLL +// use the define DB_USE_DLL. When the DLL is built, DB_CREATE_DLL +// must be defined. +// +#if defined(_MSC_VER) + +# if defined(DB_CREATE_DLL) +# define _exported __declspec(dllexport) // creator of dll +# elif defined(DB_USE_DLL) +# define _exported __declspec(dllimport) // user of dll +# else +# define _exported // static lib creator or user +# endif + +#else /* _MSC_VER */ + +# define _exported + +#endif /* _MSC_VER */ +#endif /* !_CXX_COMMON_H_ */ diff --git a/db/dbinc/cxx_except.h b/db/dbinc/cxx_except.h new file mode 100644 index 000000000..fe8d5d962 --- /dev/null +++ b/db/dbinc/cxx_except.h @@ -0,0 +1,141 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: cxx_except.h,v 11.5 2002/08/01 23:32:34 mjc Exp + */ + +#ifndef _CXX_EXCEPT_H_ +#define _CXX_EXCEPT_H_ + +#include "cxx_common.h" + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Forward declarations +// + +class DbDeadlockException; // forward +class DbException; // forward +class DbLockNotGrantedException; // forward +class DbLock; // forward +class DbMemoryException; // forward +class DbRunRecoveryException; // forward +class Dbt; // forward + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Exception classes +// + +// Almost any error in the DB library throws a DbException. +// Every exception should be considered an abnormality +// (e.g. bug, misuse of DB, file system error). +// +// NOTE: We would like to inherit from class exception and +// let it handle what(), but there are +// MSVC++ problems when <exception> is included. +// +class _exported DbException +{ +public: + virtual ~DbException(); + DbException(int err); + DbException(const char *description); + DbException(const char *prefix, int err); + DbException(const char *prefix1, const char *prefix2, int err); + int get_errno() const; + virtual const char *what() const; + + DbException(const DbException &); + DbException &operator = (const DbException &); + +private: + char *what_; + int err_; // errno +}; + +// +// A specific sort of exception that occurs when +// an operation is aborted to resolve a deadlock. +// +class _exported DbDeadlockException : public DbException +{ +public: + virtual ~DbDeadlockException(); + DbDeadlockException(const char *description); + + DbDeadlockException(const DbDeadlockException &); + DbDeadlockException &operator = (const DbDeadlockException &); +}; + +// +// A specific sort of exception that occurs when +// a lock is not granted, e.g. by lock_get or lock_vec. +// Note that the Dbt is only live as long as the Dbt used +// in the offending call. +// +class _exported DbLockNotGrantedException : public DbException +{ +public: + virtual ~DbLockNotGrantedException(); + DbLockNotGrantedException(const char *prefix, db_lockop_t op, + db_lockmode_t mode, const Dbt *obj, const DbLock lock, int index); + DbLockNotGrantedException(const DbLockNotGrantedException &); + DbLockNotGrantedException &operator = + (const DbLockNotGrantedException &); + + db_lockop_t get_op() const; + db_lockmode_t get_mode() const; + const Dbt* get_obj() const; + DbLock *get_lock() const; + int get_index() const; + +private: + db_lockop_t op_; + db_lockmode_t mode_; + const Dbt *obj_; + DbLock *lock_; + int index_; +}; + +// +// A specific sort of exception that occurs when +// user declared memory is insufficient in a Dbt. +// +class _exported DbMemoryException : public DbException +{ +public: + virtual ~DbMemoryException(); + DbMemoryException(Dbt *dbt); + DbMemoryException(const char *description); + DbMemoryException(const char *prefix, Dbt *dbt); + DbMemoryException(const char *prefix1, const char *prefix2, Dbt *dbt); + Dbt *get_dbt() const; + + DbMemoryException(const DbMemoryException &); + DbMemoryException &operator = (const DbMemoryException &); + +private: + Dbt *dbt_; +}; + +// +// A specific sort of exception that occurs when +// recovery is required before continuing DB activity. +// +class _exported DbRunRecoveryException : public DbException +{ +public: + virtual ~DbRunRecoveryException(); + DbRunRecoveryException(const char *description); + + DbRunRecoveryException(const DbRunRecoveryException &); + DbRunRecoveryException &operator = (const DbRunRecoveryException &); +}; + +#endif /* !_CXX_EXCEPT_H_ */ diff --git a/db/dbinc/cxx_int.h b/db/dbinc/cxx_int.h new file mode 100644 index 000000000..ee341dc12 --- /dev/null +++ b/db/dbinc/cxx_int.h @@ -0,0 +1,81 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: cxx_int.h,v 11.20 2002/01/11 15:52:23 bostic Exp + */ + +#ifndef _CXX_INT_H_ +#define _CXX_INT_H_ + +// private data structures known to the implementation only + +// +// Using FooImp classes will allow the implementation to change in the +// future without any modification to user code or even to header files +// that the user includes. FooImp * is just like void * except that it +// provides a little extra protection, since you cannot randomly assign +// any old pointer to a FooImp* as you can with void *. Currently, a +// pointer to such an opaque class is always just a pointer to the +// appropriate underlying implementation struct. These are converted +// back and forth using the various overloaded wrap()/unwrap() methods. +// This is essentially a use of the "Bridge" Design Pattern. +// +// WRAPPED_CLASS implements the appropriate wrap() and unwrap() methods +// for a wrapper class that has an underlying pointer representation. +// +#define WRAPPED_CLASS(_WRAPPER_CLASS, _IMP_CLASS, _WRAPPED_TYPE) \ + \ + class _IMP_CLASS {}; \ + \ + inline _WRAPPED_TYPE unwrap(_WRAPPER_CLASS *val) \ + { \ + if (!val) return (0); \ + return ((_WRAPPED_TYPE)((void *)(val->imp()))); \ + } \ + \ + inline const _WRAPPED_TYPE unwrapConst(const _WRAPPER_CLASS *val) \ + { \ + if (!val) return (0); \ + return ((const _WRAPPED_TYPE)((void *)(val->constimp()))); \ + } \ + \ + inline _IMP_CLASS *wrap(_WRAPPED_TYPE val) \ + { \ + return ((_IMP_CLASS*)((void *)val)); \ + } + +WRAPPED_CLASS(DbMpoolFile, DbMpoolFileImp, DB_MPOOLFILE*) +WRAPPED_CLASS(Db, DbImp, DB*) +WRAPPED_CLASS(DbEnv, DbEnvImp, DB_ENV*) +WRAPPED_CLASS(DbTxn, DbTxnImp, DB_TXN*) + +// A tristate integer value used by the DB_ERROR macro below. +// We chose not to make this an enumerated type so it can +// be kept private, even though methods that return the +// tristate int can be declared in db_cxx.h . +// +#define ON_ERROR_THROW 1 +#define ON_ERROR_RETURN 0 +#define ON_ERROR_UNKNOWN (-1) + +// Macros that handle detected errors, in case we want to +// change the default behavior. The 'policy' is one of +// the tristate values given above. If UNKNOWN is specified, +// the behavior is taken from the last initialized DbEnv. +// +#define DB_ERROR(caller, ecode, policy) \ + DbEnv::runtime_error(caller, ecode, policy) + +#define DB_ERROR_DBT(caller, dbt, policy) \ + DbEnv::runtime_error_dbt(caller, dbt, policy) + +#define DB_OVERFLOWED_DBT(dbt) \ + (F_ISSET(dbt, DB_DBT_USERMEM) && dbt->size > dbt->ulen) + +/* values for Db::flags_ */ +#define DB_CXX_PRIVATE_ENV 0x00000001 + +#endif /* !_CXX_INT_H_ */ diff --git a/db/dbinc/db.in b/db/dbinc/db.in new file mode 100644 index 000000000..b045b795b --- /dev/null +++ b/db/dbinc/db.in @@ -0,0 +1,1906 @@ +/* + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db.in,v 11.321 2002/08/13 20:46:08 ubell Exp + * + * db.h include file layout: + * General. + * Database Environment. + * Locking subsystem. + * Logging subsystem. + * Shared buffer cache (mpool) subsystem. + * Transaction subsystem. + * Access methods. + * Access method cursors. + * Dbm/Ndbm, Hsearch historic interfaces. + */ + +#ifndef _DB_H_ +#define _DB_H_ + +#ifndef __NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stdio.h> +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * 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) || defined(_MSC_VER) +#define __P(protos) protos /* ANSI C prototypes */ +#else +#define const +#define __P(protos) () /* K&R C preprocessor */ +#endif + +/* + * Berkeley DB version information. + */ +#define DB_VERSION_MAJOR @DB_VERSION_MAJOR@ +#define DB_VERSION_MINOR @DB_VERSION_MINOR@ +#define DB_VERSION_PATCH @DB_VERSION_PATCH@ +#define DB_VERSION_STRING @DB_VERSION_STRING@ + +/* + * !!! + * Berkeley DB uses specifically sized types. If they're not provided by + * the system, typedef them here. + * + * We protect them against multiple inclusion using __BIT_TYPES_DEFINED__, + * as does BIND and Kerberos, since we don't know for sure what #include + * files the user is using. + * + * !!! + * We also provide the standard u_int, u_long etc., if they're not provided + * by the system. + */ +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ +@u_int8_decl@ +@int16_decl@ +@u_int16_decl@ +@int32_decl@ +@u_int32_decl@ +#endif + +@u_char_decl@ +@u_short_decl@ +@u_int_decl@ +@u_long_decl@ +@ssize_t_decl@ + +/* Basic types that are exported or quasi-exported. */ +typedef u_int32_t db_pgno_t; /* Page number type. */ +typedef u_int16_t db_indx_t; /* Page offset type. */ +#define DB_MAX_PAGES 0xffffffff /* >= # of pages in a file */ + +typedef u_int32_t db_recno_t; /* Record number type. */ +#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */ + +typedef u_int32_t db_timeout_t; /* Type of a timeout. */ + +/* + * Region offsets are currently limited to 32-bits. I expect that's going + * to have to be fixed in the not-too-distant future, since we won't want to + * split 100Gb memory pools into that many different regions. + */ +typedef u_int32_t roff_t; + +/* + * Forward structure declarations, so we can declare pointers and + * applications can get type checking. + */ +struct __db; typedef struct __db DB; +struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT; +struct __db_cipher; typedef struct __db_cipher DB_CIPHER; +struct __db_dbt; typedef struct __db_dbt DBT; +struct __db_env; typedef struct __db_env DB_ENV; +struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT; +struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK; +struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT; +struct __db_lock_u; typedef struct __db_lock_u DB_LOCK; +struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; +struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC; +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; +struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT; +struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE; +struct __db_preplist; typedef struct __db_preplist DB_PREPLIST; +struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT; +struct __db_rep; typedef struct __db_rep DB_REP; +struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT; +struct __db_txn; typedef struct __db_txn DB_TXN; +struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE; +struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT; +struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR; +struct __dbc; typedef struct __dbc DBC; +struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL; +struct __fh_t; typedef struct __fh_t DB_FH; +struct __fname; typedef struct __fname FNAME; +struct __key_range; typedef struct __key_range DB_KEY_RANGE; +struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; +struct __mutex_t; typedef struct __mutex_t DB_MUTEX; + +/* Key/data structure -- a Data-Base Thang. */ +struct __db_dbt { + /* + * data/size must be fields 1 and 2 for DB 1.85 compatibility. + */ + void *data; /* Key/data */ + u_int32_t size; /* key/data length */ + + u_int32_t ulen; /* RO: length of user buffer. */ + u_int32_t dlen; /* RO: get/put record length. */ + u_int32_t doff; /* RO: get/put record offset. */ + +#define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */ +#define DB_DBT_ISSET 0x002 /* Lower level calls set value. */ +#define DB_DBT_MALLOC 0x004 /* Return in malloc'd memory. */ +#define DB_DBT_PARTIAL 0x008 /* Partial put/get. */ +#define DB_DBT_REALLOC 0x010 /* Return in realloc'd memory. */ +#define DB_DBT_USERMEM 0x020 /* Return in user's memory. */ +#define DB_DBT_DUPOK 0x040 /* Insert if duplicate. */ + u_int32_t flags; +}; + +/* + * Common flags -- + * Interfaces which use any of these common flags should never have + * interface specific flags in this range. + */ +#define DB_CREATE 0x000001 /* Create file as necessary. */ +#define DB_CXX_NO_EXCEPTIONS 0x000002 /* C++: return error values. */ +#define DB_FORCE 0x000004 /* Force (anything). */ +#define DB_NOMMAP 0x000008 /* Don't mmap underlying file. */ +#define DB_RDONLY 0x000010 /* Read-only (O_RDONLY). */ +#define DB_RECOVER 0x000020 /* Run normal recovery. */ +#define DB_THREAD 0x000040 /* Applications are threaded. */ +#define DB_TRUNCATE 0x000080 /* Discard existing DB (O_TRUNC). */ +#define DB_TXN_NOSYNC 0x000100 /* Do not sync log on commit. */ +#define DB_USE_ENVIRON 0x000200 /* Use the environment. */ +#define DB_USE_ENVIRON_ROOT 0x000400 /* Use the environment if root. */ + +/* + * Common flags -- + * Interfaces which use any of these common flags should never have + * interface specific flags in this range. + * + * DB_AUTO_COMMIT: + * DB_ENV->set_flags, DB->associate, DB->del, DB->put, DB->open, + * DB->remove, DB->rename, DB->truncate + * DB_DIRTY_READ: + * DB->cursor, DB->get, DB->join, DB->open, DBcursor->c_get, + * DB_ENV->txn_begin + * + * Shared flags up to 0x000400 */ +#define DB_AUTO_COMMIT 0x00800000 /* Implied transaction. */ +#define DB_DIRTY_READ 0x01000000 /* Dirty Read. */ + +/* + * Flags private to db_env_create. + */ +#define DB_CLIENT 0x000001 /* Open for a client environment. */ + +/* + * Flags private to db_create. + */ +#define DB_XA_CREATE 0x000001 /* Open in an XA environment. */ + +/* + * Flags private to DB_ENV->open. + * Shared flags up to 0x000400 */ +#define DB_INIT_CDB 0x000800 /* Concurrent Access Methods. */ +#define DB_INIT_LOCK 0x001000 /* Initialize locking. */ +#define DB_INIT_LOG 0x002000 /* Initialize logging. */ +#define DB_INIT_MPOOL 0x004000 /* Initialize mpool. */ +#define DB_INIT_TXN 0x008000 /* Initialize transactions. */ +#define DB_JOINENV 0x010000 /* Initialize all subsystems present. */ +#define DB_LOCKDOWN 0x020000 /* Lock memory into physical core. */ +#define DB_PRIVATE 0x040000 /* DB_ENV is process local. */ +#define DB_RECOVER_FATAL 0x080000 /* Run catastrophic recovery. */ +#define DB_SYSTEM_MEM 0x100000 /* Use system-backed memory. */ + +/* + * Flags private to DB->open. + * Shared flags up to 0x000400 */ +#define DB_EXCL 0x000800 /* Exclusive open (O_EXCL). */ +#define DB_FCNTL_LOCKING 0x001000 /* UNDOC: fcntl(2) locking. */ +#define DB_RDWRMASTER 0x002000 /* UNDOC: allow subdb master open R/W */ +#define DB_WRITEOPEN 0x004000 /* UNDOC: open with write lock. */ + +/* + * Flags private to DB_ENV->txn_begin. + * Shared flags up to 0x000400 */ +#define DB_TXN_NOWAIT 0x000800 /* Do not wait for locks in this TXN. */ +#define DB_TXN_SYNC 0x001000 /* Always sync log on commit. */ + +/* + * Flags private to DB_ENV->set_encrypt. + */ +#define DB_ENCRYPT_AES 0x000001 /* AES, assumes SHA1 checksum */ + +/* + * Flags private to DB_ENV->set_flags. + * Shared flags up to 0x000400 */ +#define DB_CDB_ALLDB 0x000800 /* Set CDB locking per environment. */ +#define DB_DIRECT_DB 0x001000 /* Don't buffer databases in the OS. */ +#define DB_DIRECT_LOG 0x002000 /* Don't buffer log files in the OS. */ +#define DB_NOLOCKING 0x004000 /* Set locking/mutex behavior. */ +#define DB_NOPANIC 0x008000 /* Set panic state per DB_ENV. */ +#define DB_OVERWRITE 0x010000 /* Overwrite unlinked region files. */ +#define DB_PANIC_ENVIRONMENT 0x020000 /* Set panic state per environment. */ +#define DB_REGION_INIT 0x040000 /* Page-fault regions on open. */ +#define DB_TXN_WRITE_NOSYNC 0x080000 /* Write, don't sync, on txn commit. */ +#define DB_YIELDCPU 0x100000 /* Yield the CPU (a lot). */ + +/* + * Flags private to DB->set_feedback's callback. + */ +#define DB_UPGRADE 0x000001 /* Upgrading. */ +#define DB_VERIFY 0x000002 /* Verifying. */ + +/* + * Flags private to DB_MPOOLFILE->open. + * Shared flags up to 0x000400 */ +#define DB_DIRECT 0x000800 /* Don't buffer the file in the OS. */ +#define DB_EXTENT 0x001000 /* UNDOC: dealing with an extent. */ +#define DB_ODDFILESIZE 0x002000 /* Truncate file to N * pgsize. */ + +/* + * Flags private to DB->set_flags. + */ +#define DB_CHKSUM_SHA1 0x000001 /* Use SHA1 checksumming */ +#define DB_DUP 0x000002 /* Btree, Hash: duplicate keys. */ +#define DB_DUPSORT 0x000004 /* Btree, Hash: duplicate keys. */ +#define DB_ENCRYPT 0x000008 /* Btree, Hash: duplicate keys. */ +#define DB_RECNUM 0x000010 /* Btree: record numbers. */ +#define DB_RENUMBER 0x000020 /* Recno: renumber on insert/delete. */ +#define DB_REVSPLITOFF 0x000040 /* Btree: turn off reverse splits. */ +#define DB_SNAPSHOT 0x000080 /* Recno: snapshot the input. */ + +/* + * Flags private to the DB->stat methods. + */ +#define DB_STAT_CLEAR 0x000001 /* Clear stat after returning values. */ + +/* + * Flags private to DB->join. + */ +#define DB_JOIN_NOSORT 0x000001 /* Don't try to optimize join. */ + +/* + * Flags private to DB->verify. + */ +#define DB_AGGRESSIVE 0x000001 /* Salvage whatever could be data.*/ +#define DB_NOORDERCHK 0x000002 /* Skip sort order/hashing check. */ +#define DB_ORDERCHKONLY 0x000004 /* Only perform the order check. */ +#define DB_PR_PAGE 0x000008 /* Show page contents (-da). */ +#define DB_PR_RECOVERYTEST 0x000010 /* Recovery test (-dr). */ +#define DB_PRINTABLE 0x000020 /* Use printable format for salvage. */ +#define DB_SALVAGE 0x000040 /* Salvage what looks like data. */ +/* + * !!! + * These must not go over 0x8000, or they will collide with the flags + * used by __bam_vrfy_subtree. + */ + +/* + * Flags private to DB->set_rep_transport's send callback. + */ +#define DB_REP_PERMANENT 0x0001 /* Important--app. may want to flush. */ + +/******************************************************* + * Locking. + *******************************************************/ +#define DB_LOCKVERSION 1 + +#define DB_FILE_ID_LEN 20 /* Unique file ID length. */ + +/* + * Deadlock detector modes; used in the DB_ENV structure to configure the + * locking subsystem. + */ +#define DB_LOCK_NORUN 0 +#define DB_LOCK_DEFAULT 1 /* Default policy. */ +#define DB_LOCK_EXPIRE 2 /* Only expire locks, no detection. */ +#define DB_LOCK_MAXLOCKS 3 /* Abort txn with maximum # of locks. */ +#define DB_LOCK_MINLOCKS 4 /* Abort txn with minimum # of locks. */ +#define DB_LOCK_MINWRITE 5 /* Abort txn with minimum writelocks. */ +#define DB_LOCK_OLDEST 6 /* Abort oldest transaction. */ +#define DB_LOCK_RANDOM 7 /* Abort random transaction. */ +#define DB_LOCK_YOUNGEST 8 /* Abort youngest transaction. */ + +/* Flag values for lock_vec(), lock_get(). */ +#define DB_LOCK_FREE_LOCKER 0x001 /* Internal: Free locker as well. */ +#define DB_LOCK_NOWAIT 0x002 /* Don't wait on unavailable lock. */ +#define DB_LOCK_RECORD 0x004 /* Internal: record lock. */ +#define DB_LOCK_REMOVE 0x008 /* Internal: flag object removed. */ +#define DB_LOCK_SET_TIMEOUT 0x010 /* Internal: set lock timeout. */ +#define DB_LOCK_SWITCH 0x020 /* Internal: switch existing lock. */ +#define DB_LOCK_UPGRADE 0x040 /* Internal: upgrade existing lock. */ + +/* + * Simple R/W lock modes and for multi-granularity intention locking. + * + * !!! + * These values are NOT random, as they are used as an index into the lock + * conflicts arrays, i.e., DB_LOCK_IWRITE must be == 3, and DB_LOCK_IREAD + * must be == 4. + */ +typedef enum { + DB_LOCK_NG=0, /* Not granted. */ + DB_LOCK_READ=1, /* Shared/read. */ + DB_LOCK_WRITE=2, /* Exclusive/write. */ + DB_LOCK_WAIT=3, /* Wait for event */ + DB_LOCK_IWRITE=4, /* Intent exclusive/write. */ + DB_LOCK_IREAD=5, /* Intent to share/read. */ + DB_LOCK_IWR=6, /* Intent to read and write. */ + DB_LOCK_DIRTY=7, /* Dirty Read. */ + DB_LOCK_WWRITE=8 /* Was Written. */ +} db_lockmode_t; + +/* + * Request types. + */ +typedef enum { + DB_LOCK_DUMP=0, /* Display held locks. */ + DB_LOCK_GET=1, /* Get the lock. */ + DB_LOCK_GET_TIMEOUT=2, /* Get lock with a timeout. */ + DB_LOCK_INHERIT=3, /* Pass locks to parent. */ + DB_LOCK_PUT=4, /* Release the lock. */ + DB_LOCK_PUT_ALL=5, /* Release locker's locks. */ + DB_LOCK_PUT_OBJ=6, /* Release locker's locks on obj. */ + DB_LOCK_PUT_READ=7, /* Release locker's read locks. */ + DB_LOCK_TIMEOUT=8, /* Force a txn to timeout. */ + DB_LOCK_TRADE=9, /* Trade locker ids on a lock. */ + DB_LOCK_UPGRADE_WRITE=10 /* Upgrade writes for dirty reads. */ +} db_lockop_t; + +/* + * Status of a lock. + */ +typedef enum { + DB_LSTAT_ABORTED=1, /* Lock belongs to an aborted txn. */ + DB_LSTAT_ERR=2, /* Lock is bad. */ + DB_LSTAT_EXPIRED=3, /* Lock has expired. */ + DB_LSTAT_FREE=4, /* Lock is unallocated. */ + DB_LSTAT_HELD=5, /* Lock is currently held. */ + DB_LSTAT_NOTEXIST=6, /* Object on which lock was waiting + * was removed */ + DB_LSTAT_PENDING=7, /* Lock was waiting and has been + * promoted; waiting for the owner + * to run and upgrade it to held. */ + DB_LSTAT_WAITING=8 /* Lock is on the wait queue. */ +}db_status_t; + +/* Lock statistics structure. */ +struct __db_lock_stat { + u_int32_t st_id; /* Last allocated locker ID. */ + u_int32_t st_cur_maxid; /* Current maximum unused ID. */ + u_int32_t st_maxlocks; /* Maximum number of locks in table. */ + u_int32_t st_maxlockers; /* Maximum num of lockers in table. */ + u_int32_t st_maxobjects; /* Maximum num of objects in table. */ + u_int32_t st_nmodes; /* Number of lock modes. */ + u_int32_t st_nlocks; /* Current number of locks. */ + u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ + u_int32_t st_nlockers; /* Current number of lockers. */ + u_int32_t st_maxnlockers; /* Maximum number of lockers so far. */ + u_int32_t st_nobjects; /* Current number of objects. */ + u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ + u_int32_t st_nconflicts; /* Number of lock conflicts. */ + u_int32_t st_nrequests; /* Number of lock gets. */ + u_int32_t st_nreleases; /* Number of lock puts. */ + u_int32_t st_nnowaits; /* Number of requests that would have + waited, but NOWAIT was set. */ + u_int32_t st_ndeadlocks; /* Number of lock deadlocks. */ + db_timeout_t st_locktimeout; /* Lock timeout. */ + u_int32_t st_nlocktimeouts; /* Number of lock timeouts. */ + db_timeout_t st_txntimeout; /* Transaction timeout. */ + u_int32_t st_ntxntimeouts; /* Number of transaction timeouts. */ + 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_regsize; /* Region size. */ +}; + +/* + * DB_LOCK_ILOCK -- + * Internal DB access method lock. + */ +struct __db_ilock { + db_pgno_t pgno; /* Page being locked. */ + u_int8_t fileid[DB_FILE_ID_LEN];/* File id. */ +#define DB_HANDLE_LOCK 1 +#define DB_RECORD_LOCK 2 +#define DB_PAGE_LOCK 3 +#define DB_TXN_LOCK 4 + u_int32_t type; /* Type of lock. */ +}; + +/* + * DB_LOCK -- + * The structure is allocated by the caller and filled in during a + * lock_get request (or a lock_vec/DB_LOCK_GET). + */ +struct __db_lock_u { + size_t off; /* Offset of the lock in the region */ + u_int32_t ndx; /* Index of the object referenced by + * this lock; used for locking. */ + u_int32_t gen; /* Generation number of this lock. */ + db_lockmode_t mode; /* mode of this lock. */ +}; + +/* Lock request structure. */ +struct __db_lockreq { + db_lockop_t op; /* Operation. */ + db_lockmode_t mode; /* Requested mode. */ + db_timeout_t timeout; /* Time to expire lock. */ + DBT *obj; /* Object being locked. */ + DB_LOCK lock; /* Lock returned. */ +}; + +/******************************************************* + * Logging. + *******************************************************/ +#define DB_LOGVERSION 7 /* Current log version. */ +#define DB_LOGOLDVER 7 /* Oldest log version supported. */ +#define DB_LOGMAGIC 0x040988 + +/* Flag values for log_archive(). */ +#define DB_ARCH_ABS 0x001 /* Absolute pathnames. */ +#define DB_ARCH_DATA 0x002 /* Data files. */ +#define DB_ARCH_LOG 0x004 /* Log files. */ + +/* + * A DB_LSN has two parts, a fileid which identifies a specific file, and an + * offset within that file. The fileid is an unsigned 4-byte quantity that + * uniquely identifies a file within the log directory -- currently a simple + * counter inside the log. The offset is also an unsigned 4-byte value. The + * log manager guarantees the offset is never more than 4 bytes by switching + * to a new log file before the maximum length imposed by an unsigned 4-byte + * offset is reached. + */ +struct __db_lsn { + u_int32_t file; /* File ID. */ + u_int32_t offset; /* File offset. */ +}; + +/* + * DB_LOGC -- + * Log cursor. + */ +struct __db_log_cursor { + DB_ENV *dbenv; /* Enclosing dbenv. */ + + DB_FH *c_fh; /* File handle. */ + DB_LSN c_lsn; /* Cursor: LSN */ + u_int32_t c_len; /* Cursor: record length */ + u_int32_t c_prev; /* Cursor: previous record's offset */ + + DBT c_dbt; /* Return DBT. */ + +#define DB_LOGC_BUF_SIZE (32 * 1024) + u_int8_t *bp; /* Allocated read buffer. */ + u_int32_t bp_size; /* Read buffer length in bytes. */ + u_int32_t bp_rlen; /* Read buffer valid data length. */ + DB_LSN bp_lsn; /* Read buffer first byte LSN. */ + + u_int32_t bp_maxrec; /* Max record length in the log file. */ + + /* Methods. */ + int (*close) __P((DB_LOGC *, u_int32_t)); + int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, u_int32_t)); + +#define DB_LOG_DISK 0x01 /* Log record came from disk. */ +#define DB_LOG_LOCKED 0x02 /* Log region already locked */ +#define DB_LOG_SILENT_ERR 0x04 /* Turn-off error messages. */ + u_int32_t flags; +}; + +/* 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_bsize; /* Log buffer size. */ + u_int32_t st_lg_size; /* 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 writes to the log. */ + u_int32_t st_wcount_fill; /* Overflow writes to the log. */ + u_int32_t st_scount; /* Total syncs 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. */ + u_int32_t st_disk_file; /* Known on disk log file number. */ + u_int32_t st_disk_offset; /* Known on disk log file offset. */ + u_int32_t st_regsize; /* Region size. */ + u_int32_t st_maxcommitperflush; /* Max number of commits in a flush. */ + u_int32_t st_mincommitperflush; /* Min number of commits in a flush. */ +}; + +/******************************************************* + * Shared buffer cache (mpool). + *******************************************************/ +/* Flag values for DB_MPOOLFILE->get. */ +#define DB_MPOOL_CREATE 0x001 /* Create a page. */ +#define DB_MPOOL_LAST 0x002 /* Return the last page. */ +#define DB_MPOOL_NEW 0x004 /* Create a new page. */ + +/* Flag values for DB_MPOOLFILE->put, DB_MPOOLFILE->set. */ +#define DB_MPOOL_CLEAN 0x001 /* Page is not modified. */ +#define DB_MPOOL_DIRTY 0x002 /* Page is modified. */ +#define DB_MPOOL_DISCARD 0x004 /* Don't cache the page. */ + +/* Priority values for DB_MPOOLFILE->set_priority. */ +typedef enum { + DB_PRIORITY_VERY_LOW=1, + DB_PRIORITY_LOW=2, + DB_PRIORITY_DEFAULT=3, + DB_PRIORITY_HIGH=4, + DB_PRIORITY_VERY_HIGH=5 +} DB_CACHE_PRIORITY; + +/* Per-process DB_MPOOLFILE information. */ +struct __db_mpoolfile { + /* These fields need to be protected for multi-threaded support. */ + DB_MUTEX *mutexp; /* Structure thread lock. */ + + DB_FH *fhp; /* Underlying file handle. */ + + u_int32_t ref; /* Reference count. */ + + /* + * !!! + * The pinref and q fields are protected by the region lock, not the + * DB_MPOOLFILE structure mutex. We don't use the structure mutex + * because then I/O (which holds the structure lock held because of + * the race between the seek and write of the file descriptor) would + * block any other put/get calls using this DB_MPOOLFILE structure. + */ + u_int32_t pinref; /* Pinned block reference count. */ + + /* + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_ENTRY(__db_mpoolfile) q; + */ + struct { + struct __db_mpoolfile *tqe_next; + struct __db_mpoolfile **tqe_prev; + } q; /* Linked list of DB_MPOOLFILE's. */ + + /* + * These fields are not thread-protected because they are initialized + * when the file is opened and never modified. + */ + int ftype; /* File type. */ + DBT *pgcookie; /* Byte-string passed to pgin/pgout. */ + u_int8_t *fileid; /* Unique file ID. */ + int32_t lsn_offset; /* LSN offset in page. */ + u_int32_t clear_len; /* Cleared length on created pages. */ + + DB_MPOOL *dbmp; /* Overlying DB_MPOOL. */ + MPOOLFILE *mfp; /* Underlying MPOOLFILE. */ + + void *addr; /* Address of mmap'd region. */ + size_t len; /* Length of mmap'd region. */ + + /* Methods. */ + int (*close) __P((DB_MPOOLFILE *, u_int32_t)); + int (*get) __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *)); + void (*get_fileid) __P((DB_MPOOLFILE *, u_int8_t *)); + void (*last_pgno) __P((DB_MPOOLFILE *, db_pgno_t *)); + int (*open)__P((DB_MPOOLFILE *, const char *, u_int32_t, int, size_t)); + int (*put) __P((DB_MPOOLFILE *, void *, u_int32_t)); + void (*refcnt) __P((DB_MPOOLFILE *, db_pgno_t *)); + int (*set) __P((DB_MPOOLFILE *, void *, u_int32_t)); + int (*set_clear_len) __P((DB_MPOOLFILE *, u_int32_t)); + int (*set_fileid) __P((DB_MPOOLFILE *, u_int8_t *)); + int (*set_ftype) __P((DB_MPOOLFILE *, int)); + int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t)); + int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *)); + int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY)); + void (*set_unlink) __P((DB_MPOOLFILE *, int)); + int (*sync) __P((DB_MPOOLFILE *)); + + /* + * MP_OPEN_CALLED and MP_READONLY do not need to be thread protected + * because they are initialized when the file is opened, and never + * modified. + * + * MP_FLUSH, MP_UPGRADE and MP_UPGRADE_FAIL are thread protected + * becase they are potentially read by multiple threads of control. + */ +#define MP_FLUSH 0x001 /* Was opened to flush a buffer. */ +#define MP_OPEN_CALLED 0x002 /* File opened. */ +#define MP_READONLY 0x004 /* File is readonly. */ +#define MP_UPGRADE 0x008 /* File descriptor is readwrite. */ +#define MP_UPGRADE_FAIL 0x010 /* Upgrade wasn't possible. */ + u_int32_t flags; +}; + +/* + * Mpool statistics structure. + */ +struct __db_mpool_stat { + u_int32_t st_gbytes; /* Total cache size: GB. */ + u_int32_t st_bytes; /* Total cache size: B. */ + u_int32_t st_ncache; /* Number of caches. */ + u_int32_t st_regsize; /* Cache size. */ + u_int32_t st_map; /* Pages from mapped files. */ + 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_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_page_trickle; /* Pages written by memp_trickle. */ + u_int32_t st_pages; /* Total number of pages. */ + u_int32_t st_page_clean; /* Clean pages. */ + u_int32_t st_page_dirty; /* Dirty pages. */ + 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_hash_nowait; /* Hash lock granted with nowait. */ + u_int32_t st_hash_wait; /* Hash lock granted after wait. */ + u_int32_t st_hash_max_wait; /* Max hash lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted with nowait. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_alloc; /* Number of page allocations. */ + u_int32_t st_alloc_buckets; /* Buckets checked during allocation. */ + u_int32_t st_alloc_max_buckets; /* Max checked during allocation. */ + u_int32_t st_alloc_pages; /* Pages checked during allocation. */ + u_int32_t st_alloc_max_pages; /* Max checked during allocation. */ +}; + +/* Mpool file statistics structure. */ +struct __db_mpool_fstat { + char *file_name; /* File name. */ + size_t st_pagesize; /* Page size. */ + u_int32_t st_map; /* Pages from mapped files. */ + 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_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. */ +}; + +/******************************************************* + * Transactions and recovery. + *******************************************************/ +#define DB_TXNVERSION 1 + +typedef enum { + DB_TXN_ABORT=0, /* Public. */ + DB_TXN_APPLY=1, /* Public. */ + DB_TXN_BACKWARD_ALLOC=2, /* Internal. */ + DB_TXN_BACKWARD_ROLL=3, /* Public. */ + DB_TXN_FORWARD_ROLL=4, /* Public. */ + DB_TXN_GETPGNOS=5, /* Internal. */ + DB_TXN_OPENFILES=6, /* Internal. */ + DB_TXN_POPENFILES=7, /* Internal. */ + DB_TXN_PRINT=8 /* Public. */ +} db_recops; + +/* + * BACKWARD_ALLOC is used during the forward pass to pick up any aborted + * allocations for files that were created during the forward pass. + * The main difference between _ALLOC and _ROLL is that the entry for + * the file not exist during the rollforward pass. + */ +#define DB_UNDO(op) ((op) == DB_TXN_ABORT || \ + (op) == DB_TXN_BACKWARD_ROLL || (op) == DB_TXN_BACKWARD_ALLOC) +#define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY) + +struct __db_txn { + DB_TXNMGR *mgrp; /* Pointer to transaction manager. */ + DB_TXN *parent; /* Pointer to transaction's parent. */ + DB_LSN last_lsn; /* Lsn of last log write. */ + u_int32_t txnid; /* Unique transaction id. */ + roff_t off; /* Detail structure within region. */ + db_timeout_t lock_timeout; /* Timeout for locks for this txn. */ + db_timeout_t expire; /* Time this txn expires. */ + void *txn_list; /* Undo information for parent. */ + + /* + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_ENTRY(__db_txn) links; + */ + struct { + struct __db_txn *tqe_next; + struct __db_txn **tqe_prev; + } links; /* Links transactions off manager. */ + + /* + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_HEAD(__events, __txn_event) events; + */ + struct { + struct __txn_event *tqh_first; + struct __txn_event **tqh_last; + } events; + + /* + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_HEAD(__kids, __db_txn) kids; + */ + struct __kids { + struct __db_txn *tqh_first; + struct __db_txn **tqh_last; + } kids; + + /* + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_ENTRY(__db_txn) klinks; + */ + struct { + struct __db_txn *tqe_next; + struct __db_txn **tqe_prev; + } klinks; + + /* + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_ENTRY(__db_txn) xalinks; + */ + struct { + struct __db_txn *tqe_next; + struct __db_txn **tqe_prev; + } xalinks; + void *xa_thread_id; + + /* API-private structure: used by C++ */ + void *api_internal; + + u_int32_t cursors; /* Number of cursors open for txn */ + + /* Methods. */ + int (*abort) __P((DB_TXN *)); + int (*commit) __P((DB_TXN *, u_int32_t)); + int (*discard) __P((DB_TXN *, u_int32_t)); + u_int32_t (*id) __P((DB_TXN *)); + int (*prepare) __P((DB_TXN *, u_int8_t *)); + int (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t)); + +#define TXN_CHILDCOMMIT 0x01 /* Transaction that has committed. */ +#define TXN_COMPENSATE 0x02 /* Compensating transaction. */ +#define TXN_DIRTY_READ 0x04 /* Transaction does dirty reads. */ +#define TXN_LOCKTIMEOUT 0x08 /* Transaction has a lock timeout. */ +#define TXN_MALLOC 0x10 /* Structure allocated by TXN system. */ +#define TXN_NOSYNC 0x20 /* Do not sync on prepare and commit. */ +#define TXN_NOWAIT 0x40 /* Do not wait on locks. */ +#define TXN_SYNC 0x80 /* Sync on prepare and commit. */ + u_int32_t flags; +}; + +/* Transaction statistics structure. */ +struct __db_txn_active { + u_int32_t txnid; /* Transaction ID */ + u_int32_t parentid; /* Transaction ID of parent */ + DB_LSN lsn; /* LSN when transaction began */ +}; + +struct __db_txn_stat { + DB_LSN st_last_ckp; /* lsn of the last checkpoint */ + time_t st_time_ckp; /* time of last checkpoint */ + u_int32_t st_last_txnid; /* last transaction id given out */ + u_int32_t st_maxtxns; /* maximum txns possible */ + u_int32_t st_naborts; /* number of aborted transactions */ + u_int32_t st_nbegins; /* number of begun transactions */ + u_int32_t st_ncommits; /* number of committed transactions */ + u_int32_t st_nactive; /* number of active transactions */ + u_int32_t st_nrestores; /* number of restored transactions + after recovery. */ + u_int32_t st_maxnactive; /* maximum active transactions */ + DB_TXN_ACTIVE *st_txnarray; /* array of active transactions */ + 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_regsize; /* Region size. */ +}; + +/* + * Structure used for two phase commit interface. Berkeley DB support for two + * phase commit is compatible with the X/open XA interface. The xa #define + * XIDDATASIZE defines the size of a global transaction ID. We have our own + * version here which must have the same value. + */ +#define DB_XIDDATASIZE 128 +struct __db_preplist { + DB_TXN *txn; + u_int8_t gid[DB_XIDDATASIZE]; +}; + +/******************************************************* + * Replication. + *******************************************************/ +/* Special, out-of-band environment IDs. */ +#define DB_EID_BROADCAST -1 +#define DB_EID_INVALID -2 + +/* rep_start flags values */ +#define DB_REP_CLIENT 0x001 +#define DB_REP_LOGSONLY 0x002 +#define DB_REP_MASTER 0x004 + +/* Replication statistics. */ +struct __db_rep_stat { + /* !!! + * Many replication statistics fields cannot be protected by a mutex + * without an unacceptable performance penalty, since most message + * processing is done without the need to hold a region-wide lock. + * Fields whose comments end with a '+' may be updated without holding + * the replication or log mutexes (as appropriate), and thus may be + * off somewhat (or, on unreasonable architectures under unlucky + * circumstances, garbaged). + */ + u_int32_t st_status; /* Current replication status. */ + DB_LSN st_next_lsn; /* Next LSN to use or expect. */ + DB_LSN st_waiting_lsn; /* LSN we're awaiting, if any. */ + + u_int32_t st_dupmasters; /* # of times a duplicate master + condition was detected.+ */ + int st_env_id; /* Current environment ID. */ + int st_env_priority; /* Current environment priority. */ + u_int32_t st_gen; /* Current generation number. */ + u_int32_t st_log_duplicated; /* Log records received multiply.+ */ + u_int32_t st_log_queued; /* Log records currently queued.+ */ + u_int32_t st_log_queued_max; /* Max. log records queued at once.+ */ + u_int32_t st_log_queued_total; /* Total # of log recs. ever queued.+ */ + u_int32_t st_log_records; /* Log records received and put.+ */ + u_int32_t st_log_requested; /* Log recs. missed and requested.+ */ + int st_master; /* Env. ID of the current master. */ + u_int32_t st_master_changes; /* # of times we've switched masters. */ + u_int32_t st_msgs_badgen; /* Messages with a bad generation #.+ */ + u_int32_t st_msgs_processed; /* Messages received and processed.+ */ + u_int32_t st_msgs_recover; /* Messages ignored because this site + was a client in recovery.+ */ + u_int32_t st_msgs_send_failures;/* # of failed message sends.+ */ + u_int32_t st_msgs_sent; /* # of successful message sends.+ */ + u_int32_t st_newsites; /* # of NEWSITE msgs. received.+ */ + int st_nsites; /* Current number of sites we will + assume during elections. */ + u_int32_t st_nthrottles; /* # of times we were throttled. */ + u_int32_t st_outdated; /* # of times we detected and returned + an OUTDATED condition.+ */ + u_int32_t st_txns_applied; /* # of transactions applied.+ */ + + /* Elections generally. */ + u_int32_t st_elections; /* # of elections held.+ */ + u_int32_t st_elections_won; /* # of elections won by this site.+ */ + + /* Statistics about an in-progress election. */ + int st_election_cur_winner; /* Current front-runner. */ + u_int32_t st_election_gen; /* Election generation number. */ + DB_LSN st_election_lsn; /* Max. LSN of current winner. */ + int st_election_nsites; /* # of "registered voters". */ + int st_election_priority; /* Current election priority. */ + int st_election_status; /* Current election status. */ + int st_election_tiebreaker; /* Election tiebreaker value. */ + int st_election_votes; /* Votes received in this round. */ +}; + +/******************************************************* + * Access methods. + *******************************************************/ +typedef enum { + DB_BTREE=1, + DB_HASH=2, + DB_RECNO=3, + DB_QUEUE=4, + DB_UNKNOWN=5 /* Figure it out on open. */ +} DBTYPE; + +#define DB_RENAMEMAGIC 0x030800 /* File has been renamed. */ + +#define DB_BTREEVERSION 9 /* Current btree version. */ +#define DB_BTREEOLDVER 6 /* Oldest btree version supported. */ +#define DB_BTREEMAGIC 0x053162 + +#define DB_HASHVERSION 8 /* Current hash version. */ +#define DB_HASHOLDVER 4 /* Oldest hash version supported. */ +#define DB_HASHMAGIC 0x061561 + +#define DB_QAMVERSION 4 /* Current queue version. */ +#define DB_QAMOLDVER 1 /* Oldest queue version supported. */ +#define DB_QAMMAGIC 0x042253 + +/* + * DB access method and cursor operation values. Each value is an operation + * code to which additional bit flags are added. + */ +#define DB_AFTER 1 /* c_put() */ +#define DB_APPEND 2 /* put() */ +#define DB_BEFORE 3 /* c_put() */ +#define DB_CACHED_COUNTS 4 /* stat() */ +#define DB_COMMIT 5 /* log_put() (internal) */ +#define DB_CONSUME 6 /* get() */ +#define DB_CONSUME_WAIT 7 /* get() */ +#define DB_CURRENT 8 /* c_get(), c_put(), DB_LOGC->get() */ +#define DB_FAST_STAT 9 /* stat() */ +#define DB_FIRST 10 /* c_get(), DB_LOGC->get() */ +#define DB_GET_BOTH 11 /* get(), c_get() */ +#define DB_GET_BOTHC 12 /* c_get() (internal) */ +#define DB_GET_BOTH_RANGE 13 /* get(), c_get() */ +#define DB_GET_RECNO 14 /* c_get() */ +#define DB_JOIN_ITEM 15 /* c_get(); do not do primary lookup */ +#define DB_KEYFIRST 16 /* c_put() */ +#define DB_KEYLAST 17 /* c_put() */ +#define DB_LAST 18 /* c_get(), DB_LOGC->get() */ +#define DB_NEXT 19 /* c_get(), DB_LOGC->get() */ +#define DB_NEXT_DUP 20 /* c_get() */ +#define DB_NEXT_NODUP 21 /* c_get() */ +#define DB_NODUPDATA 22 /* put(), c_put() */ +#define DB_NOOVERWRITE 23 /* put() */ +#define DB_NOSYNC 24 /* close() */ +#define DB_POSITION 25 /* c_dup() */ +#define DB_POSITIONI 26 /* c_dup() (internal) */ +#define DB_PREV 27 /* c_get(), DB_LOGC->get() */ +#define DB_PREV_NODUP 28 /* c_get(), DB_LOGC->get() */ +#define DB_RECORDCOUNT 29 /* stat() */ +#define DB_SET 30 /* c_get(), DB_LOGC->get() */ +#define DB_SET_LOCK_TIMEOUT 31 /* set_timout() */ +#define DB_SET_RANGE 32 /* c_get() */ +#define DB_SET_RECNO 33 /* get(), c_get() */ +#define DB_SET_TXN_NOW 34 /* set_timout() (internal) */ +#define DB_SET_TXN_TIMEOUT 35 /* set_timout() */ +#define DB_UPDATE_SECONDARY 36 /* c_get(), c_del() (internal) */ +#define DB_WRITECURSOR 37 /* cursor() */ +#define DB_WRITELOCK 38 /* cursor() (internal) */ + +/* This has to change when the max opcode hits 255. */ +#define DB_OPFLAGS_MASK 0x000000ff /* Mask for operations flags. */ +/* DB_DIRTY_READ 0x01000000 Dirty Read. */ +#define DB_FLUSH 0x02000000 /* Flush data to disk. */ +#define DB_MULTIPLE 0x04000000 /* Return multiple data values. */ +#define DB_MULTIPLE_KEY 0x08000000 /* Return multiple data/key pairs. */ +#define DB_NOCOPY 0x10000000 /* Don't copy data */ +#define DB_PERMANENT 0x20000000 /* Flag record with REP_PERMANENT. */ +#define DB_RMW 0x40000000 /* Acquire write flag immediately. */ +#define DB_WRNOSYNC 0x80000000 /* Private: write, don't sync log_put */ + +/* + * DB (user visible) error return codes. + * + * !!! + * For source compatibility with DB 2.X deadlock return (EAGAIN), use the + * following: + * #include <errno.h> + * #define DB_LOCK_DEADLOCK EAGAIN + * + * !!! + * We don't want our error returns to conflict with other packages where + * possible, so pick a base error value that's hopefully not common. We + * document that we own the error name space from -30,800 to -30,999. + */ +/* DB (public) error return codes. */ +#define DB_DONOTINDEX (-30999)/* "Null" return from 2ndary callbk. */ +#define DB_KEYEMPTY (-30998)/* Key/data deleted or never created. */ +#define DB_KEYEXIST (-30997)/* The key/data pair already exists. */ +#define DB_LOCK_DEADLOCK (-30996)/* Deadlock. */ +#define DB_LOCK_NOTGRANTED (-30995)/* Lock unavailable. */ +#define DB_NOSERVER (-30994)/* Server panic return. */ +#define DB_NOSERVER_HOME (-30993)/* Bad home sent to server. */ +#define DB_NOSERVER_ID (-30992)/* Bad ID sent to server. */ +#define DB_NOTFOUND (-30991)/* Key/data pair not found (EOF). */ +#define DB_OLD_VERSION (-30990)/* Out-of-date version. */ +#define DB_PAGE_NOTFOUND (-30989)/* Requested page not found. */ +#define DB_REP_DUPMASTER (-30988)/* There are two masters. */ +#define DB_REP_HOLDELECTION (-30987)/* Time to hold an election. */ +#define DB_REP_NEWMASTER (-30986)/* We have learned of a new master. */ +#define DB_REP_NEWSITE (-30985)/* New site entered system. */ +#define DB_REP_OUTDATED (-30984)/* Site is too far behind master. */ +#define DB_REP_UNAVAIL (-30983)/* Site cannot currently be reached. */ +#define DB_RUNRECOVERY (-30982)/* Panic return. */ +#define DB_SECONDARY_BAD (-30981)/* Secondary index corrupt. */ +#define DB_VERIFY_BAD (-30980)/* Verify failed; bad format. */ + +/* DB (private) error return codes. */ +#define DB_ALREADY_ABORTED (-30899) +#define DB_DELETED (-30898)/* Recovery file marked deleted. */ +#define DB_JAVA_CALLBACK (-30897)/* Exception during a java callback. */ +#define DB_LOCK_NOTEXIST (-30896)/* Object to lock is gone. */ +#define DB_NEEDSPLIT (-30895)/* Page needs to be split. */ +#define DB_SURPRISE_KID (-30894)/* Child commit where parent + didn't know it was a parent. */ +#define DB_SWAPBYTES (-30893)/* Database needs byte swapping. */ +#define DB_TIMEOUT (-30892)/* Timed out waiting for election. */ +#define DB_TXN_CKP (-30891)/* Encountered ckp record in log. */ +#define DB_VERIFY_FATAL (-30890)/* DB->verify cannot proceed. */ + +/* Database handle. */ +struct __db { + /******************************************************* + * Public: owned by the application. + *******************************************************/ + u_int32_t pgsize; /* Database logical page size. */ + + /* Callbacks. */ + int (*db_append_recno) __P((DB *, DBT *, db_recno_t)); + void (*db_feedback) __P((DB *, int, int)); + int (*dup_compare) __P((DB *, const DBT *, const DBT *)); + + void *app_private; /* Application-private handle. */ + + /******************************************************* + * Private: owned by DB. + *******************************************************/ + DB_ENV *dbenv; /* Backing environment. */ + + DBTYPE type; /* DB access method type. */ + + DB_MPOOLFILE *mpf; /* Backing buffer pool. */ + DB_CACHE_PRIORITY priority; /* Priority in the buffer pool. */ + + DB_MUTEX *mutexp; /* Synchronization for free threading */ + + u_int8_t fileid[DB_FILE_ID_LEN];/* File's unique ID for locking. */ + + u_int32_t adj_fileid; /* File's unique ID for curs. adj. */ + +#define DB_LOGFILEID_INVALID -1 + FNAME *log_filename; /* File's naming info for logging. */ + + db_pgno_t meta_pgno; /* Meta page number */ + u_int32_t lid; /* Locker id for handle locking. */ + u_int32_t cur_lid; /* Current handle lock holder. */ + u_int32_t associate_lid; /* Locker id for DB->associate call. */ + DB_LOCK handle_lock; /* Lock held on this handle. */ + + long cl_id; /* RPC: remote client id. */ + + /* + * Returned data memory for DB->get() and friends. + */ + DBT my_rskey; /* Secondary key. */ + DBT my_rkey; /* [Primary] key. */ + DBT my_rdata; /* Data. */ + + /* + * !!! + * Some applications use DB but implement their own locking outside of + * DB. If they're using fcntl(2) locking on the underlying database + * file, and we open and close a file descriptor for that file, we will + * discard their locks. The DB_FCNTL_LOCKING flag to DB->open is an + * undocumented interface to support this usage which leaves any file + * descriptors we open until DB->close. This will only work with the + * DB->open interface and simple caches, e.g., creating a transaction + * thread may open/close file descriptors this flag doesn't protect. + * Locking with fcntl(2) on a file that you don't own is a very, very + * unsafe thing to do. 'Nuff said. + */ + DB_FH *saved_open_fhp; /* Saved file handle. */ + + /* + * Linked list of DBP's, linked from the DB_ENV, used to keep track + * of all open db handles for cursor adjustment. + * + * !!! + * Explicit representations of structures from queue.h. + * LIST_ENTRY(__db) dblistlinks; + */ + struct { + struct __db *le_next; + struct __db **le_prev; + } dblistlinks; + + /* + * Cursor queues. + * + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_HEAD(__cq_fq, __dbc) free_queue; + * TAILQ_HEAD(__cq_aq, __dbc) active_queue; + * TAILQ_HEAD(__cq_jq, __dbc) join_queue; + */ + struct __cq_fq { + struct __dbc *tqh_first; + struct __dbc **tqh_last; + } free_queue; + struct __cq_aq { + struct __dbc *tqh_first; + struct __dbc **tqh_last; + } active_queue; + struct __cq_jq { + struct __dbc *tqh_first; + struct __dbc **tqh_last; + } join_queue; + + /* + * Secondary index support. + * + * Linked list of secondary indices -- set in the primary. + * + * !!! + * Explicit representations of structures from queue.h. + * LIST_HEAD(s_secondaries, __db); + */ + struct { + struct __db *lh_first; + } s_secondaries; + + /* + * List entries for secondaries, and reference count of how + * many threads are updating this secondary (see __db_c_put). + * + * !!! + * Note that these are synchronized by the primary's mutex, but + * filled in in the secondaries. + * + * !!! + * Explicit representations of structures from queue.h. + * LIST_ENTRY(__db) s_links; + */ + struct { + struct __db *le_next; + struct __db **le_prev; + } s_links; + u_int32_t s_refcnt; + + /* Secondary callback and free functions -- set in the secondary. */ + int (*s_callback) __P((DB *, const DBT *, const DBT *, DBT *)); + + /* Reference to primary -- set in the secondary. */ + DB *s_primary; + + /* API-private structure: used by DB 1.85, C++, Java, Perl and Tcl */ + void *api_internal; + + /* Subsystem-private structure. */ + void *bt_internal; /* Btree/Recno access method. */ + void *h_internal; /* Hash access method. */ + void *q_internal; /* Queue access method. */ + void *xa_internal; /* XA. */ + + /* Methods. */ + int (*associate) __P((DB *, DB_TXN *, DB *, int (*)(DB *, const DBT *, + const DBT *, DBT *), u_int32_t)); + int (*close) __P((DB *, u_int32_t)); + int (*cursor) __P((DB *, DB_TXN *, DBC **, u_int32_t)); + int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); + void (*err) __P((DB *, int, const char *, ...)); + void (*errx) __P((DB *, const char *, ...)); + int (*fd) __P((DB *, int *)); + int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*pget) __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t)); + int (*get_byteswapped) __P((DB *, int *)); + int (*get_type) __P((DB *, DBTYPE *)); + int (*join) __P((DB *, DBC **, DBC **, u_int32_t)); + int (*key_range) __P((DB *, + DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t)); + int (*open) __P((DB *, DB_TXN *, + const char *, const char *, DBTYPE, u_int32_t, int)); + int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*remove) __P((DB *, const char *, const char *, u_int32_t)); + int (*rename) __P((DB *, + const char *, const char *, const char *, u_int32_t)); + int (*truncate) __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); + int (*set_append_recno) __P((DB *, int (*)(DB *, DBT *, db_recno_t))); + int (*set_alloc) __P((DB *, void *(*)(size_t), + void *(*)(void *, size_t), void (*)(void *))); + int (*set_cachesize) __P((DB *, u_int32_t, u_int32_t, int)); + int (*set_cache_priority) __P((DB *, DB_CACHE_PRIORITY)); + int (*set_dup_compare) __P((DB *, + int (*)(DB *, const DBT *, const DBT *))); + int (*set_encrypt) __P((DB *, const char *, u_int32_t)); + void (*set_errcall) __P((DB *, void (*)(const char *, char *))); + void (*set_errfile) __P((DB *, FILE *)); + void (*set_errpfx) __P((DB *, const char *)); + int (*set_feedback) __P((DB *, void (*)(DB *, int, int))); + int (*set_flags) __P((DB *, u_int32_t)); + int (*set_lorder) __P((DB *, int)); + int (*set_pagesize) __P((DB *, u_int32_t)); + int (*set_paniccall) __P((DB *, void (*)(DB_ENV *, int))); + int (*stat) __P((DB *, void *, u_int32_t)); + int (*sync) __P((DB *, u_int32_t)); + int (*upgrade) __P((DB *, const char *, u_int32_t)); + int (*verify) __P((DB *, + const char *, const char *, FILE *, u_int32_t)); + + int (*set_bt_compare) __P((DB *, + int (*)(DB *, const DBT *, const DBT *))); + int (*set_bt_maxkey) __P((DB *, u_int32_t)); + int (*set_bt_minkey) __P((DB *, u_int32_t)); + int (*set_bt_prefix) __P((DB *, + size_t (*)(DB *, const DBT *, const DBT *))); + + int (*set_h_ffactor) __P((DB *, u_int32_t)); + int (*set_h_hash) __P((DB *, + u_int32_t (*)(DB *, const void *, u_int32_t))); + int (*set_h_nelem) __P((DB *, u_int32_t)); + + int (*set_re_delim) __P((DB *, int)); + int (*set_re_len) __P((DB *, u_int32_t)); + int (*set_re_pad) __P((DB *, int)); + int (*set_re_source) __P((DB *, const char *)); + int (*set_q_extentsize) __P((DB *, u_int32_t)); + + int (*db_am_remove) __P((DB *, + DB_TXN *, const char *, const char *, DB_LSN *)); + int (*db_am_rename) __P((DB *, DB_TXN *, + const char *, const char *, const char *)); + + /* + * Never called; these are a place to save function pointers + * so that we can undo an associate. + */ + int (*stored_get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*stored_close) __P((DB *, u_int32_t)); + +#define DB_OK_BTREE 0x01 +#define DB_OK_HASH 0x02 +#define DB_OK_QUEUE 0x04 +#define DB_OK_RECNO 0x08 + u_int32_t am_ok; /* Legal AM choices. */ + +#define DB_AM_CHKSUM 0x00000001 /* Checksumming. */ +#define DB_AM_CL_WRITER 0x00000002 /* Allow writes in client replica. */ +#define DB_AM_COMPENSATE 0x00000004 /* Created by compensating txn. */ +#define DB_AM_CREATED 0x00000008 /* Database was created upon open. */ +#define DB_AM_CREATED_MSTR 0x00000010 /* Encompassing file was created. */ +#define DB_AM_DBM_ERROR 0x00000020 /* Error in DBM/NDBM database. */ +#define DB_AM_DELIMITER 0x00000040 /* Variable length delimiter set. */ +#define DB_AM_DIRTY 0x00000080 /* Support Dirty Reads. */ +#define DB_AM_DISCARD 0x00000100 /* Discard any cached pages. */ +#define DB_AM_DUP 0x00000200 /* DB_DUP. */ +#define DB_AM_DUPSORT 0x00000400 /* DB_DUPSORT. */ +#define DB_AM_ENCRYPT 0x00000800 /* Encryption. */ +#define DB_AM_FIXEDLEN 0x00001000 /* Fixed-length records. */ +#define DB_AM_INMEM 0x00002000 /* In-memory; no sync on close. */ +#define DB_AM_IN_RENAME 0x00004000 /* File is being renamed. */ +#define DB_AM_OPEN_CALLED 0x00008000 /* DB->open called. */ +#define DB_AM_PAD 0x00010000 /* Fixed-length record pad. */ +#define DB_AM_PGDEF 0x00020000 /* Page size was defaulted. */ +#define DB_AM_RDONLY 0x00040000 /* Database is readonly. */ +#define DB_AM_RECNUM 0x00080000 /* DB_RECNUM. */ +#define DB_AM_RECOVER 0x00100000 /* DB opened by recovery routine. */ +#define DB_AM_RENUMBER 0x00200000 /* DB_RENUMBER. */ +#define DB_AM_REVSPLITOFF 0x00400000 /* DB_REVSPLITOFF. */ +#define DB_AM_SECONDARY 0x00800000 /* Database is a secondary index. */ +#define DB_AM_SNAPSHOT 0x01000000 /* DB_SNAPSHOT. */ +#define DB_AM_SUBDB 0x02000000 /* Subdatabases supported. */ +#define DB_AM_SWAP 0x04000000 /* Pages need to be byte-swapped. */ +#define DB_AM_TXN 0x08000000 /* Opened in a transaction. */ +#define DB_AM_VERIFYING 0x10000000 /* DB handle is in the verifier. */ + u_int32_t flags; +}; + +/* + * Macros for bulk get. Note that wherever we use a DBT *, we explicitly + * cast it; this allows the same macros to work with C++ Dbt *'s, as Dbt + * is a subclass of struct DBT in C++. + */ +#define DB_MULTIPLE_INIT(pointer, dbt) \ + (pointer = (u_int8_t *)((DBT *)(dbt))->data + \ + ((DBT *)(dbt))->ulen - sizeof(u_int32_t)) +#define DB_MULTIPLE_NEXT(pointer, dbt, retdata, retdlen) \ + do { \ + if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \ + retdata = NULL; \ + pointer = NULL; \ + break; \ + } \ + retdata = (u_int8_t *) \ + ((DBT *)(dbt))->data + *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + retdlen = *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + if (retdlen == 0 && \ + retdata == (u_int8_t *)((DBT *)(dbt))->data) \ + retdata = NULL; \ + } while (0) +#define DB_MULTIPLE_KEY_NEXT(pointer, dbt, retkey, retklen, retdata, retdlen) \ + do { \ + if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \ + retdata = NULL; \ + retkey = NULL; \ + pointer = NULL; \ + break; \ + } \ + retkey = (u_int8_t *) \ + ((DBT *)(dbt))->data + *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + retklen = *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + retdata = (u_int8_t *) \ + ((DBT *)(dbt))->data + *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + retdlen = *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + } while (0) + +#define DB_MULTIPLE_RECNO_NEXT(pointer, dbt, recno, retdata, retdlen) \ + do { \ + if (*((u_int32_t *)(pointer)) == (u_int32_t)0) { \ + recno = 0; \ + retdata = NULL; \ + pointer = NULL; \ + break; \ + } \ + recno = *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + retdata = (u_int8_t *) \ + ((DBT *)(dbt))->data + *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + retdlen = *(u_int32_t *)(pointer); \ + (pointer) = (u_int32_t *)(pointer) - 1; \ + } while (0) + +/******************************************************* + * Access method cursors. + *******************************************************/ +struct __dbc { + DB *dbp; /* Related DB access method. */ + DB_TXN *txn; /* Associated transaction. */ + + /* + * Active/free cursor queues. + * + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_ENTRY(__dbc) links; + */ + struct { + DBC *tqe_next; + DBC **tqe_prev; + } links; + + /* + * The DBT *'s below are used by the cursor routines to return + * data to the user when DBT flags indicate that DB should manage + * the returned memory. They point at a DBT containing the buffer + * and length that will be used, and "belonging" to the handle that + * should "own" this memory. This may be a "my_*" field of this + * cursor--the default--or it may be the corresponding field of + * another cursor, a DB handle, a join cursor, etc. In general, it + * will be whatever handle the user originally used for the current + * DB interface call. + */ + DBT *rskey; /* Returned secondary key. */ + DBT *rkey; /* Returned [primary] key. */ + DBT *rdata; /* Returned data. */ + + DBT my_rskey; /* Space for returned secondary key. */ + DBT my_rkey; /* Space for returned [primary] key. */ + DBT my_rdata; /* Space for returned data. */ + + u_int32_t lid; /* Default process' locker id. */ + u_int32_t locker; /* Locker for this operation. */ + DBT lock_dbt; /* DBT referencing lock. */ + DB_LOCK_ILOCK lock; /* Object to be locked. */ + DB_LOCK mylock; /* Lock held on this cursor. */ + + long cl_id; /* Remote client id. */ + + DBTYPE dbtype; /* Cursor type. */ + + DBC_INTERNAL *internal; /* Access method private. */ + + int (*c_close) __P((DBC *)); /* Methods: public. */ + int (*c_count) __P((DBC *, db_recno_t *, u_int32_t)); + int (*c_del) __P((DBC *, u_int32_t)); + int (*c_dup) __P((DBC *, DBC **, u_int32_t)); + int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); + int (*c_pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); + int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); + + /* Methods: private. */ + int (*c_am_bulk) __P((DBC *, DBT *, u_int32_t)); + int (*c_am_close) __P((DBC *, db_pgno_t, int *)); + int (*c_am_del) __P((DBC *)); + int (*c_am_destroy) __P((DBC *)); + int (*c_am_get) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); + int (*c_am_put) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); + int (*c_am_writelock) __P((DBC *)); + + /* Private: for secondary indices. */ + int (*c_real_get) __P((DBC *, DBT *, DBT *, u_int32_t)); + +#define DBC_ACTIVE 0x0001 /* Cursor in use. */ +#define DBC_COMPENSATE 0x0002 /* Cursor compensating, don't lock. */ +#define DBC_DIRTY_READ 0x0004 /* Cursor supports dirty reads. */ +#define DBC_OPD 0x0008 /* Cursor references off-page dups. */ +#define DBC_RECOVER 0x0010 /* Recovery cursor; don't log/lock. */ +#define DBC_RMW 0x0020 /* Acquire write flag in read op. */ +#define DBC_TRANSIENT 0x0040 /* Cursor is transient. */ +#define DBC_WRITECURSOR 0x0080 /* Cursor may be used to write (CDB). */ +#define DBC_WRITEDUP 0x0100 /* idup'ed DBC_WRITECURSOR (CDB). */ +#define DBC_WRITER 0x0200 /* Cursor immediately writing (CDB). */ +#define DBC_MULTIPLE 0x0400 /* Return Multiple data. */ +#define DBC_MULTIPLE_KEY 0x0800 /* Return Multiple keys and data. */ +#define DBC_OWN_LID 0x1000 /* Free lock id on destroy. */ + u_int32_t flags; +}; + +/* Key range statistics structure */ +struct __key_range { + double less; + double equal; + double greater; +}; + +/* Btree/Recno statistics structure. */ +struct __db_bt_stat { + u_int32_t bt_magic; /* Magic number. */ + u_int32_t bt_version; /* Version number. */ + u_int32_t bt_metaflags; /* Metadata flags. */ + u_int32_t bt_nkeys; /* Number of unique keys. */ + u_int32_t bt_ndata; /* Number of data items. */ + u_int32_t bt_pagesize; /* Page size. */ + u_int32_t bt_maxkey; /* Maxkey value. */ + u_int32_t bt_minkey; /* Minkey value. */ + u_int32_t bt_re_len; /* Fixed-length record length. */ + u_int32_t bt_re_pad; /* Fixed-length record pad. */ + u_int32_t bt_levels; /* Tree levels. */ + u_int32_t bt_int_pg; /* Internal pages. */ + u_int32_t bt_leaf_pg; /* Leaf pages. */ + u_int32_t bt_dup_pg; /* Duplicate pages. */ + u_int32_t bt_over_pg; /* Overflow pages. */ + u_int32_t bt_free; /* Pages on the free list. */ + u_int32_t bt_int_pgfree; /* Bytes free in internal pages. */ + u_int32_t bt_leaf_pgfree; /* Bytes free in leaf pages. */ + u_int32_t bt_dup_pgfree; /* Bytes free in duplicate pages. */ + u_int32_t bt_over_pgfree; /* Bytes free in overflow pages. */ +}; + +/* Hash statistics structure. */ +struct __db_h_stat { + u_int32_t hash_magic; /* Magic number. */ + u_int32_t hash_version; /* Version number. */ + u_int32_t hash_metaflags; /* Metadata flags. */ + u_int32_t hash_nkeys; /* Number of unique keys. */ + u_int32_t hash_ndata; /* Number of data items. */ + u_int32_t hash_pagesize; /* Page size. */ + u_int32_t hash_ffactor; /* Fill factor specified at create. */ + u_int32_t hash_buckets; /* Number of hash buckets. */ + u_int32_t hash_free; /* Pages on the free list. */ + u_int32_t hash_bfree; /* Bytes free on bucket pages. */ + u_int32_t hash_bigpages; /* Number of big key/data pages. */ + u_int32_t hash_big_bfree; /* Bytes free on big item pages. */ + u_int32_t hash_overflows; /* Number of overflow pages. */ + u_int32_t hash_ovfl_free; /* Bytes free on ovfl pages. */ + u_int32_t hash_dup; /* Number of dup pages. */ + u_int32_t hash_dup_free; /* Bytes free on duplicate pages. */ +}; + +/* Queue statistics structure. */ +struct __db_qam_stat { + u_int32_t qs_magic; /* Magic number. */ + u_int32_t qs_version; /* Version number. */ + u_int32_t qs_metaflags; /* Metadata flags. */ + u_int32_t qs_nkeys; /* Number of unique keys. */ + u_int32_t qs_ndata; /* Number of data items. */ + u_int32_t qs_pagesize; /* Page size. */ + u_int32_t qs_extentsize; /* Pages per extent. */ + u_int32_t qs_pages; /* Data pages. */ + u_int32_t qs_re_len; /* Fixed-length record length. */ + u_int32_t qs_re_pad; /* Fixed-length record pad. */ + u_int32_t qs_pgfree; /* Bytes free in data pages. */ + u_int32_t qs_first_recno; /* First not deleted record. */ + u_int32_t qs_cur_recno; /* Next available record number. */ +}; + +/******************************************************* + * Environment. + *******************************************************/ +#define DB_REGION_MAGIC 0x120897 /* Environment magic number. */ + +/* Database Environment handle. */ +struct __db_env { + /******************************************************* + * Public: owned by the application. + *******************************************************/ + FILE *db_errfile; /* Error message file stream. */ + const char *db_errpfx; /* Error message prefix. */ + /* Callbacks. */ + void (*db_errcall) __P((const char *, char *)); + void (*db_feedback) __P((DB_ENV *, int, int)); + void (*db_paniccall) __P((DB_ENV *, int)); + + /* App-specified alloc functions. */ + void *(*db_malloc) __P((size_t)); + void *(*db_realloc) __P((void *, size_t)); + void (*db_free) __P((void *)); + + /* + * Currently, the verbose list is a bit field with room for 32 + * entries. There's no reason that it needs to be limited, if + * there are ever more than 32 entries, convert to a bit array. + */ +#define DB_VERB_CHKPOINT 0x0001 /* List checkpoints. */ +#define DB_VERB_DEADLOCK 0x0002 /* Deadlock detection information. */ +#define DB_VERB_RECOVERY 0x0004 /* Recovery information. */ +#define DB_VERB_REPLICATION 0x0008 /* Replication information. */ +#define DB_VERB_WAITSFOR 0x0010 /* Dump waits-for table. */ + u_int32_t verbose; /* Verbose output. */ + + void *app_private; /* Application-private handle. */ + + int (*app_dispatch) /* User-specified recovery dispatch. */ + __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); + + /* Locking. */ + u_int8_t *lk_conflicts; /* Two dimensional conflict matrix. */ + u_int32_t lk_modes; /* Number of lock modes in table. */ + u_int32_t lk_max; /* Maximum number of locks. */ + u_int32_t lk_max_lockers;/* Maximum number of lockers. */ + u_int32_t lk_max_objects;/* Maximum number of locked objects. */ + u_int32_t lk_detect; /* Deadlock detect on all conflicts. */ + db_timeout_t lk_timeout; /* Lock timeout period. */ + + /* Logging. */ + u_int32_t lg_bsize; /* Buffer size. */ + u_int32_t lg_size; /* Log file size. */ + u_int32_t lg_regionmax; /* Region size. */ + + /* Memory pool. */ + u_int32_t mp_gbytes; /* Cachesize: GB. */ + u_int32_t mp_bytes; /* Cachesize: Bytes. */ + size_t mp_size; /* DEPRECATED: Cachesize: bytes. */ + int mp_ncache; /* Number of cache regions. */ + size_t mp_mmapsize; /* Maximum file size for mmap. */ + + int rep_eid; /* environment id. */ + + /* Transactions. */ + u_int32_t tx_max; /* Maximum number of transactions. */ + time_t tx_timestamp; /* Recover to specific timestamp. */ + db_timeout_t tx_timeout; /* Timeout for transactions. */ + + /******************************************************* + * Private: owned by DB. + *******************************************************/ + int panic_errval; /* Panic causing errno. */ + + /* User files, paths. */ + char *db_home; /* Database home. */ + char *db_log_dir; /* Database log file directory. */ + char *db_tmp_dir; /* Database tmp file directory. */ + + char **db_data_dir; /* Database data file directories. */ + int data_cnt; /* Database data file slots. */ + int data_next; /* Next Database data file slot. */ + + int db_mode; /* Default open permissions. */ + + void *reginfo; /* REGINFO structure reference. */ + DB_FH *lockfhp; /* fcntl(2) locking file handle. */ + + int (**recover_dtab) /* Dispatch table for recover funcs. */ + __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t recover_dtab_size; + /* Slots in the dispatch table. */ + + void *cl_handle; /* RPC: remote client handle. */ + long cl_id; /* RPC: remote client env id. */ + + int db_ref; /* DB reference count. */ + + long shm_key; /* shmget(2) key. */ + u_int32_t tas_spins; /* test-and-set spins. */ + + /* + * List of open DB handles for this DB_ENV, used for cursor + * adjustment. Must be protected for multi-threaded support. + * + * !!! + * As this structure is allocated in per-process memory, the + * mutex may need to be stored elsewhere on architectures unable + * to support mutexes in heap memory, e.g. HP/UX 9. + * + * !!! + * Explicit representation of structure in queue.h. + * LIST_HEAD(dblist, __db); + */ + DB_MUTEX *dblist_mutexp; /* Mutex. */ + struct { + struct __db *lh_first; + } dblist; + + /* + * XA support. + * + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_ENTRY(__db_env) links; + */ + struct { + struct __db_env *tqe_next; + struct __db_env **tqe_prev; + } links; + int xa_rmid; /* XA Resource Manager ID. */ + DB_LOCK xa_handle_lock; + u_int32_t xa_locker; + + /* + * List of active XA transactions for this DB_ENV. + * Must be protected for multi-threaded support. + * + * !!! + * As this structure is allocated in per-process memory, the + * mutex may need to be stored elsewhere on architectures unable + * to support mutexes in heap memory, e.g. HP/UX 9. + * + * !!! + * Explicit representations of structures from queue.h. + * TAILQ_HEAD(__xa_txns, __db_txn) xa_txns; + */ + DB_MUTEX *xa_txns_mutexp; /* Mutex. */ + struct __xa_txns { + struct __db_txn *tqh_first; + struct __db_txn **tqh_last; + } xa_txns; + + /* API-private structure. */ + void *api1_internal; /* C++, Perl API private */ + void *api2_internal; /* Java API private */ + + char *passwd; /* Cryptography support. */ + size_t passwd_len; + void *crypto_handle; /* Primary handle. */ + DB_MUTEX *mt_mutexp; /* Mersenne Twister mutex. */ + int mti; /* Mersenne Twister index. */ + u_long *mt; /* Mersenne Twister state vector. */ + + /* DB_ENV Methods. */ + int (*close) __P((DB_ENV *, u_int32_t)); + int (*dbremove) __P((DB_ENV *, + DB_TXN *, const char *, const char *, u_int32_t)); + int (*dbrename) __P((DB_ENV *, DB_TXN *, + const char *, const char *, const char *, u_int32_t)); + void (*err) __P((const DB_ENV *, int, const char *, ...)); + void (*errx) __P((const DB_ENV *, const char *, ...)); + int (*open) __P((DB_ENV *, const char *, u_int32_t, int)); + int (*remove) __P((DB_ENV *, const char *, u_int32_t)); + int (*set_data_dir) __P((DB_ENV *, const char *)); + int (*set_alloc) __P((DB_ENV *, void *(*)(size_t), + void *(*)(void *, size_t), void (*)(void *))); + int (*set_app_dispatch) __P((DB_ENV *, + int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops))); + int (*set_encrypt) __P((DB_ENV *, const char *, u_int32_t)); + void (*set_errcall) __P((DB_ENV *, void (*)(const char *, char *))); + void (*set_errfile) __P((DB_ENV *, FILE *)); + void (*set_errpfx) __P((DB_ENV *, const char *)); + int (*set_feedback) __P((DB_ENV *, void (*)(DB_ENV *, int, int))); + int (*set_flags) __P((DB_ENV *, u_int32_t, int)); + int (*set_paniccall) __P((DB_ENV *, void (*)(DB_ENV *, int))); + int (*set_rpc_server) __P((DB_ENV *, + void *, const char *, long, long, u_int32_t)); + int (*set_shm_key) __P((DB_ENV *, long)); + int (*set_tas_spins) __P((DB_ENV *, u_int32_t)); + int (*set_tmp_dir) __P((DB_ENV *, const char *)); + int (*set_verbose) __P((DB_ENV *, u_int32_t, int)); + + void *lg_handle; /* Log handle and methods. */ + int (*set_lg_bsize) __P((DB_ENV *, u_int32_t)); + int (*set_lg_dir) __P((DB_ENV *, const char *)); + int (*set_lg_max) __P((DB_ENV *, u_int32_t)); + int (*set_lg_regionmax) __P((DB_ENV *, u_int32_t)); + int (*log_archive) __P((DB_ENV *, char **[], u_int32_t)); + int (*log_cursor) __P((DB_ENV *, DB_LOGC **, u_int32_t)); + int (*log_file) __P((DB_ENV *, const DB_LSN *, char *, size_t)); + int (*log_flush) __P((DB_ENV *, const DB_LSN *)); + int (*log_put) __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t)); + int (*log_stat) __P((DB_ENV *, DB_LOG_STAT **, u_int32_t)); + + void *lk_handle; /* Lock handle and methods. */ + int (*set_lk_conflicts) __P((DB_ENV *, u_int8_t *, int)); + int (*set_lk_detect) __P((DB_ENV *, u_int32_t)); + int (*set_lk_max) __P((DB_ENV *, u_int32_t)); + int (*set_lk_max_locks) __P((DB_ENV *, u_int32_t)); + int (*set_lk_max_lockers) __P((DB_ENV *, u_int32_t)); + int (*set_lk_max_objects) __P((DB_ENV *, u_int32_t)); + int (*lock_detect) __P((DB_ENV *, u_int32_t, u_int32_t, int *)); + int (*lock_dump_region) __P((DB_ENV *, char *, FILE *)); + int (*lock_get) __P((DB_ENV *, + u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); + int (*lock_put) __P((DB_ENV *, DB_LOCK *)); + int (*lock_id) __P((DB_ENV *, u_int32_t *)); + int (*lock_id_free) __P((DB_ENV *, u_int32_t)); + int (*lock_id_set) __P((DB_ENV *, u_int32_t, u_int32_t)); + int (*lock_stat) __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t)); + int (*lock_vec) __P((DB_ENV *, + u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); + int (*lock_downgrade) __P((DB_ENV *, + DB_LOCK *, db_lockmode_t, u_int32_t)); + + void *mp_handle; /* Mpool handle and methods. */ + int (*set_mp_mmapsize) __P((DB_ENV *, size_t)); + int (*set_cachesize) __P((DB_ENV *, u_int32_t, u_int32_t, int)); + int (*memp_dump_region) __P((DB_ENV *, char *, FILE *)); + int (*memp_fcreate) __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t)); + int (*memp_nameop) __P((DB_ENV *, + u_int8_t *, const char *, const char *, const char *)); + int (*memp_register) __P((DB_ENV *, int, + int (*)(DB_ENV *, db_pgno_t, void *, DBT *), + int (*)(DB_ENV *, db_pgno_t, void *, DBT *))); + int (*memp_stat) __P((DB_ENV *, + DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t)); + int (*memp_sync) __P((DB_ENV *, DB_LSN *)); + int (*memp_trickle) __P((DB_ENV *, int, int *)); + + void *rep_handle; /* Replication handle and methods. */ + int (*rep_elect) __P((DB_ENV *, int, int, u_int32_t, int *)); + int (*rep_flush) __P((DB_ENV *)); + int (*rep_process_message) __P((DB_ENV *, DBT *, DBT *, int *)); + int (*rep_start) __P((DB_ENV *, DBT *, u_int32_t)); + int (*rep_stat) __P((DB_ENV *, DB_REP_STAT **, u_int32_t)); + int (*set_rep_election) __P((DB_ENV *, + u_int32_t, u_int32_t, u_int32_t, u_int32_t)); + int (*set_rep_limit) __P((DB_ENV *, u_int32_t, u_int32_t)); + int (*set_rep_request) __P((DB_ENV *, u_int32_t, u_int32_t)); + int (*set_rep_timeout) __P((DB_ENV *, u_int32_t, u_int32_t)); + int (*set_rep_transport) __P((DB_ENV *, int, + int (*) (DB_ENV *, const DBT *, const DBT *, int, u_int32_t))); + + void *tx_handle; /* Txn handle and methods. */ + int (*set_tx_max) __P((DB_ENV *, u_int32_t)); + int (*set_tx_timestamp) __P((DB_ENV *, time_t *)); + int (*txn_begin) __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)); + int (*txn_checkpoint) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); + int (*txn_id_set) __P((DB_ENV *, u_int32_t, u_int32_t)); + int (*txn_recover) __P((DB_ENV *, + DB_PREPLIST *, long, long *, u_int32_t)); + int (*txn_stat) __P((DB_ENV *, DB_TXN_STAT **, u_int32_t)); + int (*set_timeout) __P((DB_ENV *, db_timeout_t, u_int32_t)); + +#define DB_TEST_ELECTINIT 1 /* after __rep_elect_init */ +#define DB_TEST_ELECTSEND 2 /* after REP_ELECT msgnit */ +#define DB_TEST_ELECTVOTE1 3 /* after __rep_send_vote 1 */ +#define DB_TEST_ELECTVOTE2 4 /* after __rep_wait */ +#define DB_TEST_ELECTWAIT1 5 /* after REP_VOTE2 */ +#define DB_TEST_ELECTWAIT2 6 /* after __rep_wait 2 */ +#define DB_TEST_PREDESTROY 7 /* before destroy op */ +#define DB_TEST_PREOPEN 8 /* before __os_open */ +#define DB_TEST_POSTDESTROY 9 /* after destroy op */ +#define DB_TEST_POSTLOG 10 /* after logging all pages */ +#define DB_TEST_POSTLOGMETA 11 /* after logging meta in btree */ +#define DB_TEST_POSTOPEN 12 /* after __os_open */ +#define DB_TEST_POSTSYNC 13 /* after syncing the log */ +#define DB_TEST_SUBDB_LOCKS 14 /* subdb locking tests */ + int test_abort; /* Abort value for testing. */ + int test_copy; /* Copy value for testing. */ + +#define DB_ENV_AUTO_COMMIT 0x0000001 /* DB_AUTO_COMMIT. */ +#define DB_ENV_CDB 0x0000002 /* DB_INIT_CDB. */ +#define DB_ENV_CDB_ALLDB 0x0000004 /* CDB environment wide locking. */ +#define DB_ENV_CREATE 0x0000008 /* DB_CREATE set. */ +#define DB_ENV_DBLOCAL 0x0000010 /* DB_ENV allocated for private DB. */ +#define DB_ENV_DIRECT_DB 0x0000020 /* DB_DIRECT_DB set. */ +#define DB_ENV_DIRECT_LOG 0x0000040 /* DB_DIRECT_LOG set. */ +#define DB_ENV_FATAL 0x0000080 /* Doing fatal recovery in env. */ +#define DB_ENV_LOCKDOWN 0x0000100 /* DB_LOCKDOWN set. */ +#define DB_ENV_NOLOCKING 0x0000200 /* DB_NOLOCKING set. */ +#define DB_ENV_NOMMAP 0x0000400 /* DB_NOMMAP set. */ +#define DB_ENV_NOPANIC 0x0000800 /* Okay if panic set. */ +#define DB_ENV_OPEN_CALLED 0x0001000 /* DB_ENV->open called. */ +#define DB_ENV_OVERWRITE 0x0002000 /* DB_OVERWRITE set. */ +#define DB_ENV_PRIVATE 0x0004000 /* DB_PRIVATE set. */ +#define DB_ENV_REGION_INIT 0x0008000 /* DB_REGION_INIT set. */ +#define DB_ENV_REP_CLIENT 0x0010000 /* Replication client. */ +#define DB_ENV_REP_LOGSONLY 0x0020000 /* Log files only replication site. */ +#define DB_ENV_REP_MASTER 0x0040000 /* Replication master. */ +#define DB_ENV_RPCCLIENT 0x0080000 /* DB_CLIENT set. */ +#define DB_ENV_RPCCLIENT_GIVEN 0x0100000 /* User-supplied RPC client struct */ +#define DB_ENV_SYSTEM_MEM 0x0200000 /* DB_SYSTEM_MEM set. */ +#define DB_ENV_THREAD 0x0400000 /* DB_THREAD set. */ +#define DB_ENV_TXN_NOSYNC 0x0800000 /* DB_TXN_NOSYNC set. */ +#define DB_ENV_TXN_WRITE_NOSYNC 0x1000000 /* DB_TXN_WRITE_NOSYNC set. */ +#define DB_ENV_YIELDCPU 0x2000000 /* DB_YIELDCPU set. */ + u_int32_t flags; +}; + +#ifndef DB_DBM_HSEARCH +#define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */ +#endif +#if DB_DBM_HSEARCH != 0 +/******************************************************* + * Dbm/Ndbm historic interfaces. + *******************************************************/ +typedef struct __db DBM; + +#define DBM_INSERT 0 /* Flags to dbm_store(). */ +#define DBM_REPLACE 1 + +/* + * The DB support for ndbm(3) always appends this suffix to the + * file name to avoid overwriting the user's original database. + */ +#define DBM_SUFFIX ".db" + +#if defined(_XPG4_2) +typedef struct { + char *dptr; + size_t dsize; +} datum; +#else +typedef struct { + char *dptr; + int dsize; +} datum; +#endif + +/* + * Translate NDBM calls into DB calls so that DB doesn't step on the + * application's name space. + */ +#define dbm_clearerr(a) __db_ndbm_clearerr@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_close(a) __db_ndbm_close@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_delete(a, b) __db_ndbm_delete@DB_VERSION_UNIQUE_NAME@(a, b) +#define dbm_dirfno(a) __db_ndbm_dirfno@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_error(a) __db_ndbm_error@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_fetch(a, b) __db_ndbm_fetch@DB_VERSION_UNIQUE_NAME@(a, b) +#define dbm_firstkey(a) __db_ndbm_firstkey@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_nextkey(a) __db_ndbm_nextkey@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_open(a, b, c) __db_ndbm_open@DB_VERSION_UNIQUE_NAME@(a, b, c) +#define dbm_pagfno(a) __db_ndbm_pagfno@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_rdonly(a) __db_ndbm_rdonly@DB_VERSION_UNIQUE_NAME@(a) +#define dbm_store(a, b, c, d) \ + __db_ndbm_store@DB_VERSION_UNIQUE_NAME@(a, b, c, d) + +/* + * 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 supported here. + */ +#define dbminit(a) __db_dbm_init@DB_VERSION_UNIQUE_NAME@(a) +#define dbmclose __db_dbm_close@DB_VERSION_UNIQUE_NAME@ +#if !defined(__cplusplus) +#define delete(a) __db_dbm_delete@DB_VERSION_UNIQUE_NAME@(a) +#endif +#define fetch(a) __db_dbm_fetch@DB_VERSION_UNIQUE_NAME@(a) +#define firstkey __db_dbm_firstkey@DB_VERSION_UNIQUE_NAME@ +#define nextkey(a) __db_dbm_nextkey@DB_VERSION_UNIQUE_NAME@(a) +#define store(a, b) __db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b) + +/******************************************************* + * Hsearch historic interface. + *******************************************************/ +typedef enum { + FIND, ENTER +} ACTION; + +typedef struct entry { + char *key; + char *data; +} ENTRY; + +#define hcreate(a) __db_hcreate@DB_VERSION_UNIQUE_NAME@(a) +#define hdestroy __db_hdestroy@DB_VERSION_UNIQUE_NAME@ +#define hsearch(a, b) __db_hsearch@DB_VERSION_UNIQUE_NAME@(a, b) + +#endif /* DB_DBM_HSEARCH */ + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_H_ */ diff --git a/db/dbinc/db_185.in b/db/dbinc/db_185.in new file mode 100644 index 000000000..6fc254fe6 --- /dev/null +++ b/db/dbinc/db_185.in @@ -0,0 +1,169 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Id: db_185.in,v 11.8 2002/01/11 15:52:24 bostic Exp + */ + +#ifndef _DB_185_H_ +#define _DB_185_H_ + +#include <sys/types.h> + +#include <limits.h> + +/* + * 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. + */ +#undef __P +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* ANSI C prototypes */ +#else +#define const +#define __P(protos) () /* K&R C preprocessor */ +#endif + +#define RET_ERROR -1 /* Return values. */ +#define RET_SUCCESS 0 +#define RET_SPECIAL 1 + +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ +@u_int8_decl@ +@int16_decl@ +@u_int16_decl@ +@int32_decl@ +@u_int32_decl@ +#endif + +/* + * XXX + * SGI/IRIX already has a pgno_t. + */ +#ifdef sgi +#define pgno_t db_pgno_t +#endif + +#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ +typedef u_int32_t pgno_t; +#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ +typedef u_int16_t indx_t; +#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ +typedef u_int32_t recno_t; + +/* Key/data structure -- a Data-Base Thang. */ +typedef struct { + void *data; /* data */ + size_t size; /* data length */ +} DBT; + +/* Routine flags. */ +#define R_CURSOR 1 /* del, put, seq */ +#define __R_UNUSED 2 /* UNUSED */ +#define R_FIRST 3 /* seq */ +#define R_IAFTER 4 /* put (RECNO) */ +#define R_IBEFORE 5 /* put (RECNO) */ +#define R_LAST 6 /* seq (BTREE, RECNO) */ +#define R_NEXT 7 /* seq */ +#define R_NOOVERWRITE 8 /* put */ +#define R_PREV 9 /* seq (BTREE, RECNO) */ +#define R_SETCURSOR 10 /* put (RECNO) */ +#define R_RECNOSYNC 11 /* sync (RECNO) */ + +typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; + +/* Access method description structure. */ +typedef struct __db { + DBTYPE type; /* Underlying db type. */ + int (*close) __P((struct __db *)); + int (*del) __P((const struct __db *, const DBT *, u_int)); + int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); + int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); + int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); + int (*sync) __P((const struct __db *, u_int)); + void *internal; /* Access method private. */ + int (*fd) __P((const struct __db *)); +} DB; + +#define BTREEMAGIC 0x053162 +#define BTREEVERSION 3 + +/* Structure used to pass parameters to the btree routines. */ +typedef struct { +#define R_DUP 0x01 /* duplicate keys */ + u_int32_t flags; + u_int32_t cachesize; /* bytes to cache */ + u_int32_t maxkeypage; /* maximum keys per page */ + u_int32_t minkeypage; /* minimum keys per page */ + u_int32_t psize; /* page size */ + int (*compare) /* comparison function */ + __P((const DBT *, const DBT *)); + size_t (*prefix) /* prefix function */ + __P((const DBT *, const DBT *)); + int lorder; /* byte order */ +} BTREEINFO; + +#define HASHMAGIC 0x061561 +#define HASHVERSION 2 + +/* Structure used to pass parameters to the hashing routines. */ +typedef struct { + u_int32_t bsize; /* bucket size */ + u_int32_t ffactor; /* fill factor */ + u_int32_t nelem; /* number of elements */ + u_int32_t cachesize; /* bytes to cache */ + u_int32_t /* hash function */ + (*hash) __P((const void *, size_t)); + int lorder; /* byte order */ +} HASHINFO; + +/* Structure used to pass parameters to the record routines. */ +typedef struct { +#define R_FIXEDLEN 0x01 /* fixed-length records */ +#define R_NOKEY 0x02 /* key not required */ +#define R_SNAPSHOT 0x04 /* snapshot the input */ + u_int32_t flags; + u_int32_t cachesize; /* bytes to cache */ + u_int32_t psize; /* page size */ + int lorder; /* byte order */ + size_t reclen; /* record length (fixed-length records) */ + u_char bval; /* delimiting byte (variable-length records */ + char *bfname; /* btree file name */ +} RECNOINFO; + +/* Re-define the user's dbopen calls. */ +#define dbopen __db185_open@DB_VERSION_UNIQUE_NAME@ + +#endif /* !_DB_185_H_ */ diff --git a/db/dbinc/db_am.h b/db/dbinc/db_am.h new file mode 100644 index 000000000..aab20fefb --- /dev/null +++ b/db/dbinc/db_am.h @@ -0,0 +1,127 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_am.h,v 11.61 2002/08/08 03:20:46 bostic Exp + */ +#ifndef _DB_AM_H_ +#define _DB_AM_H_ + +/* + * IS_AUTO_COMMIT -- + * Test for local auto-commit flag or global flag with no local DbTxn + * handle. + */ +#define IS_AUTO_COMMIT(dbenv, txn, flags) \ + (LF_ISSET(DB_AUTO_COMMIT) || \ + ((txn) == NULL && F_ISSET((dbenv), DB_ENV_AUTO_COMMIT))) + +/* DB recovery operation codes. */ +#define DB_ADD_DUP 1 +#define DB_REM_DUP 2 +#define DB_ADD_BIG 3 +#define DB_REM_BIG 4 +#define DB_ADD_PAGE 5 +#define DB_REM_PAGE 6 + +/* + * Standard initialization and shutdown macros for all recovery functions. + */ +#define REC_INTRO(func, inc_count) { \ + argp = NULL; \ + dbc = NULL; \ + file_dbp = NULL; \ + mpf = NULL; \ + if ((ret = func(dbenv, dbtp->data, &argp)) != 0) \ + goto out; \ + if ((ret = __dbreg_id_to_db(dbenv, argp->txnid, \ + &file_dbp, argp->fileid, inc_count)) != 0) { \ + if (ret == DB_DELETED) { \ + ret = 0; \ + goto done; \ + } \ + goto out; \ + } \ + if ((ret = file_dbp->cursor(file_dbp, NULL, &dbc, 0)) != 0) \ + goto out; \ + F_SET(dbc, DBC_RECOVER); \ + mpf = file_dbp->mpf; \ +} + +#define REC_CLOSE { \ + int __t_ret; \ + if (argp != NULL) \ + __os_free(dbenv, argp); \ + if (dbc != NULL && \ + (__t_ret = dbc->c_close(dbc)) != 0 && ret == 0) \ + ret = __t_ret; \ + return (ret); \ +} + +/* + * No-op versions of the same macros. + */ +#define REC_NOOP_INTRO(func) { \ + argp = NULL; \ + if ((ret = func(dbenv, dbtp->data, &argp)) != 0) \ + return (ret); \ +} +#define REC_NOOP_CLOSE \ + if (argp != NULL) \ + __os_free(dbenv, argp); \ + return (ret); \ + +/* + * Standard debugging macro for all recovery functions. + */ +#ifdef DEBUG_RECOVER +#define REC_PRINT(func) \ + (void)func(dbenv, dbtp, lsnp, op, info); +#else +#define REC_PRINT(func) +#endif + +/* + * Actions to __db_lget + */ +#define LCK_ALWAYS 1 /* Lock even for off page dup cursors */ +#define LCK_COUPLE 2 /* Lock Couple */ +#define LCK_COUPLE_ALWAYS 3 /* Lock Couple even in txn. */ +#define LCK_DOWNGRADE 4 /* Downgrade the lock. (internal) */ +#define LCK_ROLLBACK 5 /* Lock even if in rollback */ + +/* + * If doing transactions we have to hold the locks associated with a data item + * from a page for the entire transaction. However, we don't have to hold the + * locks associated with walking the tree. Distinguish between the two so that + * we don't tie up the internal pages of the tree longer than necessary. + */ +#define __LPUT(dbc, lock) \ + (LOCK_ISSET(lock) ? \ + (dbc)->dbp->dbenv->lock_put((dbc)->dbp->dbenv, &(lock)) : 0) + +/* + * __TLPUT -- transactional lock put + * If the lock is valid then + * If we are not in a transaction put the lock. + * Else if the cursor is doing dirty reads and this was a read then + * put the lock. + * Else if the db is supporting dirty reads and this is a write then + * downgrade it. + * Else do nothing. + */ +#define __TLPUT(dbc, lock) \ + (LOCK_ISSET(lock) ? __db_lput(dbc, &(lock)) : 0) + +typedef struct { + DBC *dbc; + int count; +} db_trunc_param; + +#include "dbinc/db_dispatch.h" +#include "dbinc_auto/db_auto.h" +#include "dbinc_auto/crdel_auto.h" +#include "dbinc_auto/db_ext.h" +#endif /* !_DB_AM_H_ */ diff --git a/db/dbinc/db_cxx.in b/db/dbinc/db_cxx.in new file mode 100644 index 000000000..1f96f58b8 --- /dev/null +++ b/db/dbinc/db_cxx.in @@ -0,0 +1,796 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_cxx.in,v 11.112 2002/08/08 23:44:43 mjc Exp + */ + +#ifndef _DB_CXX_H_ +#define _DB_CXX_H_ +// +// C++ assumptions: +// +// To ensure portability to many platforms, both new and old, we make +// few assumptions about the C++ compiler and library. For example, +// we do not expect STL, templates or namespaces to be available. The +// "newest" C++ feature used is exceptions, which are used liberally +// to transmit error information. Even the use of exceptions can be +// disabled at runtime, to do so, use the DB_CXX_NO_EXCEPTIONS flags +// with the DbEnv or Db constructor. +// +// C++ naming conventions: +// +// - All top level class names start with Db. +// - All class members start with lower case letter. +// - All private data members are suffixed with underscore. +// - Use underscores to divide names into multiple words. +// - Simple data accessors are named with get_ or set_ prefix. +// - All method names are taken from names of functions in the C +// layer of db (usually by dropping a prefix like "db_"). +// These methods have the same argument types and order, +// other than dropping the explicit arg that acts as "this". +// +// As a rule, each DbFoo object has exactly one underlying DB_FOO struct +// (defined in db.h) associated with it. In some cases, we inherit directly +// from the DB_FOO structure to make this relationship explicit. Often, +// the underlying C layer allocates and deallocates these structures, so +// there is no easy way to add any data to the DbFoo class. When you see +// a comment about whether data is permitted to be added, this is what +// is going on. Of course, if we need to add data to such C++ classes +// in the future, we will arrange to have an indirect pointer to the +// DB_FOO struct (as some of the classes already have). +// + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Forward declarations +// + +#include <stdarg.h> + +@cxx_have_stdheaders@ +#ifdef HAVE_CXX_STDHEADERS +#include <iostream> +#define __DB_OSTREAMCLASS std::ostream +#else +#include <iostream.h> +#define __DB_OSTREAMCLASS ostream +#endif + +#include "db.h" +#include "cxx_common.h" +#include "cxx_except.h" + +class Db; // forward +class Dbc; // forward +class DbEnv; // forward +class DbInfo; // forward +class DbLock; // forward +class DbLogc; // forward +class DbLsn; // forward +class DbMpoolFile; // forward +class DbPreplist; // forward +class Dbt; // forward +class DbTxn; // forward + +// These classes are not defined here and should be invisible +// to the user, but some compilers require forward references. +// There is one for each use of the DEFINE_DB_CLASS macro. + +class DbImp; +class DbEnvImp; +class DbMpoolFileImp; +class DbTxnImp; + +// DEFINE_DB_CLASS defines an imp_ data member and imp() accessor. +// The underlying type is a pointer to an opaque *Imp class, that +// gets converted to the correct implementation class by the implementation. +// +// Since these defines use "private/public" labels, and leave the access +// being "private", we always use these by convention before any data +// members in the private section of a class. Keeping them in the +// private section also emphasizes that they are off limits to user code. +// +#define DEFINE_DB_CLASS(name) \ + public: class name##Imp* imp() { return (imp_); } \ + public: const class name##Imp* constimp() const { return (imp_); } \ + private: class name##Imp* imp_ + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Turn off inappropriate compiler warnings +// + +#ifdef _MSC_VER + +// These are level 4 warnings that are explicitly disabled. +// With Visual C++, by default you do not see above level 3 unless +// you use /W4. But we like to compile with the highest level +// warnings to catch other errors. +// +// 4201: nameless struct/union +// triggered by standard include file <winnt.h> +// +// 4514: unreferenced inline function has been removed +// certain include files in MSVC define methods that are not called +// +#pragma warning(disable: 4201 4514) + +#endif + +// Some interfaces can be customized by allowing users to define +// callback functions. For performance and logistical reasons, some +// callback functions must be declared in extern "C" blocks. For others, +// we allow you to declare the callbacks in C++ or C (or an extern "C" +// block) as you wish. See the set methods for the callbacks for +// the choices. +// +extern "C" { + typedef void * (*db_malloc_fcn_type) + (size_t); + typedef void * (*db_realloc_fcn_type) + (void *, size_t); + typedef void (*db_free_fcn_type) + (void *); + typedef int (*bt_compare_fcn_type) /*C++ version available*/ + (DB *, const DBT *, const DBT *); + typedef size_t (*bt_prefix_fcn_type) /*C++ version available*/ + (DB *, const DBT *, const DBT *); + typedef int (*dup_compare_fcn_type) /*C++ version available*/ + (DB *, const DBT *, const DBT *); + typedef u_int32_t (*h_hash_fcn_type) /*C++ version available*/ + (DB *, const void *, u_int32_t); + typedef int (*pgin_fcn_type) + (DB_ENV *dbenv, db_pgno_t pgno, void *pgaddr, DBT *pgcookie); + typedef int (*pgout_fcn_type) + (DB_ENV *dbenv, db_pgno_t pgno, void *pgaddr, DBT *pgcookie); +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Lock classes +// + +class _exported DbLock +{ + friend class DbEnv; + +public: + DbLock(); + DbLock(const DbLock &); + DbLock &operator = (const DbLock &); + +protected: + // We can add data to this class if needed + // since its contained class is not allocated by db. + // (see comment at top) + + DbLock(DB_LOCK); + DB_LOCK lock_; +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Log classes +// + +class _exported DbLsn : protected DB_LSN +{ + friend class DbEnv; // friendship needed to cast to base class + friend class DbLogc; // friendship needed to cast to base class +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Memory pool classes +// + +class _exported DbMpoolFile +{ + friend class DbEnv; + +private: + // Put this first to allow inlining with some C++ compilers (g++-2.95) + DEFINE_DB_CLASS(DbMpoolFile); + +public: + int close(u_int32_t flags); + int get(db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep); + void last_pgno(db_pgno_t *pgnoaddr); + int open(const char *file, u_int32_t flags, int mode, size_t pagesize); + int put(void *pgaddr, u_int32_t flags); + void refcnt(db_pgno_t *pgnoaddr); + int set(void *pgaddr, u_int32_t flags); + int set_clear_len(u_int32_t len); + int set_fileid(u_int8_t *fileid); + int set_ftype(int ftype); + int set_lsn_offset(int32_t offset); + int set_pgcookie(DBT *dbt); + void set_unlink(int); + int sync(); + + virtual DB_MPOOLFILE *get_DB_MPOOLFILE() + { + return (DB_MPOOLFILE *)imp(); + } + + virtual const DB_MPOOLFILE *get_const_DB_MPOOLFILE() const + { + return (const DB_MPOOLFILE *)constimp(); + } + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbEnv::memp_fcreate() to get pointers to a DbMpoolFile, + // and call DbMpoolFile::close() rather than delete to release them. + // + DbMpoolFile(); + + // Shut g++ up. +protected: + virtual ~DbMpoolFile(); + +private: + // no copying + DbMpoolFile(const DbMpoolFile &); + void operator = (const DbMpoolFile &); +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// This is filled in and returned by the DbEnv::txn_recover() method. +// + +class _exported DbPreplist +{ +public: + DbTxn *txn; + u_int8_t gid[DB_XIDDATASIZE]; +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Transaction classes +// + +class _exported DbTxn +{ + friend class DbEnv; + +private: + // Put this first to allow inlining with some C++ compilers (g++-2.95) + DEFINE_DB_CLASS(DbTxn); + +public: + int abort(); + int commit(u_int32_t flags); + int discard(u_int32_t flags); + u_int32_t id(); + int prepare(u_int8_t *gid); + int set_timeout(db_timeout_t timeout, u_int32_t flags); + + virtual DB_TXN *get_DB_TXN() + { + return (DB_TXN *)imp(); + } + + virtual const DB_TXN *get_const_DB_TXN() const + { + return (const DB_TXN *)constimp(); + } + + static DbTxn* get_DbTxn(DB_TXN *txn) + { + return (DbTxn *)txn->api_internal; + } + + static const DbTxn* get_const_DbTxn(const DB_TXN *txn) + { + return (const DbTxn *)txn->api_internal; + } + + // For internal use only. + static DbTxn* wrap_DB_TXN(DB_TXN *txn); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbEnv::txn_begin() to get pointers to a DbTxn, + // and call DbTxn::abort() or DbTxn::commit rather than + // delete to release them. + // + DbTxn(); + // For internal use only. + DbTxn(DB_TXN *txn); + virtual ~DbTxn(); + + // no copying + DbTxn(const DbTxn &); + void operator = (const DbTxn &); +}; + +// +// Berkeley DB environment class. Provides functions for opening databases. +// User of this library can use this class as a starting point for +// developing a DB application - derive their application class from +// this one, add application control logic. +// +// Note that if you use the default constructor, you must explicitly +// call appinit() before any other db activity (e.g. opening files) +// +class _exported DbEnv +{ + friend class Db; + friend class DbLock; + friend class DbMpoolFile; + +private: + // Put this first to allow inlining with some C++ compilers (g++-2.95) + DEFINE_DB_CLASS(DbEnv); + +public: + // After using this constructor, you can set any needed + // parameters for the environment using the set_* methods. + // Then call open() to finish initializing the environment + // and attaching it to underlying files. + // + DbEnv(u_int32_t flags); + + virtual ~DbEnv(); + + // These methods match those in the C interface. + // + virtual int close(u_int32_t); + virtual int dbremove(DbTxn *txn, const char *name, const char *subdb, + u_int32_t flags); + virtual int dbrename(DbTxn *txn, const char *name, const char *subdb, + const char *newname, u_int32_t flags); + virtual void err(int, const char *, ...); + virtual void errx(const char *, ...); + virtual void *get_app_private() const; + virtual int open(const char *, u_int32_t, int); + virtual int remove(const char *, u_int32_t); + virtual int set_alloc(db_malloc_fcn_type, db_realloc_fcn_type, + db_free_fcn_type); + virtual void set_app_private(void *); + virtual int set_cachesize(u_int32_t, u_int32_t, int); + virtual int set_data_dir(const char *); + virtual int set_encrypt(const char *, int); + virtual void set_errcall(void (*)(const char *, char *)); + virtual void set_errfile(FILE *); + virtual void set_errpfx(const char *); + virtual int set_flags(u_int32_t, int); + virtual int set_feedback(void (*)(DbEnv *, int, int)); + virtual int set_lg_bsize(u_int32_t); + virtual int set_lg_dir(const char *); + virtual int set_lg_max(u_int32_t); + virtual int set_lg_regionmax(u_int32_t); + virtual int set_lk_conflicts(u_int8_t *, int); + virtual int set_lk_detect(u_int32_t); + virtual int set_lk_max(u_int32_t); + virtual int set_lk_max_lockers(u_int32_t); + virtual int set_lk_max_locks(u_int32_t); + virtual int set_lk_max_objects(u_int32_t); + virtual int set_mp_mmapsize(size_t); + virtual int set_paniccall(void (*)(DbEnv *, int)); + virtual int set_rpc_server(void *, char *, long, long, u_int32_t); + virtual int set_shm_key(long); + virtual int set_timeout(db_timeout_t timeout, u_int32_t flags); + virtual int set_tmp_dir(const char *); + virtual int set_tas_spins(u_int32_t); + virtual int set_tx_max(u_int32_t); + virtual int set_app_dispatch(int (*)(DbEnv *, + Dbt *, DbLsn *, db_recops)); + virtual int set_tx_timestamp(time_t *); + virtual int set_verbose(u_int32_t which, int onoff); + + // Version information. A static method so it can be obtained anytime. + // + static char *version(int *major, int *minor, int *patch); + + // Convert DB errors to strings + static char *strerror(int); + + // If an error is detected and the error call function + // or stream is set, a message is dispatched or printed. + // If a prefix is set, each message is prefixed. + // + // You can use set_errcall() or set_errfile() above to control + // error functionality. Alternatively, you can call + // set_error_stream() to force all errors to a C++ stream. + // It is unwise to mix these approaches. + // + virtual void set_error_stream(__DB_OSTREAMCLASS *); + + // used internally + static void runtime_error(const char *caller, int err, + int error_policy); + static void runtime_error_dbt(const char *caller, Dbt *dbt, + int error_policy); + static void runtime_error_lock_get(const char *caller, int err, + db_lockop_t op, db_lockmode_t mode, + const Dbt *obj, DbLock lock, int index, + int error_policy); + + // Lock functions + // + virtual int lock_detect(u_int32_t flags, u_int32_t atype, int *aborted); + virtual int lock_get(u_int32_t locker, u_int32_t flags, const Dbt *obj, + db_lockmode_t lock_mode, DbLock *lock); + virtual int lock_id(u_int32_t *idp); + virtual int lock_id_free(u_int32_t id); + virtual int lock_put(DbLock *lock); + virtual int lock_stat(DB_LOCK_STAT **statp, u_int32_t flags); + virtual int lock_vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], + int nlist, DB_LOCKREQ **elistp); + + // Log functions + // + virtual int log_archive(char **list[], u_int32_t flags); + static int log_compare(const DbLsn *lsn0, const DbLsn *lsn1); + virtual int log_cursor(DbLogc **cursorp, u_int32_t flags); + virtual int log_file(DbLsn *lsn, char *namep, size_t len); + virtual int log_flush(const DbLsn *lsn); + virtual int log_put(DbLsn *lsn, const Dbt *data, u_int32_t flags); + + virtual int log_stat(DB_LOG_STAT **spp, u_int32_t flags); + + // Mpool functions + // + virtual int memp_fcreate(DbMpoolFile **dbmfp, u_int32_t flags); + virtual int memp_register(int ftype, + pgin_fcn_type pgin_fcn, + pgout_fcn_type pgout_fcn); + virtual int memp_stat(DB_MPOOL_STAT + **gsp, DB_MPOOL_FSTAT ***fsp, u_int32_t flags); + virtual int memp_sync(DbLsn *lsn); + virtual int memp_trickle(int pct, int *nwrotep); + + // Transaction functions + // + virtual int txn_begin(DbTxn *pid, DbTxn **tid, u_int32_t flags); + virtual int txn_checkpoint(u_int32_t kbyte, u_int32_t min, u_int32_t flags); + virtual int txn_recover(DbPreplist *preplist, long count, + long *retp, u_int32_t flags); + virtual int txn_stat(DB_TXN_STAT **statp, u_int32_t flags); + + // Replication functions + // + virtual int rep_elect(int, int, u_int32_t, int *); + virtual int rep_process_message(Dbt *, Dbt *, int *); + virtual int rep_start(Dbt *, u_int32_t); + virtual int rep_stat(DB_REP_STAT **statp, u_int32_t flags); + virtual int set_rep_limit(u_int32_t, u_int32_t); + virtual int set_rep_transport(u_int32_t, + int (*)(DbEnv *, const Dbt *, const Dbt *, int, u_int32_t)); + + // Conversion functions + // + virtual DB_ENV *get_DB_ENV() + { + return (DB_ENV *)imp(); + } + + virtual const DB_ENV *get_const_DB_ENV() const + { + return (const DB_ENV *)constimp(); + } + + static DbEnv* get_DbEnv(DB_ENV *dbenv) + { + return (DbEnv *)dbenv->api1_internal; + } + + static const DbEnv* get_const_DbEnv(const DB_ENV *dbenv) + { + return (const DbEnv *)dbenv->api1_internal; + } + + // For internal use only. + static DbEnv* wrap_DB_ENV(DB_ENV *dbenv); + + // These are public only because they need to be called + // via C functions. They should never be called by users + // of this class. + // + static void _stream_error_function(const char *, char *); + static int _app_dispatch_intercept(DB_ENV *env, DBT *dbt, DB_LSN *lsn, + db_recops op); + static void _paniccall_intercept(DB_ENV *env, int errval); + static void _feedback_intercept(DB_ENV *env, int opcode, int pct); + static int _rep_send_intercept(DB_ENV *env, + const DBT *cntrl, const DBT *data, + int id, u_int32_t flags); + static void _destroy_check(const char *str, int isDbEnv); + +private: + void cleanup(); + int initialize(DB_ENV *env); + int error_policy(); + + // For internal use only. + DbEnv(DB_ENV *, u_int32_t flags); + + // no copying + DbEnv(const DbEnv &); + void operator = (const DbEnv &); + + // instance data + int construct_error_; + u_int32_t construct_flags_; + int (*app_dispatch_callback_)(DbEnv *, Dbt *, DbLsn *, db_recops); + void (*feedback_callback_)(DbEnv *, int, int); + void (*paniccall_callback_)(DbEnv *, int); + int (*pgin_callback_)(DbEnv *dbenv, db_pgno_t pgno, + void *pgaddr, Dbt *pgcookie); + int (*pgout_callback_)(DbEnv *dbenv, db_pgno_t pgno, + void *pgaddr, Dbt *pgcookie); + int (*rep_send_callback_)(DbEnv *, + const Dbt *, const Dbt *, int, u_int32_t); + + // class data + static __DB_OSTREAMCLASS *error_stream_; +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Table access classes +// + +// +// Represents a database table = a set of keys with associated values. +// +class _exported Db +{ + friend class DbEnv; + +private: + // Put this first to allow inlining with some C++ compilers (g++-2.95) + DEFINE_DB_CLASS(Db); + +public: + Db(DbEnv*, u_int32_t); // create a Db object, then call open() + virtual ~Db(); // does *not* call close. + + // These methods exactly match those in the C interface. + // + virtual int associate(DbTxn *txn, Db *secondary, + int (*callback)(Db *, const Dbt *, const Dbt *, Dbt *), + u_int32_t flags); + virtual int close(u_int32_t flags); + virtual int cursor(DbTxn *txnid, Dbc **cursorp, u_int32_t flags); + virtual int del(DbTxn *txnid, Dbt *key, u_int32_t flags); + virtual void err(int, const char *, ...); + virtual void errx(const char *, ...); + virtual int fd(int *fdp); + virtual int get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); + virtual void *get_app_private() const; + virtual int get_byteswapped(int *); + virtual int get_type(DBTYPE *); + virtual int join(Dbc **curslist, Dbc **dbcp, u_int32_t flags); + virtual int key_range(DbTxn *, Dbt *, DB_KEY_RANGE *, u_int32_t); + virtual int open(DbTxn *txnid, + const char *, const char *subname, DBTYPE, u_int32_t, int); + virtual int pget(DbTxn *txnid, Dbt *key, Dbt *pkey, Dbt *data, + u_int32_t flags); + virtual int put(DbTxn *, Dbt *, Dbt *, u_int32_t); + virtual int remove(const char *, const char *, u_int32_t); + virtual int rename(const char *, const char *, const char *, u_int32_t); + virtual int set_alloc(db_malloc_fcn_type, db_realloc_fcn_type, + db_free_fcn_type); + virtual void set_app_private(void *); + virtual int set_append_recno(int (*)(Db *, Dbt *, db_recno_t)); + virtual int set_bt_compare(bt_compare_fcn_type); /*deprecated*/ + virtual int set_bt_compare(int (*)(Db *, const Dbt *, const Dbt *)); + virtual int set_bt_maxkey(u_int32_t); + virtual int set_bt_minkey(u_int32_t); + virtual int set_bt_prefix(bt_prefix_fcn_type); /*deprecated*/ + virtual int set_bt_prefix(size_t (*)(Db *, const Dbt *, const Dbt *)); + virtual int set_cachesize(u_int32_t, u_int32_t, int); + virtual int set_cache_priority(DB_CACHE_PRIORITY); + virtual int set_dup_compare(dup_compare_fcn_type); /*deprecated*/ + virtual int set_dup_compare(int (*)(Db *, const Dbt *, const Dbt *)); + virtual int set_encrypt(const char *, int); + virtual void set_errcall(void (*)(const char *, char *)); + virtual void set_errfile(FILE *); + virtual void set_errpfx(const char *); + virtual int set_feedback(void (*)(Db *, int, int)); + virtual int set_flags(u_int32_t); + virtual int set_h_ffactor(u_int32_t); + virtual int set_h_hash(h_hash_fcn_type); /*deprecated*/ + virtual int set_h_hash(u_int32_t (*)(Db *, const void *, u_int32_t)); + virtual int set_h_nelem(u_int32_t); + virtual int set_lorder(int); + virtual int set_pagesize(u_int32_t); + virtual int set_paniccall(void (*)(DbEnv *, int)); + virtual int set_re_delim(int); + virtual int set_re_len(u_int32_t); + virtual int set_re_pad(int); + virtual int set_re_source(char *); + virtual int set_q_extentsize(u_int32_t); + virtual int stat(void *sp, u_int32_t flags); + virtual int sync(u_int32_t flags); + virtual int truncate(DbTxn *, u_int32_t *, u_int32_t); + virtual int upgrade(const char *name, u_int32_t flags); + virtual int verify(const char *, const char *, __DB_OSTREAMCLASS *, u_int32_t); + + // These additional methods are not in the C interface, and + // are only available for C++. + // + virtual void set_error_stream(__DB_OSTREAMCLASS *); + + virtual DB *get_DB() + { + return (DB *)imp(); + } + + virtual const DB *get_const_DB() const + { + return (const DB *)constimp(); + } + + static Db* get_Db(DB *db) + { + return (Db *)db->api_internal; + } + + static const Db* get_const_Db(const DB *db) + { + return (const Db *)db->api_internal; + } + +private: + // no copying + Db(const Db &); + Db &operator = (const Db &); + + void cleanup(); + int initialize(); + int error_policy(); + + // instance data + DbEnv *env_; + int construct_error_; + u_int32_t flags_; + u_int32_t construct_flags_; + +public: + // These are public only because they need to be called + // via C callback functions. They should never be used by + // external users of this class. + // + int (*append_recno_callback_)(Db *, Dbt *, db_recno_t); + int (*associate_callback_)(Db *, const Dbt *, const Dbt *, Dbt *); + int (*bt_compare_callback_)(Db *, const Dbt *, const Dbt *); + size_t (*bt_prefix_callback_)(Db *, const Dbt *, const Dbt *); + int (*dup_compare_callback_)(Db *, const Dbt *, const Dbt *); + void (*feedback_callback_)(Db *, int, int); + u_int32_t (*h_hash_callback_)(Db *, const void *, u_int32_t); +}; + +// +// A chunk of data, maybe a key or value. +// +class _exported Dbt : private DBT +{ + friend class Dbc; + friend class Db; + friend class DbEnv; + friend class DbLogc; + +public: + + // key/data + void *get_data() const { return data; } + void set_data(void *value) { data = value; } + + // key/data length + u_int32_t get_size() const { return size; } + void set_size(u_int32_t value) { size = value; } + + // RO: length of user buffer. + u_int32_t get_ulen() const { return ulen; } + void set_ulen(u_int32_t value) { ulen = value; } + + // RO: get/put record length. + u_int32_t get_dlen() const { return dlen; } + void set_dlen(u_int32_t value) { dlen = value; } + + // RO: get/put record offset. + u_int32_t get_doff() const { return doff; } + void set_doff(u_int32_t value) { doff = value; } + + // flags + u_int32_t get_flags() const { return flags; } + void set_flags(u_int32_t value) { flags = value; } + + // Conversion functions + DBT *get_DBT() { return (DBT *)this; } + const DBT *get_const_DBT() const { return (const DBT *)this; } + + static Dbt* get_Dbt(DBT *dbt) { return (Dbt *)dbt; } + static const Dbt* get_const_Dbt(const DBT *dbt) + { return (const Dbt *)dbt; } + + Dbt(void *data, u_int32_t size); + Dbt(); + ~Dbt(); + Dbt(const Dbt &); + Dbt &operator = (const Dbt &); + +private: + // Note: no extra data appears in this class (other than + // inherited from DBT) since we need DBT and Dbt objects + // to have interchangable pointers. + // + // When subclassing this class, remember that callback + // methods like bt_compare, bt_prefix, dup_compare may + // internally manufacture DBT objects (which later are + // cast to Dbt), so such callbacks might receive objects + // not of your subclassed type. +}; + +class _exported Dbc : protected DBC +{ + friend class Db; + +public: + int close(); + int count(db_recno_t *countp, u_int32_t flags); + int del(u_int32_t flags); + int dup(Dbc** cursorp, u_int32_t flags); + int get(Dbt* key, Dbt *data, u_int32_t flags); + int pget(Dbt* key, Dbt* pkey, Dbt *data, u_int32_t flags); + int put(Dbt* key, Dbt *data, u_int32_t flags); + +private: + // No data is permitted in this class (see comment at top) + + // Note: use Db::cursor() to get pointers to a Dbc, + // and call Dbc::close() rather than delete to release them. + // + Dbc(); + ~Dbc(); + + // no copying + Dbc(const Dbc &); + Dbc &operator = (const Dbc &); +}; + +class _exported DbLogc : protected DB_LOGC +{ + friend class DbEnv; + +public: + int close(u_int32_t _flags); + int get(DbLsn *lsn, Dbt *data, u_int32_t _flags); + +private: + // No data is permitted in this class (see comment at top) + + // Note: use Db::cursor() to get pointers to a Dbc, + // and call Dbc::close() rather than delete to release them. + // + DbLogc(); + ~DbLogc(); + + // no copying + DbLogc(const Dbc &); + DbLogc &operator = (const Dbc &); +}; +#endif /* !_DB_CXX_H_ */ diff --git a/db/dbinc/db_dispatch.h b/db/dbinc/db_dispatch.h new file mode 100644 index 000000000..71502603c --- /dev/null +++ b/db/dbinc/db_dispatch.h @@ -0,0 +1,105 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Id: db_dispatch.h,v 11.30 2002/06/20 19:34:03 margo Exp + */ + +#ifndef _DB_DISPATCH_H_ +#define _DB_DISPATCH_H_ + +/* + * Declarations and typedefs for the list of transaction IDs used during + * recovery. This is a generic list used to pass along whatever information + * we need during recovery. + */ +typedef enum { + TXNLIST_DELETE, + TXNLIST_LSN, + TXNLIST_PGNO, + TXNLIST_TXNID +} db_txnlist_type; + +#define DB_TXNLIST_MASK(hp, n) (n % hp->nslots) +struct __db_txnhead { + u_int32_t maxid; /* Maximum transaction id. */ + DB_LSN maxlsn; /* Maximum commit lsn. */ + DB_LSN ckplsn; /* LSN of last retained checkpoint. */ + DB_LSN trunc_lsn; /* Lsn to which we are going to truncate; + * make sure we abort anyone after this. */ + int32_t generation; /* Current generation number. */ + int32_t gen_alloc; /* Number of generations allocated. */ + struct { + int32_t generation; + u_int32_t txn_min; + u_int32_t txn_max; + } *gen_array; /* Array of txnids associted with a gen. */ + int nslots; + LIST_HEAD(__db_headlink, __db_txnlist) head[1]; +}; + +struct __db_txnlist { + db_txnlist_type type; + LIST_ENTRY(__db_txnlist) links; + union { + struct { + u_int32_t txnid; + int32_t generation; + int32_t status; + } t; + struct { + int32_t ntxns; + int32_t maxn; + DB_LSN *lsn_array; + } l; + struct { + int32_t nentries; + int32_t maxentry; + int32_t locked; + char *fname; + int32_t fileid; + db_pgno_t *pgno_array; + u_int8_t uid[DB_FILE_ID_LEN]; + } p; + } u; +}; + +/* + * Flag value for __db_txnlist_lsnadd. Distinguish whether we are replacing + * an entry in the transaction list or adding a new one. + */ +#define TXNLIST_NEW 0x1 + +#define DB_user_BEGIN 10000 + +#endif /* !_DB_DISPATCH_H_ */ diff --git a/db/dbinc/db_int.in b/db/dbinc/db_int.in new file mode 100644 index 000000000..3f8a146bf --- /dev/null +++ b/db/dbinc/db_int.in @@ -0,0 +1,473 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_int.in,v 11.105 2002/08/07 15:37:06 bostic Exp + */ + +#ifndef _DB_INTERNAL_H_ +#define _DB_INTERNAL_H_ + +/******************************************************* + * System includes, db.h, a few general DB includes. The DB includes are + * here because it's OK if db_int.h includes queue structure declarations. + *******************************************************/ +#ifndef NO_SYSTEM_INCLUDES +#if defined(__STDC__) || defined(__cplusplus) +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <errno.h> +#endif + +#include "db.h" + +#include "dbinc/queue.h" +#include "dbinc/shqueue.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/******************************************************* + * General purpose constants and macros. + *******************************************************/ +#define UINT16_T_MAX 0xffff /* Maximum 16 bit unsigned. */ +#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */ + +#define MEGABYTE 1048576 +#define GIGABYTE 1073741824 + +#define MS_PER_SEC 1000 /* Milliseconds in a second. */ +#define USEC_PER_MS 1000 /* Microseconds in a millisecond. */ + +#define RECNO_OOB 0 /* Illegal record number. */ + +/* Test for a power-of-two (tests true for zero, which doesn't matter here). */ +#define POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0) + +/* Test for valid page sizes. */ +#define DB_MIN_PGSIZE 0x000200 /* Minimum page size (512). */ +#define DB_MAX_PGSIZE 0x010000 /* Maximum page size (65536). */ +#define IS_VALID_PAGESIZE(x) \ + (POWER_OF_TWO(x) && (x) >= DB_MIN_PGSIZE && ((x) <= DB_MAX_PGSIZE)) + +/* Minimum number of pages cached, by default. */ +#define DB_MINPAGECACHE 16 + +/* + * If we are unable to determine the underlying filesystem block size, use + * 8K on the grounds that most OS's use less than 8K for a VM page size. + */ +#define DB_DEF_IOSIZE (8 * 1024) + +/* + * Aligning items to particular sizes or in pages or memory. + * + * db_align_t -- + * Largest integral type, used to align structures in memory. We don't store + * floating point types in structures, so integral types should be sufficient + * (and we don't have to worry about systems that store floats in other than + * power-of-2 numbers of bytes). Additionally this fixes compiler that rewrite + * structure assignments and ANSI C memcpy calls to be in-line instructions + * that happen to require alignment. Note: this alignment isn't sufficient for + * mutexes, which depend on things like cache line alignment. Mutex alignment + * is handled separately, in mutex.h. + * + * db_alignp_t -- + * Integral type that's the same size as a pointer. There are places where + * DB modifies pointers by discarding the bottom bits to guarantee alignment. + * We can't use db_align_t, it may be larger than the pointer, and compilers + * get upset about that. So far we haven't run on any machine where there + * isn't an integral type the same size as a pointer -- here's hoping. + */ +@db_align_t_decl@ +@db_alignp_t_decl@ + +/* Align an integer to a specific boundary. */ +#undef ALIGN +#define ALIGN(v, bound) (((v) + (bound) - 1) & ~(((u_int)bound) - 1)) + +/* + * Print an address as a u_long (a u_long is the largest type we can print + * portably). Most 64-bit systems have made longs 64-bits, so this should + * work. + */ +#define P_TO_ULONG(p) ((u_long)(db_alignp_t)(p)) + +/* + * Convert a pointer to a small integral value. + * + * The (u_int16_t)(db_alignp_t) cast avoids warnings: the (db_alignp_t) cast + * converts the value to an integral type, and the (u_int16_t) cast converts + * it to a small integral type so we don't get complaints when we assign the + * final result to an integral type smaller than db_alignp_t. + */ +#define P_TO_UINT32(p) ((u_int32_t)(db_alignp_t)(p)) +#define P_TO_UINT16(p) ((u_int16_t)(db_alignp_t)(p)) + +/* + * There are several on-page structures that are declared to have a number of + * fields followed by a variable length array of items. The structure size + * without including the variable length array or the address of the first of + * those elements can be found using SSZ. + * + * This macro can also be used to find the offset of a structure element in a + * structure. This is used in various places to copy structure elements from + * unaligned memory references, e.g., pointers into a packed page. + * + * There are two versions because compilers object if you take the address of + * an array. + */ +#undef SSZ +#define SSZ(name, field) P_TO_UINT16(&(((name *)0)->field)) + +#undef SSZA +#define SSZA(name, field) P_TO_UINT16(&(((name *)0)->field[0])) + +/* Structure used to print flag values. */ +typedef struct __fn { + u_int32_t mask; /* Flag value. */ + const char *name; /* Flag name. */ +} FN; + +/* Set, clear and test flags. */ +#define FLD_CLR(fld, f) (fld) &= ~(f) +#define FLD_ISSET(fld, f) ((fld) & (f)) +#define FLD_SET(fld, f) (fld) |= (f) +#define F_CLR(p, f) (p)->flags &= ~(f) +#define F_ISSET(p, f) ((p)->flags & (f)) +#define F_SET(p, f) (p)->flags |= (f) +#define LF_CLR(f) ((flags) &= ~(f)) +#define LF_ISSET(f) ((flags) & (f)) +#define LF_SET(f) ((flags) |= (f)) + +/* Display separator string. */ +#undef DB_LINE +#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + +/* Unused, or not-used-yet variable. "Shut that bloody compiler up!" */ +#define COMPQUIET(n, v) (n) = (v) + +/******************************************************* + * API return values + *******************************************************/ + /* + * Return values that are OK for each different call. Most calls have + * a standard 'return of 0 is only OK value', but some, like db->get + * have DB_NOTFOUND as a return value, but it really isn't an error. + */ +#define DB_RETOK_STD(ret) ((ret) == 0) +#define DB_RETOK_DBCDEL(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \ + (ret) == DB_NOTFOUND) +#define DB_RETOK_DBCGET(ret) DB_RETOK_DBGET(ret) +#define DB_RETOK_DBCPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST || \ + (ret) == DB_NOTFOUND) +#define DB_RETOK_DBDEL(ret) ((ret) == 0 || (ret) == DB_NOTFOUND) +#define DB_RETOK_DBGET(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \ + (ret) == DB_NOTFOUND) +#define DB_RETOK_DBPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST) +#define DB_RETOK_LGGET(ret) ((ret) == 0 || (ret) == DB_NOTFOUND) +#define DB_RETOK_MPGET(ret) ((ret) == 0 || (ret) == DB_PAGE_NOTFOUND) +#define DB_RETOK_REPPMSG(ret) ((ret) == 0 || (ret) == DB_REP_NEWMASTER || \ + (ret) == DB_REP_NEWSITE) + +/******************************************************* + * Files. + *******************************************************/ + /* + * We use 1024 as the maximum path length. It's too hard to figure out what + * the real path length is, as it was traditionally stored in <sys/param.h>, + * and that file isn't always available. + */ +#undef MAXPATHLEN +#define MAXPATHLEN 1024 + +#define PATH_DOT "." /* Current working directory. */ +#define PATH_SEPARATOR "/" /* Path separator character(s). */ + +/* + * Flags understood by __os_open. + */ +#define DB_OSO_CREATE 0x0001 /* POSIX: O_CREAT */ +#define DB_OSO_DIRECT 0x0002 /* Don't buffer the file in the OS. */ +#define DB_OSO_EXCL 0x0004 /* POSIX: O_EXCL */ +#define DB_OSO_LOG 0x0008 /* Opening a log file. */ +#define DB_OSO_RDONLY 0x0010 /* POSIX: O_RDONLY */ +#define DB_OSO_REGION 0x0020 /* Opening a region file. */ +#define DB_OSO_SEQ 0x0040 /* Expected sequential access. */ +#define DB_OSO_TEMP 0x0080 /* Remove after last close. */ +#define DB_OSO_TRUNC 0x0100 /* POSIX: O_TRUNC */ + +/* + * Seek options understood by __os_seek. + */ +typedef enum { + DB_OS_SEEK_CUR, /* POSIX: SEEK_CUR */ + DB_OS_SEEK_END, /* POSIX: SEEK_END */ + DB_OS_SEEK_SET /* POSIX: SEEK_SET */ +} DB_OS_SEEK; + +/******************************************************* + * Environment. + *******************************************************/ +/* Type passed to __db_appname(). */ +typedef enum { + DB_APP_NONE=0, /* No type (region). */ + DB_APP_DATA, /* Data file. */ + DB_APP_LOG, /* Log file. */ + DB_APP_TMP /* Temporary file. */ +} APPNAME; + +/* + * CDB_LOCKING CDB product locking. + * CRYPTO_ON Security has been configured. + * LOCKING_ON Locking has been configured. + * LOGGING_ON Logging has been configured. + * MPOOL_ON Memory pool has been configured. + * RPC_ON RPC has been configured. + * TXN_ON Transactions have been configured. + */ +#define CDB_LOCKING(dbenv) F_ISSET(dbenv, DB_ENV_CDB) +#define CRYPTO_ON(dbenv) ((dbenv)->crypto_handle != NULL) +#define LOCKING_ON(dbenv) ((dbenv)->lk_handle != NULL) +#define LOGGING_ON(dbenv) ((dbenv)->lg_handle != NULL) +#define MPOOL_ON(dbenv) ((dbenv)->mp_handle != NULL) +#define RPC_ON(dbenv) ((dbenv)->cl_handle != NULL) +#define TXN_ON(dbenv) ((dbenv)->tx_handle != NULL) + +/* + * STD_LOCKING Standard locking, that is, locking was configured and CDB + * was not. We do not do locking in off-page duplicate trees, + * so we check for that in the cursor first. + */ +#define STD_LOCKING(dbc) \ + (!F_ISSET(dbc, DBC_OPD) && \ + !CDB_LOCKING((dbc)->dbp->dbenv) && LOCKING_ON((dbc)->dbp->dbenv)) + +/* + * IS_RECOVERING: The system is running recovery. + */ +#define IS_RECOVERING(dbenv) \ + (LOGGING_ON(dbenv) && \ + F_ISSET((DB_LOG *)(dbenv)->lg_handle, DBLOG_RECOVER)) + +/* Initialization methods are often illegal before/after open is called. */ +#define ENV_ILLEGAL_AFTER_OPEN(dbenv, name) \ + if (F_ISSET((dbenv), DB_ENV_OPEN_CALLED)) \ + return (__db_mi_open(dbenv, name, 1)); +#define ENV_ILLEGAL_BEFORE_OPEN(dbenv, name) \ + if (!F_ISSET((dbenv), DB_ENV_OPEN_CALLED)) \ + return (__db_mi_open(dbenv, name, 0)); + +/* We're not actually user hostile, honest. */ +#define ENV_REQUIRES_CONFIG(dbenv, handle, i, flags) \ + if (handle == NULL) \ + return (__db_env_config(dbenv, i, flags)); + +/******************************************************* + * Database Access Methods. + *******************************************************/ +/* + * DB_IS_THREADED -- + * The database handle is free-threaded (was opened with DB_THREAD). + */ +#define DB_IS_THREADED(dbp) \ + ((dbp)->mutexp != NULL) + +/* Initialization methods are often illegal before/after open is called. */ +#define DB_ILLEGAL_AFTER_OPEN(dbp, name) \ + if (F_ISSET((dbp), DB_AM_OPEN_CALLED)) \ + return (__db_mi_open((dbp)->dbenv, name, 1)); +#define DB_ILLEGAL_BEFORE_OPEN(dbp, name) \ + if (!F_ISSET((dbp), DB_AM_OPEN_CALLED)) \ + return (__db_mi_open((dbp)->dbenv, name, 0)); +/* Some initialization methods are illegal if environment isn't local. */ +#define DB_ILLEGAL_IN_ENV(dbp, name) \ + if (!F_ISSET((dbp)->dbenv, DB_ENV_DBLOCAL)) \ + return (__db_mi_env((dbp)->dbenv, name)); +#define DB_ILLEGAL_METHOD(dbp, flags) { \ + int __ret; \ + if ((__ret = __dbh_am_chk(dbp, flags)) != 0) \ + return (__ret); \ +} + +/* + * Common DBC->internal fields. Each access method adds additional fields + * to this list, but the initial fields are common. + */ +#define __DBC_INTERNAL \ + DBC *opd; /* Off-page duplicate cursor. */\ + \ + void *page; /* Referenced page. */ \ + db_pgno_t root; /* Tree root. */ \ + db_pgno_t pgno; /* Referenced page number. */ \ + db_indx_t indx; /* Referenced key item index. */\ + \ + DB_LOCK lock; /* Cursor lock. */ \ + db_lockmode_t lock_mode; /* Lock mode. */ + +struct __dbc_internal { + __DBC_INTERNAL +}; + +/* Actions that __db_master_update can take. */ +typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action; + +/* + * Access-method-common macro for determining whether a cursor + * has been initialized. + */ +#define IS_INITIALIZED(dbc) ((dbc)->internal->pgno != PGNO_INVALID) + +/* Free the callback-allocated buffer, if necessary, hanging off of a DBT. */ +#define FREE_IF_NEEDED(sdbp, dbt) \ + if (F_ISSET((dbt), DB_DBT_APPMALLOC)) { \ + __os_ufree((sdbp)->dbenv, (dbt)->data); \ + F_CLR((dbt), DB_DBT_APPMALLOC); \ + } + +/* + * Use memory belonging to object "owner" to return the results of + * any no-DBT-flag get ops on cursor "dbc". + */ +#define SET_RET_MEM(dbc, owner) \ + do { \ + (dbc)->rskey = &(owner)->my_rskey; \ + (dbc)->rkey = &(owner)->my_rkey; \ + (dbc)->rdata = &(owner)->my_rdata; \ + } while (0) + +/* Use the return-data memory src is currently set to use in dest as well. */ +#define COPY_RET_MEM(src, dest) \ + do { \ + (dest)->rskey = (src)->rskey; \ + (dest)->rkey = (src)->rkey; \ + (dest)->rdata = (src)->rdata; \ + } while (0) + +/* Reset the returned-memory pointers to their defaults. */ +#define RESET_RET_MEM(dbc) \ + do { \ + (dbc)->rskey = &(dbc)->my_rskey; \ + (dbc)->rkey = &(dbc)->my_rkey; \ + (dbc)->rdata = &(dbc)->my_rdata; \ + } while (0) + +/******************************************************* + * Mpool. + *******************************************************/ +/* + * File types for DB access methods. Negative numbers are reserved to DB. + */ +#define DB_FTYPE_SET -1 /* Call pgin/pgout functions. */ +#define DB_FTYPE_NOTSET 0 /* Don't call... */ + +/* Structure used as the DB pgin/pgout pgcookie. */ +typedef struct __dbpginfo { + size_t db_pagesize; /* Underlying page size. */ + u_int32_t flags; /* Some DB_AM flags needed. */ + DBTYPE type; /* DB type */ +} DB_PGINFO; + +/******************************************************* + * Log. + *******************************************************/ +/* Initialize an LSN to 'zero'. */ +#define ZERO_LSN(LSN) do { \ + (LSN).file = 0; \ + (LSN).offset = 0; \ +} while (0) +#define IS_ZERO_LSN(LSN) ((LSN).file == 0) + +#define IS_INIT_LSN(LSN) ((LSN).file == 1 && (LSN).offset == 0) +#define INIT_LSN(LSN) do { \ + (LSN).file = 1; \ + (LSN).offset = 0; \ +} while (0) + +#define MAX_LSN(LSN) do { \ + (LSN).file = UINT32_T_MAX; \ + (LSN).offset = UINT32_T_MAX; \ +} while (0) +#define IS_MAX_LSN(LSN) \ + ((LSN).file == UINT32_T_MAX && (LSN).offset == UINT32_T_MAX) + +/* If logging is turned off, smash the lsn. */ +#define LSN_NOT_LOGGED(LSN) do { \ + (LSN).file = 0; \ + (LSN).offset = 1; \ +} while (0) +#define IS_NOT_LOGGED_LSN(LSN) \ + ((LSN).file == 0 && (LSN).offset == 1) + +/* + * Test if the environment is currently logging changes. If we're in + * recovery or we're a replication client, we don't need to log changes + * because they're already in the log, even though we have a fully functional + * log system. + */ +#define DBENV_LOGGING(dbenv) \ + (LOGGING_ON(dbenv) && !F_ISSET((dbenv), DB_ENV_REP_CLIENT) && \ + (!IS_RECOVERING(dbenv))) + +/* + * Test if we need to log a change. Note that the DBC_RECOVER flag is set + * when we're in abort, as well as during recovery; thus DBC_LOGGING may be + * false for a particular dbc even when DBENV_LOGGING is true. + * + * We explicitly use LOGGING_ON/DB_ENV_REP_CLIENT here because we don't + * want to have to pull in the log headers, which IS_RECOVERING (and thus + * DBENV_LOGGING) rely on, and because DBC_RECOVER should be set anytime + * IS_RECOVERING would be true. + */ +#define DBC_LOGGING(dbc) \ + (LOGGING_ON((dbc)->dbp->dbenv) && !F_ISSET((dbc), DBC_RECOVER) && \ + !F_ISSET((dbc)->dbp->dbenv, DB_ENV_REP_CLIENT)) + +/******************************************************* + * Txn. + *******************************************************/ +#define DB_NONBLOCK(C) ((C)->txn != NULL && F_ISSET((C)->txn, TXN_NOWAIT)) +#define IS_SUBTRANSACTION(txn) \ + ((txn) != NULL && (txn)->parent != NULL) + +/******************************************************* + * Crypto. + *******************************************************/ +#define DB_IV_BYTES 16 /* Bytes per IV */ +#define DB_MAC_KEY 20 /* Bytes per MAC checksum */ + +/******************************************************* + * Forward structure declarations. + *******************************************************/ +struct __db_reginfo_t; typedef struct __db_reginfo_t REGINFO; +struct __db_txnhead; typedef struct __db_txnhead DB_TXNHEAD; +struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST; +struct __vrfy_childinfo; typedef struct __vrfy_childinfo VRFY_CHILDINFO; +struct __vrfy_dbinfo; typedef struct __vrfy_dbinfo VRFY_DBINFO; +struct __vrfy_pageinfo; typedef struct __vrfy_pageinfo VRFY_PAGEINFO; + +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Remaining general DB includes. + *******************************************************/ +@db_int_def@ + +#include "dbinc/globals.h" +#include "dbinc/debug.h" +#include "dbinc/mutex.h" +#include "dbinc/region.h" +#include "dbinc_auto/mutex_ext.h" /* XXX: Include after region.h. */ +#include "dbinc_auto/env_ext.h" +#include "dbinc/os.h" +#include "dbinc_auto/clib_ext.h" +#include "dbinc_auto/common_ext.h" + +#endif /* !_DB_INTERNAL_H_ */ diff --git a/db/dbinc/db_join.h b/db/dbinc/db_join.h new file mode 100644 index 000000000..487ce3eeb --- /dev/null +++ b/db/dbinc/db_join.h @@ -0,0 +1,31 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998-2002 + * Sleepycat Software. All rights reserved. + * + * @(#)db_join.h 11.1 (Sleepycat) 7/25/99 + */ + +#ifndef _DB_JOIN_H_ +#define _DB_JOIN_H_ + +/* + * Joins use a join cursor that is similar to a regular DB cursor except + * that it only supports c_get and c_close functionality. Also, it does + * not support the full range of flags for get. + */ +typedef struct __join_cursor { + u_int8_t *j_exhausted; /* Array of flags; is cursor i exhausted? */ + DBC **j_curslist; /* Array of cursors in the join: constant. */ + DBC **j_fdupcurs; /* Cursors w/ first intances of current dup. */ + DBC **j_workcurs; /* Scratch cursor copies to muck with. */ + DB *j_primary; /* Primary dbp. */ + DBT j_key; /* Used to do lookups. */ + DBT j_rdata; /* Memory used for data return. */ + u_int32_t j_ncurs; /* How many cursors do we have? */ +#define JOIN_RETRY 0x01 /* Error on primary get; re-return same key. */ + u_int32_t flags; +} JOIN_CURSOR; + +#endif /* !_DB_JOIN_H_ */ diff --git a/db/dbinc/db_page.h b/db/dbinc/db_page.h new file mode 100644 index 000000000..847a7a010 --- /dev/null +++ b/db/dbinc/db_page.h @@ -0,0 +1,648 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_page.h,v 11.51 2002/08/06 06:37:07 bostic Exp + */ + +#ifndef _DB_PAGE_H_ +#define _DB_PAGE_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * DB page formats. + * + * !!! + * This implementation requires that values within the following structures + * NOT be padded -- note, ANSI C permits random padding within structures. + * If your compiler pads randomly you can just forget ever making DB run on + * your system. In addition, no data type can require larger alignment than + * its own size, e.g., a 4-byte data element may not require 8-byte alignment. + * + * Note that key/data lengths are often stored in db_indx_t's -- this is + * not accidental, nor does it limit the key/data size. If the key/data + * item fits on a page, it's guaranteed to be small enough to fit into a + * db_indx_t, and storing it in one saves space. + */ + +#define PGNO_INVALID 0 /* Invalid page number in any database. */ +#define PGNO_BASE_MD 0 /* Base database: metadata page number. */ + +/* Page types. */ +#define P_INVALID 0 /* Invalid page type. */ +#define __P_DUPLICATE 1 /* Duplicate. DEPRECATED in 3.1 */ +#define P_HASH 2 /* Hash. */ +#define P_IBTREE 3 /* Btree internal. */ +#define P_IRECNO 4 /* Recno internal. */ +#define P_LBTREE 5 /* Btree leaf. */ +#define P_LRECNO 6 /* Recno leaf. */ +#define P_OVERFLOW 7 /* Overflow. */ +#define P_HASHMETA 8 /* Hash metadata page. */ +#define P_BTREEMETA 9 /* Btree metadata page. */ +#define P_QAMMETA 10 /* Queue metadata page. */ +#define P_QAMDATA 11 /* Queue data page. */ +#define P_LDUP 12 /* Off-page duplicate leaf. */ +#define P_PAGETYPE_MAX 13 + +/* + * When we create pages in mpool, we ask mpool to clear some number of bytes + * in the header. This number must be at least as big as the regular page + * headers and cover enough of the btree and hash meta-data pages to obliterate + * the page type. + */ +#define DB_PAGE_DB_LEN 32 +#define DB_PAGE_QUEUE_LEN 0 + +/************************************************************************ + GENERIC METADATA PAGE HEADER + * + * !!! + * The magic and version numbers have to be in the same place in all versions + * of the metadata page as the application may not have upgraded the database. + ************************************************************************/ +typedef struct _dbmeta33 { + DB_LSN lsn; /* 00-07: LSN. */ + db_pgno_t pgno; /* 08-11: Current page number. */ + u_int32_t magic; /* 12-15: Magic number. */ + u_int32_t version; /* 16-19: Version. */ + u_int32_t pagesize; /* 20-23: Pagesize. */ + u_int8_t encrypt_alg; /* 24: Encryption algorithm. */ + u_int8_t type; /* 25: Page type. */ +#define DBMETA_CHKSUM 0x01 + u_int8_t metaflags; /* 26: Meta-only flags */ + u_int8_t unused1; /* 27: Unused. */ + u_int32_t free; /* 28-31: Free list page number. */ + db_pgno_t last_pgno; /* 32-35: Page number of last page in db. */ + u_int32_t unused3; /* 36-39: Unused. */ + u_int32_t key_count; /* 40-43: Cached key count. */ + u_int32_t record_count; /* 44-47: Cached record count. */ + u_int32_t flags; /* 48-51: Flags: unique to each AM. */ + /* 52-71: Unique file ID. */ + u_int8_t uid[DB_FILE_ID_LEN]; +} DBMETA33, DBMETA; + +/************************************************************************ + BTREE METADATA PAGE LAYOUT + ************************************************************************/ +typedef struct _btmeta33 { +#define BTM_DUP 0x001 /* Duplicates. */ +#define BTM_RECNO 0x002 /* Recno tree. */ +#define BTM_RECNUM 0x004 /* Btree: maintain record count. */ +#define BTM_FIXEDLEN 0x008 /* Recno: fixed length records. */ +#define BTM_RENUMBER 0x010 /* Recno: renumber on insert/delete. */ +#define BTM_SUBDB 0x020 /* Subdatabases. */ +#define BTM_DUPSORT 0x040 /* Duplicates are sorted. */ +#define BTM_MASK 0x07f + DBMETA dbmeta; /* 00-71: Generic meta-data header. */ + + u_int32_t maxkey; /* 72-75: Btree: Maxkey. */ + u_int32_t minkey; /* 76-79: Btree: Minkey. */ + u_int32_t re_len; /* 80-83: Recno: fixed-length record length. */ + u_int32_t re_pad; /* 84-87: Recno: fixed-length record pad. */ + u_int32_t root; /* 88-91: Root page. */ + u_int32_t unused[92]; /* 92-459: Unused space */ + u_int32_t crypto_magic; /* 460-463: Crypto magic number */ + u_int32_t trash[3]; /* 464-475: Trash space - Do not use */ + u_int8_t iv[DB_IV_BYTES]; /* 476-495: Crypto IV */ + u_int8_t chksum[DB_MAC_KEY]; /* 496-511: Page chksum */ + + /* + * Minimum page size is 512. + */ +} BTMETA33, BTMETA; + +/************************************************************************ + HASH METADATA PAGE LAYOUT + ************************************************************************/ +typedef struct _hashmeta33 { +#define DB_HASH_DUP 0x01 /* Duplicates. */ +#define DB_HASH_SUBDB 0x02 /* Subdatabases. */ +#define DB_HASH_DUPSORT 0x04 /* Duplicates are sorted. */ + DBMETA dbmeta; /* 00-71: Generic meta-data page header. */ + + u_int32_t max_bucket; /* 72-75: ID of Maximum bucket in use */ + u_int32_t high_mask; /* 76-79: Modulo mask into table */ + u_int32_t low_mask; /* 80-83: Modulo mask into table lower half */ + u_int32_t ffactor; /* 84-87: Fill factor */ + u_int32_t nelem; /* 88-91: Number of keys in hash table */ + u_int32_t h_charkey; /* 92-95: Value of hash(CHARKEY) */ +#define NCACHED 32 /* number of spare points */ + /* 96-223: Spare pages for overflow */ + u_int32_t spares[NCACHED]; + u_int32_t unused[59]; /* 224-459: Unused space */ + u_int32_t crypto_magic; /* 460-463: Crypto magic number */ + u_int32_t trash[3]; /* 464-475: Trash space - Do not use */ + u_int8_t iv[DB_IV_BYTES]; /* 476-495: Crypto IV */ + u_int8_t chksum[DB_MAC_KEY]; /* 496-511: Page chksum */ + + /* + * Minimum page size is 512. + */ +} HMETA33, HMETA; + +/************************************************************************ + QUEUE METADATA PAGE LAYOUT + ************************************************************************/ +/* + * QAM Meta data page structure + * + */ +typedef struct _qmeta33 { + DBMETA dbmeta; /* 00-71: Generic meta-data header. */ + + u_int32_t first_recno; /* 72-75: First not deleted record. */ + u_int32_t cur_recno; /* 76-79: Next recno to be allocated. */ + u_int32_t re_len; /* 80-83: Fixed-length record length. */ + u_int32_t re_pad; /* 84-87: Fixed-length record pad. */ + u_int32_t rec_page; /* 88-91: Records Per Page. */ + u_int32_t page_ext; /* 92-95: Pages per extent */ + + u_int32_t unused[91]; /* 96-459: Unused space */ + u_int32_t crypto_magic; /* 460-463: Crypto magic number */ + u_int32_t trash[3]; /* 464-475: Trash space - Do not use */ + u_int8_t iv[DB_IV_BYTES]; /* 476-495: Crypto IV */ + u_int8_t chksum[DB_MAC_KEY]; /* 496-511: Page chksum */ + /* + * Minimum page size is 512. + */ +} QMETA33, QMETA; + +/* + * DBMETASIZE is a constant used by __db_file_setup and DB->verify + * as a buffer which is guaranteed to be larger than any possible + * metadata page size and smaller than any disk sector. + */ +#define DBMETASIZE 512 + +/************************************************************************ + BTREE/HASH MAIN PAGE LAYOUT + ************************************************************************/ +/* + * +-----------------------------------+ + * | lsn | pgno | prev pgno | + * +-----------------------------------+ + * | next pgno | entries | hf offset | + * +-----------------------------------+ + * | level | type | chksum | + * +-----------------------------------+ + * | iv | index | free --> | + * +-----------+-----------------------+ + * | F R E E A R E A | + * +-----------------------------------+ + * | <-- free | item | + * +-----------------------------------+ + * | item | item | item | + * +-----------------------------------+ + * + * sizeof(PAGE) == 26 bytes + possibly 20 bytes of checksum and possibly + * 16 bytes of IV (+ 2 bytes for alignment), and the following indices + * are guaranteed to be two-byte aligned. If we aren't doing crypto or + * checksumming the bytes are reclaimed for data storage. + * + * For hash and btree leaf pages, index items are paired, e.g., inp[0] is the + * key for inp[1]'s data. All other types of pages only contain single items. + */ +typedef struct __pg_chksum { + u_int8_t unused[2]; /* 26-27: For alignment */ + u_int8_t chksum[4]; /* 28-31: Checksum */ +} PG_CHKSUM; + +typedef struct __pg_crypto { + u_int8_t unused[2]; /* 26-27: For alignment */ + u_int8_t chksum[DB_MAC_KEY]; /* 28-47: Checksum */ + u_int8_t iv[DB_IV_BYTES]; /* 48-63: IV */ + /* !!! + * Must be 16-byte aligned for crypto + */ +} PG_CRYPTO; + +typedef struct _db_page { + DB_LSN lsn; /* 00-07: Log sequence number. */ + db_pgno_t pgno; /* 08-11: Current page number. */ + db_pgno_t prev_pgno; /* 12-15: Previous page number. */ + db_pgno_t next_pgno; /* 16-19: Next page number. */ + db_indx_t entries; /* 20-21: Number of items on the page. */ + db_indx_t hf_offset; /* 22-23: High free byte page offset. */ + + /* + * The btree levels are numbered from the leaf to the root, starting + * with 1, so the leaf is level 1, its parent is level 2, and so on. + * We maintain this level on all btree pages, but the only place that + * we actually need it is on the root page. It would not be difficult + * to hide the byte on the root page once it becomes an internal page, + * so we could get this byte back if we needed it for something else. + */ +#define LEAFLEVEL 1 +#define MAXBTREELEVEL 255 + u_int8_t level; /* 24: Btree tree level. */ + u_int8_t type; /* 25: Page type. */ +} PAGE; + +#define SIZEOF_PAGE 26 +/* + * !!! + * DB_AM_ENCRYPT always implies DB_AM_CHKSUM so that must come first. + */ +#define P_INP(dbp, pg) \ + ((db_indx_t *)((u_int8_t *)(pg) + SIZEOF_PAGE + \ + (F_ISSET((dbp), DB_AM_ENCRYPT) ? sizeof(PG_CRYPTO) : \ + (F_ISSET((dbp), DB_AM_CHKSUM) ? sizeof(PG_CHKSUM) : 0)))) + +#define P_IV(dbp, pg) \ + (F_ISSET((dbp), DB_AM_ENCRYPT) ? ((u_int8_t *)(pg) + \ + SIZEOF_PAGE + SSZA(PG_CRYPTO, iv)) \ + : NULL) + +#define P_CHKSUM(dbp, pg) \ + (F_ISSET((dbp), DB_AM_ENCRYPT) ? ((u_int8_t *)(pg) + \ + SIZEOF_PAGE + SSZA(PG_CRYPTO, chksum)) : \ + (F_ISSET((dbp), DB_AM_CHKSUM) ? ((u_int8_t *)(pg) + \ + SIZEOF_PAGE + SSZA(PG_CHKSUM, chksum)) \ + : NULL)) + +/* PAGE element macros. */ +#define LSN(p) (((PAGE *)p)->lsn) +#define PGNO(p) (((PAGE *)p)->pgno) +#define PREV_PGNO(p) (((PAGE *)p)->prev_pgno) +#define NEXT_PGNO(p) (((PAGE *)p)->next_pgno) +#define NUM_ENT(p) (((PAGE *)p)->entries) +#define HOFFSET(p) (((PAGE *)p)->hf_offset) +#define LEVEL(p) (((PAGE *)p)->level) +#define TYPE(p) (((PAGE *)p)->type) + +/************************************************************************ + QUEUE MAIN PAGE LAYOUT + ************************************************************************/ +/* + * Sizes of page below. Used to reclaim space if not doing + * crypto or checksumming. If you change the QPAGE below you + * MUST adjust this too. + */ +#define QPAGE_NORMAL 28 +#define QPAGE_CHKSUM 48 +#define QPAGE_SEC 64 + +typedef struct _qpage { + DB_LSN lsn; /* 00-07: Log sequence number. */ + db_pgno_t pgno; /* 08-11: Current page number. */ + u_int32_t unused0[3]; /* 12-23: Unused. */ + u_int8_t unused1[1]; /* 24: Unused. */ + u_int8_t type; /* 25: Page type. */ + u_int8_t unused2[2]; /* 26-27: Unused. */ + u_int8_t chksum[DB_MAC_KEY]; /* 28-47: Checksum */ + u_int8_t iv[DB_IV_BYTES]; /* 48-63: IV */ +} QPAGE; + +#define QPAGE_SZ(dbp) \ + (F_ISSET((dbp), DB_AM_ENCRYPT) ? QPAGE_SEC : \ + F_ISSET((dbp), DB_AM_CHKSUM) ? QPAGE_CHKSUM : QPAGE_NORMAL) +/* + * !!! + * The next_pgno and prev_pgno fields are not maintained for btree and recno + * internal pages. Doing so only provides a minor performance improvement, + * it's hard to do when deleting internal pages, and it increases the chance + * of deadlock during deletes and splits because we have to re-link pages at + * more than the leaf level. + * + * !!! + * The btree/recno access method needs db_recno_t bytes of space on the root + * page to specify how many records are stored in the tree. (The alternative + * is to store the number of records in the meta-data page, which will create + * a second hot spot in trees being actively modified, or recalculate it from + * the BINTERNAL fields on each access.) Overload the PREV_PGNO field. + */ +#define RE_NREC(p) \ + ((TYPE(p) == P_IBTREE || TYPE(p) == P_IRECNO) ? PREV_PGNO(p) : \ + (db_pgno_t)(TYPE(p) == P_LBTREE ? NUM_ENT(p) / 2 : NUM_ENT(p))) +#define RE_NREC_ADJ(p, adj) \ + PREV_PGNO(p) += adj; +#define RE_NREC_SET(p, num) \ + PREV_PGNO(p) = num; + +/* + * Initialize a page. + * + * !!! + * Don't modify the page's LSN, code depends on it being unchanged after a + * P_INIT call. + */ +#define P_INIT(pg, pg_size, n, pg_prev, pg_next, btl, pg_type) do { \ + PGNO(pg) = n; \ + PREV_PGNO(pg) = pg_prev; \ + NEXT_PGNO(pg) = pg_next; \ + NUM_ENT(pg) = 0; \ + HOFFSET(pg) = pg_size; \ + LEVEL(pg) = btl; \ + TYPE(pg) = pg_type; \ +} while (0) + +/* Page header length (offset to first index). */ +#define P_OVERHEAD(dbp) P_TO_UINT16(P_INP(dbp, 0)) + +/* First free byte. */ +#define LOFFSET(dbp, pg) \ + (P_OVERHEAD(dbp) + NUM_ENT(pg) * sizeof(db_indx_t)) + +/* Free space on a regular page. */ +#define P_FREESPACE(dbp, pg) (HOFFSET(pg) - LOFFSET(dbp, pg)) + +/* Get a pointer to the bytes at a specific index. */ +#define P_ENTRY(dbp, pg, indx) ((u_int8_t *)pg + P_INP(dbp, pg)[indx]) + +/************************************************************************ + OVERFLOW PAGE LAYOUT + ************************************************************************/ + +/* + * Overflow items are referenced by HOFFPAGE and BOVERFLOW structures, which + * store a page number (the first page of the overflow item) and a length + * (the total length of the overflow item). The overflow item consists of + * some number of overflow pages, linked by the next_pgno field of the page. + * A next_pgno field of PGNO_INVALID flags the end of the overflow item. + * + * Overflow page overloads: + * The amount of overflow data stored on each page is stored in the + * hf_offset field. + * + * The implementation reference counts overflow items as it's possible + * for them to be promoted onto btree internal pages. The reference + * count is stored in the entries field. + */ +#define OV_LEN(p) (((PAGE *)p)->hf_offset) +#define OV_REF(p) (((PAGE *)p)->entries) + +/* Maximum number of bytes that you can put on an overflow page. */ +#define P_MAXSPACE(dbp, psize) ((psize) - P_OVERHEAD(dbp)) + +/* Free space on an overflow page. */ +#define P_OVFLSPACE(dbp, psize, pg) (P_MAXSPACE(dbp, psize) - HOFFSET(pg)) + +/************************************************************************ + HASH PAGE LAYOUT + ************************************************************************/ + +/* Each index references a group of bytes on the page. */ +#define H_KEYDATA 1 /* Key/data item. */ +#define H_DUPLICATE 2 /* Duplicate key/data item. */ +#define H_OFFPAGE 3 /* Overflow key/data item. */ +#define H_OFFDUP 4 /* Overflow page of duplicates. */ + +/* + * !!! + * Items on hash pages are (potentially) unaligned, so we can never cast the + * (page + offset) pointer to an HKEYDATA, HOFFPAGE or HOFFDUP structure, as + * we do with B+tree on-page structures. Because we frequently want the type + * field, it requires no alignment, and it's in the same location in all three + * structures, there's a pair of macros. + */ +#define HPAGE_PTYPE(p) (*(u_int8_t *)p) +#define HPAGE_TYPE(dbp, pg, indx) (*P_ENTRY(dbp, pg, indx)) + +/* + * The first and second types are H_KEYDATA and H_DUPLICATE, represented + * by the HKEYDATA structure: + * + * +-----------------------------------+ + * | type | key/data ... | + * +-----------------------------------+ + * + * For duplicates, the data field encodes duplicate elements in the data + * field: + * + * +---------------------------------------------------------------+ + * | type | len1 | element1 | len1 | len2 | element2 | len2 | + * +---------------------------------------------------------------+ + * + * Thus, by keeping track of the offset in the element, we can do both + * backward and forward traversal. + */ +typedef struct _hkeydata { + u_int8_t type; /* 00: Page type. */ + u_int8_t data[1]; /* Variable length key/data item. */ +} HKEYDATA; +#define HKEYDATA_DATA(p) (((u_int8_t *)p) + SSZA(HKEYDATA, data)) + +/* + * The length of any HKEYDATA item. Note that indx is an element index, + * not a PAIR index. + */ +#define LEN_HITEM(dbp, pg, pgsize, indx) \ + (((indx) == 0 ? pgsize : \ + (P_INP(dbp, pg)[indx - 1])) - (P_INP(dbp, pg)[indx])) + +#define LEN_HKEYDATA(dbp, pg, psize, indx) \ + (db_indx_t)(LEN_HITEM(dbp, pg, psize, indx) - HKEYDATA_SIZE(0)) + +/* + * Page space required to add a new HKEYDATA item to the page, with and + * without the index value. + */ +#define HKEYDATA_SIZE(len) \ + ((len) + SSZA(HKEYDATA, data)) +#define HKEYDATA_PSIZE(len) \ + (HKEYDATA_SIZE(len) + sizeof(db_indx_t)) + +/* Put a HKEYDATA item at the location referenced by a page entry. */ +#define PUT_HKEYDATA(pe, kd, len, type) { \ + ((HKEYDATA *)pe)->type = type; \ + memcpy((u_int8_t *)pe + sizeof(u_int8_t), kd, len); \ +} + +/* + * Macros the describe the page layout in terms of key-data pairs. + */ +#define H_NUMPAIRS(pg) (NUM_ENT(pg) / 2) +#define H_KEYINDEX(indx) (indx) +#define H_DATAINDEX(indx) ((indx) + 1) +#define H_PAIRKEY(dbp, pg, indx) P_ENTRY(dbp, pg, H_KEYINDEX(indx)) +#define H_PAIRDATA(dbp, pg, indx) P_ENTRY(dbp, pg, H_DATAINDEX(indx)) +#define H_PAIRSIZE(dbp, pg, psize, indx) \ + (LEN_HITEM(dbp, pg, psize, H_KEYINDEX(indx)) + \ + LEN_HITEM(dbp, pg, psize, H_DATAINDEX(indx))) +#define LEN_HDATA(dbp, p, psize, indx) \ + LEN_HKEYDATA(dbp, p, psize, H_DATAINDEX(indx)) +#define LEN_HKEY(dbp, p, psize, indx) \ + LEN_HKEYDATA(dbp, p, psize, H_KEYINDEX(indx)) + +/* + * The third type is the H_OFFPAGE, represented by the HOFFPAGE structure: + */ +typedef struct _hoffpage { + u_int8_t type; /* 00: Page type and delete flag. */ + u_int8_t unused[3]; /* 01-03: Padding, unused. */ + db_pgno_t pgno; /* 04-07: Offpage page number. */ + u_int32_t tlen; /* 08-11: Total length of item. */ +} HOFFPAGE; + +#define HOFFPAGE_PGNO(p) (((u_int8_t *)p) + SSZ(HOFFPAGE, pgno)) +#define HOFFPAGE_TLEN(p) (((u_int8_t *)p) + SSZ(HOFFPAGE, tlen)) + +/* + * Page space required to add a new HOFFPAGE item to the page, with and + * without the index value. + */ +#define HOFFPAGE_SIZE (sizeof(HOFFPAGE)) +#define HOFFPAGE_PSIZE (HOFFPAGE_SIZE + sizeof(db_indx_t)) + +/* + * The fourth type is H_OFFDUP represented by the HOFFDUP structure: + */ +typedef struct _hoffdup { + u_int8_t type; /* 00: Page type and delete flag. */ + u_int8_t unused[3]; /* 01-03: Padding, unused. */ + db_pgno_t pgno; /* 04-07: Offpage page number. */ +} HOFFDUP; +#define HOFFDUP_PGNO(p) (((u_int8_t *)p) + SSZ(HOFFDUP, pgno)) + +/* + * Page space required to add a new HOFFDUP item to the page, with and + * without the index value. + */ +#define HOFFDUP_SIZE (sizeof(HOFFDUP)) + +/************************************************************************ + BTREE PAGE LAYOUT + ************************************************************************/ + +/* Each index references a group of bytes on the page. */ +#define B_KEYDATA 1 /* Key/data item. */ +#define B_DUPLICATE 2 /* Duplicate key/data item. */ +#define B_OVERFLOW 3 /* Overflow key/data item. */ + +/* + * We have to store a deleted entry flag in the page. The reason is complex, + * but the simple version is that we can't delete on-page items referenced by + * a cursor -- the return order of subsequent insertions might be wrong. The + * delete flag is an overload of the top bit of the type byte. + */ +#define B_DELETE (0x80) +#define B_DCLR(t) (t) &= ~B_DELETE +#define B_DSET(t) (t) |= B_DELETE +#define B_DISSET(t) ((t) & B_DELETE) + +#define B_TYPE(t) ((t) & ~B_DELETE) +#define B_TSET(t, type, deleted) { \ + (t) = (type); \ + if (deleted) \ + B_DSET(t); \ +} + +/* + * The first type is B_KEYDATA, represented by the BKEYDATA structure: + */ +typedef struct _bkeydata { + db_indx_t len; /* 00-01: Key/data item length. */ + u_int8_t type; /* 02: Page type AND DELETE FLAG. */ + u_int8_t data[1]; /* Variable length key/data item. */ +} BKEYDATA; + +/* Get a BKEYDATA item for a specific index. */ +#define GET_BKEYDATA(dbp, pg, indx) \ + ((BKEYDATA *)P_ENTRY(dbp, pg, indx)) + +/* + * Page space required to add a new BKEYDATA item to the page, with and + * without the index value. + */ +#define BKEYDATA_SIZE(len) \ + ALIGN((len) + SSZA(BKEYDATA, data), sizeof(u_int32_t)) +#define BKEYDATA_PSIZE(len) \ + (BKEYDATA_SIZE(len) + sizeof(db_indx_t)) + +/* + * The second and third types are B_DUPLICATE and B_OVERFLOW, represented + * by the BOVERFLOW structure. + */ +typedef struct _boverflow { + db_indx_t unused1; /* 00-01: Padding, unused. */ + u_int8_t type; /* 02: Page type AND DELETE FLAG. */ + u_int8_t unused2; /* 03: Padding, unused. */ + db_pgno_t pgno; /* 04-07: Next page number. */ + u_int32_t tlen; /* 08-11: Total length of item. */ +} BOVERFLOW; + +/* Get a BOVERFLOW item for a specific index. */ +#define GET_BOVERFLOW(dbp, pg, indx) \ + ((BOVERFLOW *)P_ENTRY(dbp, pg, indx)) + +/* + * Page space required to add a new BOVERFLOW item to the page, with and + * without the index value. + */ +#define BOVERFLOW_SIZE \ + ALIGN(sizeof(BOVERFLOW), sizeof(u_int32_t)) +#define BOVERFLOW_PSIZE \ + (BOVERFLOW_SIZE + sizeof(db_indx_t)) + +/* + * Btree leaf and hash page layouts group indices in sets of two, one for the + * key and one for the data. Everything else does it in sets of one to save + * space. Use the following macros so that it's real obvious what's going on. + */ +#define O_INDX 1 +#define P_INDX 2 + +/************************************************************************ + BTREE INTERNAL PAGE LAYOUT + ************************************************************************/ + +/* + * Btree internal entry. + */ +typedef struct _binternal { + db_indx_t len; /* 00-01: Key/data item length. */ + u_int8_t type; /* 02: Page type AND DELETE FLAG. */ + u_int8_t unused; /* 03: Padding, unused. */ + db_pgno_t pgno; /* 04-07: Page number of referenced page. */ + db_recno_t nrecs; /* 08-11: Subtree record count. */ + u_int8_t data[1]; /* Variable length key item. */ +} BINTERNAL; + +/* Get a BINTERNAL item for a specific index. */ +#define GET_BINTERNAL(dbp, pg, indx) \ + ((BINTERNAL *)P_ENTRY(dbp, pg, indx)) + +/* + * Page space required to add a new BINTERNAL item to the page, with and + * without the index value. + */ +#define BINTERNAL_SIZE(len) \ + ALIGN((len) + SSZA(BINTERNAL, data), sizeof(u_int32_t)) +#define BINTERNAL_PSIZE(len) \ + (BINTERNAL_SIZE(len) + sizeof(db_indx_t)) + +/************************************************************************ + RECNO INTERNAL PAGE LAYOUT + ************************************************************************/ + +/* + * The recno internal entry. + */ +typedef struct _rinternal { + db_pgno_t pgno; /* 00-03: Page number of referenced page. */ + db_recno_t nrecs; /* 04-07: Subtree record count. */ +} RINTERNAL; + +/* Get a RINTERNAL item for a specific index. */ +#define GET_RINTERNAL(dbp, pg, indx) \ + ((RINTERNAL *)P_ENTRY(dbp, pg, indx)) + +/* + * Page space required to add a new RINTERNAL item to the page, with and + * without the index value. + */ +#define RINTERNAL_SIZE \ + ALIGN(sizeof(RINTERNAL), sizeof(u_int32_t)) +#define RINTERNAL_PSIZE \ + (RINTERNAL_SIZE + sizeof(db_indx_t)) + +#if defined(__cplusplus) +} +#endif + +#endif /* !_DB_PAGE_H_ */ diff --git a/db/dbinc/db_server_int.h b/db/dbinc/db_server_int.h new file mode 100644 index 000000000..78494c9b9 --- /dev/null +++ b/db/dbinc/db_server_int.h @@ -0,0 +1,148 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_server_int.h,v 1.23 2002/02/12 15:01:24 sue Exp + */ + +#ifndef _DB_SERVER_INT_H_ +#define _DB_SERVER_INT_H_ + +#define DB_SERVER_TIMEOUT 300 /* 5 minutes */ +#define DB_SERVER_MAXTIMEOUT 1200 /* 20 minutes */ +#define DB_SERVER_IDLETIMEOUT 86400 /* 1 day */ + +/* + * Ignore/mask off the following env->open flags: + * Most are illegal for a client to specify as they would control + * server resource usage. We will just ignore them. + * DB_LOCKDOWN + * DB_PRIVATE + * DB_RECOVER + * DB_RECOVER_FATAL + * DB_SYSTEM_MEM + * DB_USE_ENVIRON, DB_USE_ENVIRON_ROOT - handled on client + */ +#define DB_SERVER_FLAGMASK ( \ +DB_LOCKDOWN | DB_PRIVATE | DB_RECOVER | DB_RECOVER_FATAL | \ +DB_SYSTEM_MEM | DB_USE_ENVIRON | DB_USE_ENVIRON_ROOT) + +#define CT_CURSOR 0x001 /* Cursor */ +#define CT_DB 0x002 /* Database */ +#define CT_ENV 0x004 /* Env */ +#define CT_TXN 0x008 /* Txn */ + +#define CT_JOIN 0x10000000 /* Join cursor component */ +#define CT_JOINCUR 0x20000000 /* Join cursor */ + +typedef struct home_entry home_entry; +struct home_entry { + LIST_ENTRY(home_entry) entries; + char *home; + char *dir; + char *name; + char *passwd; +}; + +/* + * Data needed for sharing handles. + * To share an env handle, on the open call, they must have matching + * env flags, and matching set_flags. + * + * To share a db handle on the open call, the db, subdb and flags must + * all be the same. + */ +#define DB_SERVER_ENVFLAGS ( \ +DB_INIT_CDB | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | \ +DB_INIT_TXN | DB_JOINENV) + +#define DB_SERVER_DBFLAGS (DB_DIRTY_READ | DB_NOMMAP | DB_RDONLY) +#define DB_SERVER_DBNOSHARE (DB_EXCL | DB_TRUNCATE) + +typedef struct ct_envdata ct_envdata; +typedef struct ct_dbdata ct_dbdata; +struct ct_envdata { + u_int32_t envflags; + u_int32_t onflags; + u_int32_t offflags; + home_entry *home; +}; + +struct ct_dbdata { + u_int32_t dbflags; + u_int32_t setflags; + char *db; + char *subdb; + DBTYPE type; +}; + +/* + * We maintain an activity timestamp for each handle. However, we + * set it to point, possibly to the ct_active field of its own handle + * or it may point to the ct_active field of a parent. In the case + * of nested transactions and any cursors within transactions it must + * point to the ct_active field of the ultimate parent of the transaction + * no matter how deeply it is nested. + */ +typedef struct ct_entry ct_entry; +struct ct_entry { + LIST_ENTRY(ct_entry) entries; /* List of entries */ + union { +#ifdef __cplusplus + DbEnv *envp; /* H_ENV */ + DbTxn *txnp; /* H_TXN */ + Db *dbp; /* H_DB */ + Dbc *dbc; /* H_CURSOR */ +#else + DB_ENV *envp; /* H_ENV */ + DB_TXN *txnp; /* H_TXN */ + DB *dbp; /* H_DB */ + DBC *dbc; /* H_CURSOR */ +#endif + void *anyp; + } handle_u; + union { /* Private data per type */ + ct_envdata envdp; /* Env info */ + ct_dbdata dbdp; /* Db info */ + } private_u; + long ct_id; /* Client ID */ + long *ct_activep; /* Activity timestamp pointer*/ + long *ct_origp; /* Original timestamp pointer*/ + long ct_active; /* Activity timestamp */ + long ct_timeout; /* Resource timeout */ + long ct_idle; /* Idle timeout */ + u_int32_t ct_refcount; /* Ref count for sharing */ + u_int32_t ct_type; /* This entry's type */ + struct ct_entry *ct_parent; /* Its parent */ + struct ct_entry *ct_envparent; /* Its environment */ +}; + +#define ct_envp handle_u.envp +#define ct_txnp handle_u.txnp +#define ct_dbp handle_u.dbp +#define ct_dbc handle_u.dbc +#define ct_anyp handle_u.anyp + +#define ct_envdp private_u.envdp +#define ct_dbdp private_u.dbdp + +extern int __dbsrv_verbose; + +/* + * Get ctp and activate it. + * Assumes local variable 'replyp'. + * NOTE: May 'return' from macro. + */ +#define ACTIVATE_CTP(ctp, id, type) { \ + (ctp) = get_tableent(id); \ + if ((ctp) == NULL) { \ + replyp->status = DB_NOSERVER_ID;\ + return; \ + } \ + DB_ASSERT((ctp)->ct_type & (type)); \ + __dbsrv_active(ctp); \ +} + +#endif /* !_DB_SERVER_INT_H_ */ diff --git a/db/dbinc/db_shash.h b/db/dbinc/db_shash.h new file mode 100644 index 000000000..2aef56641 --- /dev/null +++ b/db/dbinc/db_shash.h @@ -0,0 +1,81 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_shash.h,v 11.11 2002/01/11 15:52:26 bostic Exp + */ + +#ifndef _DB_SHASH_H_ +#define _DB_SHASH_H_ + +/* Hash Headers */ +typedef SH_TAILQ_HEAD(__hash_head) DB_HASHTAB; + +/* + * HASHLOOKUP -- + * + * Look up something in a shared memory hash table. The "elt" argument + * should be a key, and cmp_func must know how to compare a key to whatever + * structure it is that appears in the hash table. The comparison function + * + * begin: address of the beginning of the hash table. + * ndx: index into table for this item. + * type: the structure type of the elements that are linked in each bucket. + * field: the name of the field by which the "type" structures are linked. + * elt: the item for which we are searching in the hash table. + * res: the variable into which we'll store the element if we find it. + * cmp: called as: cmp(lookup_elt, table_elt). + * + * If the element is not in the hash table, this macro exits with res set + * to NULL. + */ +#define HASHLOOKUP(begin, ndx, type, field, elt, res, cmp) do { \ + DB_HASHTAB *__bucket; \ + \ + __bucket = &begin[ndx]; \ + for (res = SH_TAILQ_FIRST(__bucket, type); \ + res != NULL; res = SH_TAILQ_NEXT(res, field, type)) \ + if (cmp(elt, res)) \ + break; \ +} while (0) + +/* + * HASHINSERT -- + * + * Insert a new entry into the hash table. This assumes that you already + * have the bucket locked and that lookup has failed; don't call it if you + * haven't already called HASHLOOKUP. If you do, you could get duplicate + * entries. + * + * begin: the beginning address of the hash table. + * ndx: the index for this element. + * type: the structure type of the elements that are linked in each bucket. + * field: the name of the field by which the "type" structures are linked. + * elt: the item to be inserted. + */ +#define HASHINSERT(begin, ndx, type, field, elt) do { \ + DB_HASHTAB *__bucket; \ + \ + __bucket = &begin[ndx]; \ + SH_TAILQ_INSERT_HEAD(__bucket, elt, field, type); \ +} while (0) + +/* + * HASHREMOVE_EL -- + * Given the object "obj" in the table, remove it. + * + * begin: address of the beginning of the hash table. + * ndx: index into hash table of where this element belongs. + * type: the structure type of the elements that are linked in each bucket. + * field: the name of the field by which the "type" structures are linked. + * obj: the object in the table that we with to delete. + */ +#define HASHREMOVE_EL(begin, ndx, type, field, obj) { \ + DB_HASHTAB *__bucket; \ + \ + __bucket = &begin[ndx]; \ + SH_TAILQ_REMOVE(__bucket, obj, field, type); \ +} +#endif /* !_DB_SHASH_H_ */ diff --git a/db/dbinc/db_swap.h b/db/dbinc/db_swap.h new file mode 100644 index 000000000..46499deef --- /dev/null +++ b/db/dbinc/db_swap.h @@ -0,0 +1,116 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Id: db_swap.h,v 11.8 2002/01/11 15:52:26 bostic Exp + */ + +#ifndef _DB_SWAP_H_ +#define _DB_SWAP_H_ + +/* + * Little endian <==> big endian 32-bit swap macros. + * M_32_SWAP swap a memory location + * P_32_COPY copy potentially unaligned 4 byte quantities + * P_32_SWAP swap a referenced memory location + */ +#define M_32_SWAP(a) { \ + u_int32_t _tmp; \ + _tmp = a; \ + ((u_int8_t *)&a)[0] = ((u_int8_t *)&_tmp)[3]; \ + ((u_int8_t *)&a)[1] = ((u_int8_t *)&_tmp)[2]; \ + ((u_int8_t *)&a)[2] = ((u_int8_t *)&_tmp)[1]; \ + ((u_int8_t *)&a)[3] = ((u_int8_t *)&_tmp)[0]; \ +} +#define P_32_COPY(a, b) { \ + ((u_int8_t *)b)[0] = ((u_int8_t *)a)[0]; \ + ((u_int8_t *)b)[1] = ((u_int8_t *)a)[1]; \ + ((u_int8_t *)b)[2] = ((u_int8_t *)a)[2]; \ + ((u_int8_t *)b)[3] = ((u_int8_t *)a)[3]; \ +} +#define P_32_SWAP(a) { \ + u_int32_t _tmp; \ + P_32_COPY(a, &_tmp); \ + ((u_int8_t *)a)[0] = ((u_int8_t *)&_tmp)[3]; \ + ((u_int8_t *)a)[1] = ((u_int8_t *)&_tmp)[2]; \ + ((u_int8_t *)a)[2] = ((u_int8_t *)&_tmp)[1]; \ + ((u_int8_t *)a)[3] = ((u_int8_t *)&_tmp)[0]; \ +} + +/* + * Little endian <==> big endian 16-bit swap macros. + * M_16_SWAP swap a memory location + * P_16_COPY copy potentially unaligned 2 byte quantities + * P_16_SWAP swap a referenced memory location + */ +#define M_16_SWAP(a) { \ + u_int16_t _tmp; \ + _tmp = (u_int16_t)a; \ + ((u_int8_t *)&a)[0] = ((u_int8_t *)&_tmp)[1]; \ + ((u_int8_t *)&a)[1] = ((u_int8_t *)&_tmp)[0]; \ +} +#define P_16_COPY(a, b) { \ + ((u_int8_t *)b)[0] = ((u_int8_t *)a)[0]; \ + ((u_int8_t *)b)[1] = ((u_int8_t *)a)[1]; \ +} +#define P_16_SWAP(a) { \ + u_int16_t _tmp; \ + P_16_COPY(a, &_tmp); \ + ((u_int8_t *)a)[0] = ((u_int8_t *)&_tmp)[1]; \ + ((u_int8_t *)a)[1] = ((u_int8_t *)&_tmp)[0]; \ +} + +#define SWAP32(p) { \ + P_32_SWAP(p); \ + (p) += sizeof(u_int32_t); \ +} +#define SWAP16(p) { \ + P_16_SWAP(p); \ + (p) += sizeof(u_int16_t); \ +} + +/* + * Berkeley DB has local versions of htonl() and ntohl() that operate on + * pointers to the right size memory locations; the portability magic for + * finding the real system functions isn't worth the effort. + */ +#define DB_HTONL(p) do { \ + if (!__db_isbigendian()) \ + P_32_SWAP(p); \ +} while (0) +#define DB_NTOHL(p) do { \ + if (!__db_isbigendian()) \ + P_32_SWAP(p); \ +} while (0) + +#endif /* !_DB_SWAP_H_ */ diff --git a/db/dbinc/db_upgrade.h b/db/dbinc/db_upgrade.h new file mode 100644 index 000000000..9f4f51122 --- /dev/null +++ b/db/dbinc/db_upgrade.h @@ -0,0 +1,242 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_upgrade.h,v 1.10 2002/01/11 15:52:26 bostic Exp + */ + +#ifndef _DB_UPGRADE_H_ +#define _DB_UPGRADE_H_ + +/* + * This file defines the metadata pages from the previous release. + * These structures are only used to upgrade old versions of databases. + */ + +/* Structures from the 3.1 release */ +typedef struct _dbmeta31 { + DB_LSN lsn; /* 00-07: LSN. */ + db_pgno_t pgno; /* 08-11: Current page number. */ + u_int32_t magic; /* 12-15: Magic number. */ + u_int32_t version; /* 16-19: Version. */ + u_int32_t pagesize; /* 20-23: Pagesize. */ + u_int8_t unused1[1]; /* 24: Unused. */ + u_int8_t type; /* 25: Page type. */ + u_int8_t unused2[2]; /* 26-27: Unused. */ + u_int32_t free; /* 28-31: Free list page number. */ + DB_LSN unused3; /* 36-39: Unused. */ + u_int32_t key_count; /* 40-43: Cached key count. */ + u_int32_t record_count; /* 44-47: Cached record count. */ + u_int32_t flags; /* 48-51: Flags: unique to each AM. */ + /* 52-71: Unique file ID. */ + u_int8_t uid[DB_FILE_ID_LEN]; +} DBMETA31; + +typedef struct _btmeta31 { + DBMETA31 dbmeta; /* 00-71: Generic meta-data header. */ + + u_int32_t maxkey; /* 72-75: Btree: Maxkey. */ + u_int32_t minkey; /* 76-79: Btree: Minkey. */ + u_int32_t re_len; /* 80-83: Recno: fixed-length record length. */ + u_int32_t re_pad; /* 84-87: Recno: fixed-length record pad. */ + u_int32_t root; /* 88-92: Root page. */ + + /* + * Minimum page size is 128. + */ +} BTMETA31; + +/************************************************************************ + HASH METADATA PAGE LAYOUT + ************************************************************************/ +typedef struct _hashmeta31 { + DBMETA31 dbmeta; /* 00-71: Generic meta-data page header. */ + + u_int32_t max_bucket; /* 72-75: ID of Maximum bucket in use */ + u_int32_t high_mask; /* 76-79: Modulo mask into table */ + u_int32_t low_mask; /* 80-83: Modulo mask into table lower half */ + u_int32_t ffactor; /* 84-87: Fill factor */ + u_int32_t nelem; /* 88-91: Number of keys in hash table */ + u_int32_t h_charkey; /* 92-95: Value of hash(CHARKEY) */ +#define NCACHED 32 /* number of spare points */ + /* 96-223: Spare pages for overflow */ + u_int32_t spares[NCACHED]; + + /* + * Minimum page size is 256. + */ +} HMETA31; + +/* + * QAM Meta data page structure + * + */ +typedef struct _qmeta31 { + DBMETA31 dbmeta; /* 00-71: Generic meta-data header. */ + + u_int32_t start; /* 72-75: Start offset. */ + u_int32_t first_recno; /* 76-79: First not deleted record. */ + u_int32_t cur_recno; /* 80-83: Last recno allocated. */ + u_int32_t re_len; /* 84-87: Fixed-length record length. */ + u_int32_t re_pad; /* 88-91: Fixed-length record pad. */ + u_int32_t rec_page; /* 92-95: Records Per Page. */ + + /* + * Minimum page size is 128. + */ +} QMETA31; +/* Structures from the 3.2 release */ +typedef struct _qmeta32 { + DBMETA31 dbmeta; /* 00-71: Generic meta-data header. */ + + u_int32_t first_recno; /* 72-75: First not deleted record. */ + u_int32_t cur_recno; /* 76-79: Last recno allocated. */ + u_int32_t re_len; /* 80-83: Fixed-length record length. */ + u_int32_t re_pad; /* 84-87: Fixed-length record pad. */ + u_int32_t rec_page; /* 88-91: Records Per Page. */ + u_int32_t page_ext; /* 92-95: Pages per extent */ + + /* + * Minimum page size is 128. + */ +} QMETA32; + +/* Structures from the 3.0 release */ + +typedef struct _dbmeta30 { + DB_LSN lsn; /* 00-07: LSN. */ + db_pgno_t pgno; /* 08-11: Current page number. */ + u_int32_t magic; /* 12-15: Magic number. */ + u_int32_t version; /* 16-19: Version. */ + u_int32_t pagesize; /* 20-23: Pagesize. */ + u_int8_t unused1[1]; /* 24: Unused. */ + u_int8_t type; /* 25: Page type. */ + u_int8_t unused2[2]; /* 26-27: Unused. */ + u_int32_t free; /* 28-31: Free list page number. */ + u_int32_t flags; /* 32-35: Flags: unique to each AM. */ + /* 36-55: Unique file ID. */ + u_int8_t uid[DB_FILE_ID_LEN]; +} DBMETA30; + +/************************************************************************ + BTREE METADATA PAGE LAYOUT + ************************************************************************/ +typedef struct _btmeta30 { + DBMETA30 dbmeta; /* 00-55: Generic meta-data header. */ + + u_int32_t maxkey; /* 56-59: Btree: Maxkey. */ + u_int32_t minkey; /* 60-63: Btree: Minkey. */ + u_int32_t re_len; /* 64-67: Recno: fixed-length record length. */ + u_int32_t re_pad; /* 68-71: Recno: fixed-length record pad. */ + u_int32_t root; /* 72-75: Root page. */ + + /* + * Minimum page size is 128. + */ +} BTMETA30; + +/************************************************************************ + HASH METADATA PAGE LAYOUT + ************************************************************************/ +typedef struct _hashmeta30 { + DBMETA30 dbmeta; /* 00-55: Generic meta-data page header. */ + + u_int32_t max_bucket; /* 56-59: ID of Maximum bucket in use */ + u_int32_t high_mask; /* 60-63: Modulo mask into table */ + u_int32_t low_mask; /* 64-67: Modulo mask into table lower half */ + u_int32_t ffactor; /* 68-71: Fill factor */ + u_int32_t nelem; /* 72-75: Number of keys in hash table */ + u_int32_t h_charkey; /* 76-79: Value of hash(CHARKEY) */ +#define NCACHED30 32 /* number of spare points */ + /* 80-207: Spare pages for overflow */ + u_int32_t spares[NCACHED30]; + + /* + * Minimum page size is 256. + */ +} HMETA30; + +/************************************************************************ + QUEUE METADATA PAGE LAYOUT + ************************************************************************/ +/* + * QAM Meta data page structure + * + */ +typedef struct _qmeta30 { + DBMETA30 dbmeta; /* 00-55: Generic meta-data header. */ + + u_int32_t start; /* 56-59: Start offset. */ + u_int32_t first_recno; /* 60-63: First not deleted record. */ + u_int32_t cur_recno; /* 64-67: Last recno allocated. */ + u_int32_t re_len; /* 68-71: Fixed-length record length. */ + u_int32_t re_pad; /* 72-75: Fixed-length record pad. */ + u_int32_t rec_page; /* 76-79: Records Per Page. */ + + /* + * Minimum page size is 128. + */ +} QMETA30; + +/* Structures from Release 2.x */ + +/************************************************************************ + BTREE METADATA PAGE LAYOUT + ************************************************************************/ + +/* + * Btree metadata page layout: + */ +typedef struct _btmeta2X { + DB_LSN lsn; /* 00-07: LSN. */ + db_pgno_t pgno; /* 08-11: Current page number. */ + u_int32_t magic; /* 12-15: Magic number. */ + u_int32_t version; /* 16-19: Version. */ + u_int32_t pagesize; /* 20-23: Pagesize. */ + u_int32_t maxkey; /* 24-27: Btree: Maxkey. */ + u_int32_t minkey; /* 28-31: Btree: Minkey. */ + u_int32_t free; /* 32-35: Free list page number. */ + u_int32_t flags; /* 36-39: Flags. */ + u_int32_t re_len; /* 40-43: Recno: fixed-length record length. */ + u_int32_t re_pad; /* 44-47: Recno: fixed-length record pad. */ + /* 48-67: Unique file ID. */ + u_int8_t uid[DB_FILE_ID_LEN]; +} BTMETA2X; + +/************************************************************************ + HASH METADATA PAGE LAYOUT + ************************************************************************/ + +/* + * Hash metadata page layout: + */ +/* Hash Table Information */ +typedef struct hashhdr { /* Disk resident portion */ + DB_LSN lsn; /* 00-07: LSN of the header page */ + db_pgno_t pgno; /* 08-11: Page number (btree compatibility). */ + u_int32_t magic; /* 12-15: Magic NO for hash tables */ + u_int32_t version; /* 16-19: Version ID */ + u_int32_t pagesize; /* 20-23: Bucket/Page Size */ + u_int32_t ovfl_point; /* 24-27: Overflow page allocation location */ + u_int32_t last_freed; /* 28-31: Last freed overflow page pgno */ + u_int32_t max_bucket; /* 32-35: ID of Maximum bucket in use */ + u_int32_t high_mask; /* 36-39: Modulo mask into table */ + u_int32_t low_mask; /* 40-43: Modulo mask into table lower half */ + u_int32_t ffactor; /* 44-47: Fill factor */ + u_int32_t nelem; /* 48-51: Number of keys in hash table */ + u_int32_t h_charkey; /* 52-55: Value of hash(CHARKEY) */ + u_int32_t flags; /* 56-59: Allow duplicates. */ +#define NCACHED2X 32 /* number of spare points */ + /* 60-187: Spare pages for overflow */ + u_int32_t spares[NCACHED2X]; + /* 188-207: Unique file ID. */ + u_int8_t uid[DB_FILE_ID_LEN]; + + /* + * Minimum page size is 256. + */ +} HASHHDR; + +#endif /* !_DB_UPGRADE_H_ */ diff --git a/db/dbinc/db_verify.h b/db/dbinc/db_verify.h new file mode 100644 index 000000000..21665cbe9 --- /dev/null +++ b/db/dbinc/db_verify.h @@ -0,0 +1,205 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + * + * Id: db_verify.h,v 1.26 2002/08/06 06:37:08 bostic Exp + */ + +#ifndef _DB_VERIFY_H_ +#define _DB_VERIFY_H_ + +/* + * Structures and macros for the storage and retrieval of all information + * needed for inter-page verification of a database. + */ + +/* + * EPRINT is the macro for error printing. Takes as an arg the arg set + * for DB->err. + */ +#define EPRINT(x) \ + do { \ + if (!LF_ISSET(DB_SALVAGE)) \ + __db_err x; \ + } while (0) + +/* For fatal type errors--i.e., verifier bugs. */ +#define TYPE_ERR_PRINT(dbenv, func, pgno, ptype) \ + EPRINT(((dbenv), "Page %lu: %s called on nonsensical page of type %lu", \ + (u_long)(pgno), (func), (u_long)(ptype))); + +/* Complain about a totally zeroed page where we don't expect one. */ +#define ZEROPG_ERR_PRINT(dbenv, pgno, str) \ + do { \ + EPRINT(((dbenv), "Page %lu: %s is of inappropriate type %lu", \ + (u_long)(pgno), str, (u_long)P_INVALID)); \ + EPRINT(((dbenv), "Page %lu: totally zeroed page", \ + (u_long)(pgno))); \ + } while (0) + +/* + * Note that 0 is, in general, a valid pgno, despite equalling PGNO_INVALID; + * we have to test it separately where it's not appropriate. + */ +#define IS_VALID_PGNO(x) ((x) <= vdp->last_pgno) + +/* + * Flags understood by the btree structure checks (esp. __bam_vrfy_subtree). + * These share the same space as the global flags to __db_verify, and must not + * dip below 0x00010000. + */ +#define ST_DUPOK 0x00010000 /* Duplicates are acceptable. */ +#define ST_DUPSET 0x00020000 /* Subtree is in a duplicate tree. */ +#define ST_DUPSORT 0x00040000 /* Duplicates are sorted. */ +#define ST_IS_RECNO 0x00080000 /* Subtree is a recno. */ +#define ST_OVFL_LEAF 0x00100000 /* Overflow reffed from leaf page. */ +#define ST_RECNUM 0x00200000 /* Subtree has record numbering on. */ +#define ST_RELEN 0x00400000 /* Subtree has fixed-length records. */ +#define ST_TOPLEVEL 0x00800000 /* Subtree == entire tree */ + +/* + * Flags understood by __bam_salvage and __db_salvage. These need not share + * the same space with the __bam_vrfy_subtree flags, but must share with + * __db_verify. + */ +#define SA_SKIPFIRSTKEY 0x00080000 + +/* + * VRFY_DBINFO is the fundamental structure; it either represents the database + * of subdatabases, or the sole database if there are no subdatabases. + */ +struct __vrfy_dbinfo { + /* Info about this database in particular. */ + DBTYPE type; + + /* List of subdatabase meta pages, if any. */ + LIST_HEAD(__subdbs, __vrfy_childinfo) subdbs; + + /* File-global info--stores VRFY_PAGEINFOs for each page. */ + DB *pgdbp; + + /* Child database--stores VRFY_CHILDINFOs of each page. */ + DB *cdbp; + + /* Page info structures currently in use. */ + LIST_HEAD(__activepips, __vrfy_pageinfo) activepips; + + /* + * DB we use to keep track of which pages are linked somehow + * during verification. 0 is the default, "unseen"; 1 is seen. + */ + DB *pgset; + + /* + * This is a database we use during salvaging to keep track of which + * overflow and dup pages we need to come back to at the end and print + * with key "UNKNOWN". Pages which print with a good key get set + * to SALVAGE_IGNORE; others get set, as appropriate, to SALVAGE_LDUP, + * SALVAGE_LRECNODUP, SALVAGE_OVERFLOW for normal db overflow pages, + * and SALVAGE_BTREE, SALVAGE_LRECNO, and SALVAGE_HASH for subdb + * pages. + */ +#define SALVAGE_INVALID 0 +#define SALVAGE_IGNORE 1 +#define SALVAGE_LDUP 2 +#define SALVAGE_LRECNODUP 3 +#define SALVAGE_OVERFLOW 4 +#define SALVAGE_LBTREE 5 +#define SALVAGE_HASH 6 +#define SALVAGE_LRECNO 7 + DB *salvage_pages; + + db_pgno_t last_pgno; + db_pgno_t pgs_remaining; /* For dbp->db_feedback(). */ + + /* + * These are used during __bam_vrfy_subtree to keep track, while + * walking up and down the Btree structure, of the prev- and next-page + * chain of leaf pages and verify that it's intact. Also, make sure + * that this chain contains pages of only one type. + */ + db_pgno_t prev_pgno; + db_pgno_t next_pgno; + u_int8_t leaf_type; + + /* Queue needs these to verify data pages in the first pass. */ + u_int32_t re_len; + u_int32_t rec_page; + +#define SALVAGE_PRINTABLE 0x01 /* Output printable chars literally. */ +#define SALVAGE_PRINTHEADER 0x02 /* Print the unknown-key header. */ +#define SALVAGE_PRINTFOOTER 0x04 /* Print the unknown-key footer. */ + u_int32_t flags; +}; /* VRFY_DBINFO */ + +/* + * The amount of state information we need per-page is small enough that + * it's not worth the trouble to define separate structures for each + * possible type of page, and since we're doing verification with these we + * have to be open to the possibility that page N will be of a completely + * unexpected type anyway. So we define one structure here with all the + * info we need for inter-page verification. + */ +struct __vrfy_pageinfo { + u_int8_t type; + u_int8_t bt_level; + u_int8_t unused1; + u_int8_t unused2; + db_pgno_t pgno; + db_pgno_t prev_pgno; + db_pgno_t next_pgno; + + /* meta pages */ + db_pgno_t root; + db_pgno_t free; /* Free list head. */ + + db_indx_t entries; /* Actual number of entries. */ + u_int16_t unused; + db_recno_t rec_cnt; /* Record count. */ + u_int32_t re_len; /* Record length. */ + u_int32_t bt_minkey; + u_int32_t bt_maxkey; + u_int32_t h_ffactor; + u_int32_t h_nelem; + + /* overflow pages */ + /* + * Note that refcount is the refcount for an overflow page; pi_refcount + * is this structure's own refcount! + */ + u_int32_t refcount; + u_int32_t olen; + +#define VRFY_DUPS_UNSORTED 0x0001 /* Have to flag the negative! */ +#define VRFY_HAS_DUPS 0x0002 +#define VRFY_HAS_DUPSORT 0x0004 /* Has the flag set. */ +#define VRFY_HAS_SUBDBS 0x0008 +#define VRFY_HAS_RECNUMS 0x0010 +#define VRFY_INCOMPLETE 0x0020 /* Meta or item order checks incomp. */ +#define VRFY_IS_ALLZEROES 0x0040 /* Hash page we haven't touched? */ +#define VRFY_IS_FIXEDLEN 0x0080 +#define VRFY_IS_RECNO 0x0100 +#define VRFY_IS_RRECNO 0x0200 +#define VRFY_OVFL_LEAFSEEN 0x0400 + u_int32_t flags; + + LIST_ENTRY(__vrfy_pageinfo) links; + u_int32_t pi_refcount; +}; /* VRFY_PAGEINFO */ + +struct __vrfy_childinfo { + db_pgno_t pgno; + +#define V_DUPLICATE 1 /* off-page dup metadata */ +#define V_OVERFLOW 2 /* overflow page */ +#define V_RECNO 3 /* btree internal or leaf page */ + u_int32_t type; + db_recno_t nrecs; /* record count on a btree subtree */ + u_int32_t tlen; /* ovfl. item total size */ + + LIST_ENTRY(__vrfy_childinfo) links; +}; /* VRFY_CHILDINFO */ + +#endif /* !_DB_VERIFY_H_ */ diff --git a/db/dbinc/debug.h b/db/dbinc/debug.h new file mode 100644 index 000000000..f9b55d31b --- /dev/null +++ b/db/dbinc/debug.h @@ -0,0 +1,198 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998-2002 + * Sleepycat Software. All rights reserved. + * + * Id: debug.h,v 11.31 2002/08/06 06:37:08 bostic Exp + */ + +#ifndef _DB_DEBUG_H_ +#define _DB_DEBUG_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * When running with #DIAGNOSTIC defined, we smash memory and do memory + * guarding with a special byte value. + */ +#define CLEAR_BYTE 0xdb +#define GUARD_BYTE 0xdc + +/* + * DB assertions. + */ +#if defined(DIAGNOSTIC) && defined(__STDC__) +#define DB_ASSERT(e) ((e) ? (void)0 : __db_assert(#e, __FILE__, __LINE__)) +#else +#define DB_ASSERT(e) +#endif + +/* + * Purify and other run-time tools complain about uninitialized reads/writes + * of structure fields whose only purpose is padding, as well as when heap + * memory that was never initialized is written to disk. + */ +#ifdef UMRW +#define UMRW_SET(v) (v) = 0 +#else +#define UMRW_SET(v) +#endif + +/* + * Error message handling. Use a macro instead of a function because va_list + * references to variadic arguments cannot be reset to the beginning of the + * variadic argument list (and then rescanned), by functions other than the + * original routine that took the variadic list of arguments. + */ +#if defined(__STDC__) || defined(__cplusplus) +#define DB_REAL_ERR(env, error, error_set, stderr_default, fmt) { \ + va_list ap; \ + \ + /* Call the user's callback function, if specified. */ \ + va_start(ap, fmt); \ + if ((env) != NULL && (env)->db_errcall != NULL) \ + __db_errcall(env, error, error_set, fmt, ap); \ + va_end(ap); \ + \ + /* Write to the user's file descriptor, if specified. */ \ + va_start(ap, fmt); \ + if ((env) != NULL && (env)->db_errfile != NULL) \ + __db_errfile(env, error, error_set, fmt, ap); \ + va_end(ap); \ + \ + /* \ + * If we have a default and we didn't do either of the above, \ + * write to the default. \ + */ \ + va_start(ap, fmt); \ + if ((stderr_default) && ((env) == NULL || \ + ((env)->db_errcall == NULL && (env)->db_errfile == NULL))) \ + __db_errfile(env, error, error_set, fmt, ap); \ + va_end(ap); \ +} +#else +#define DB_REAL_ERR(env, error, error_set, stderr_default, fmt) { \ + va_list ap; \ + \ + /* Call the user's callback function, if specified. */ \ + va_start(ap); \ + if ((env) != NULL && (env)->db_errcall != NULL) \ + __db_errcall(env, error, error_set, fmt, ap); \ + va_end(ap); \ + \ + /* Write to the user's file descriptor, if specified. */ \ + va_start(ap); \ + if ((env) != NULL && (env)->db_errfile != NULL) \ + __db_errfile(env, error, error_set, fmt, ap); \ + va_end(ap); \ + \ + /* \ + * If we have a default and we didn't do either of the above, \ + * write to the default. \ + */ \ + va_start(ap); \ + if ((stderr_default) && ((env) == NULL || \ + ((env)->db_errcall == NULL && (env)->db_errfile == NULL))) \ + __db_errfile(env, error, error_set, fmt, ap); \ + va_end(ap); \ +} +#endif + +/* + * Debugging macro to log operations. + * If DEBUG_WOP is defined, log operations that modify the database. + * If DEBUG_ROP is defined, log operations that read the database. + * + * D dbp + * T txn + * O operation (string) + * K key + * A data + * F flags + */ +#define LOG_OP(C, T, O, K, A, F) { \ + DB_LSN __lsn; \ + DBT __op; \ + if (DBC_LOGGING((C))) { \ + memset(&__op, 0, sizeof(__op)); \ + __op.data = O; \ + __op.size = strlen(O) + 1; \ + (void)__db_debug_log((C)->dbp->dbenv, T, &__lsn, 0, \ + &__op, (C)->dbp->log_filename->id, K, A, F); \ + } \ +} +#ifdef DEBUG_ROP +#define DEBUG_LREAD(C, T, O, K, A, F) LOG_OP(C, T, O, K, A, F) +#else +#define DEBUG_LREAD(C, T, O, K, A, F) +#endif +#ifdef DEBUG_WOP +#define DEBUG_LWRITE(C, T, O, K, A, F) LOG_OP(C, T, O, K, A, F) +#else +#define DEBUG_LWRITE(C, T, O, K, A, F) +#endif + +/* + * Hook for testing recovery at various places in the create/delete paths. + * Hook for testing subdb locks. + */ +#if CONFIG_TEST +#define DB_TEST_SUBLOCKS(env, flags) \ +do { \ + if ((env)->test_abort == DB_TEST_SUBDB_LOCKS) \ + (flags) |= DB_LOCK_NOWAIT; \ +} while (0) + +#define DB_ENV_TEST_RECOVERY(env, val, ret, name) \ +do { \ + int __ret; \ + PANIC_CHECK((env)); \ + if ((env)->test_copy == (val)) { \ + /* COPY the FILE */ \ + if ((__ret = __db_testcopy((env), NULL, (name))) != 0) \ + (ret) = __db_panic((env), __ret); \ + } \ + if ((env)->test_abort == (val)) { \ + /* ABORT the TXN */ \ + (env)->test_abort = 0; \ + (ret) = EINVAL; \ + goto db_tr_err; \ + } \ +} while (0) + +#define DB_TEST_RECOVERY(dbp, val, ret, name) \ +do { \ + int __ret; \ + PANIC_CHECK((dbp)->dbenv); \ + if ((dbp)->dbenv->test_copy == (val)) { \ + /* Copy the file. */ \ + if (F_ISSET((dbp), \ + DB_AM_OPEN_CALLED) && (dbp)->mpf != NULL) \ + (void)(dbp)->sync((dbp), 0); \ + if ((__ret = \ + __db_testcopy((dbp)->dbenv, (dbp), (name))) != 0) \ + (ret) = __db_panic((dbp)->dbenv, __ret); \ + } \ + if ((dbp)->dbenv->test_abort == (val)) { \ + /* Abort the transaction. */ \ + (dbp)->dbenv->test_abort = 0; \ + (ret) = EINVAL; \ + goto db_tr_err; \ + } \ +} while (0) + +#define DB_TEST_RECOVERY_LABEL db_tr_err: +#else +#define DB_TEST_SUBLOCKS(env, flags) +#define DB_ENV_TEST_RECOVERY(env, val, ret, name) +#define DB_TEST_RECOVERY(dbp, val, ret, name) +#define DB_TEST_RECOVERY_LABEL +#endif + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_DEBUG_H_ */ diff --git a/db/dbinc/fop.h b/db/dbinc/fop.h new file mode 100644 index 000000000..d431dcb95 --- /dev/null +++ b/db/dbinc/fop.h @@ -0,0 +1,16 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: fop.h,v 11.3 2002/03/27 04:34:54 bostic Exp + */ + +#ifndef _FOP_H_ +#define _FOP_H_ + +#include "dbinc_auto/fileops_auto.h" +#include "dbinc_auto/fileops_ext.h" + +#endif /* !_FOP_H_ */ diff --git a/db/dbinc/globals.h b/db/dbinc/globals.h new file mode 100644 index 000000000..415e5dd17 --- /dev/null +++ b/db/dbinc/globals.h @@ -0,0 +1,83 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: globals.h,v 11.1 2002/07/12 18:56:41 bostic Exp + */ + +/******************************************************* + * Global variables. + * + * Held in a single structure to minimize the name-space pollution. + *******************************************************/ +#ifdef HAVE_VXWORKS +#include "semLib.h" +#endif + +typedef struct __db_globals { + u_int32_t no_write_errors; /* write error testing disallowed */ +#ifdef HAVE_VXWORKS + u_int32_t db_global_init; /* VxWorks: inited */ + SEM_ID db_global_lock; /* VxWorks: global semaphore */ +#endif + /* XA: list of opened environments. */ + TAILQ_HEAD(__db_envq, __db_env) db_envq; + + int (*j_close) __P((int)); /* Underlying OS interface jump table.*/ + void (*j_dirfree) __P((char **, int)); + int (*j_dirlist) __P((const char *, char ***, int *)); + int (*j_exists) __P((const char *, int *)); + void (*j_free) __P((void *)); + int (*j_fsync) __P((int)); + int (*j_ioinfo) __P((const char *, + int, u_int32_t *, u_int32_t *, u_int32_t *)); + void *(*j_malloc) __P((size_t)); + int (*j_map) __P((char *, size_t, int, int, void **)); + int (*j_open) __P((const char *, int, ...)); + ssize_t (*j_read) __P((int, void *, size_t)); + void *(*j_realloc) __P((void *, size_t)); + int (*j_rename) __P((const char *, const char *)); + int (*j_seek) __P((int, size_t, db_pgno_t, u_int32_t, int, int)); + int (*j_sleep) __P((u_long, u_long)); + int (*j_unlink) __P((const char *)); + int (*j_unmap) __P((void *, size_t)); + ssize_t (*j_write) __P((int, const void *, size_t)); + int (*j_yield) __P((void)); +} DB_GLOBALS; + +#ifdef DB_INITIALIZE_DB_GLOBALS +DB_GLOBALS __db_global_values = { + 0, /* write error testing disallowed */ +#ifdef HAVE_VXWORKS + 0, /* VxWorks: initialized */ + NULL, /* VxWorks: global semaphore */ +#endif + /* XA: list of opened environments. */ + {NULL, &__db_global_values.db_envq.tqh_first}, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; +#else +extern DB_GLOBALS __db_global_values; +#endif + +#define DB_GLOBAL(v) __db_global_values.v diff --git a/db/dbinc/hash.h b/db/dbinc/hash.h new file mode 100644 index 000000000..3c1848195 --- /dev/null +++ b/db/dbinc/hash.h @@ -0,0 +1,147 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Id: hash.h,v 11.26 2002/03/27 04:34:54 bostic Exp + */ + +#ifndef _DB_HASH_H_ +#define _DB_HASH_H_ + +/* Hash internal structure. */ +typedef struct hash_t { + db_pgno_t meta_pgno; /* Page number of the meta data page. */ + u_int32_t h_ffactor; /* Fill factor. */ + u_int32_t h_nelem; /* Number of elements. */ + /* Hash function. */ + u_int32_t (*h_hash) __P((DB *, const void *, u_int32_t)); +} HASH; + +/* Cursor structure definitions. */ +typedef struct cursor_t { + /* struct __dbc_internal */ + __DBC_INTERNAL + + /* Hash private part */ + + /* Per-thread information */ + DB_LOCK hlock; /* Metadata page lock. */ + HMETA *hdr; /* Pointer to meta-data page. */ + PAGE *split_buf; /* Temporary buffer for splits. */ + + /* Hash cursor information */ + db_pgno_t bucket; /* Bucket we are traversing. */ + db_pgno_t lbucket; /* Bucket for which we are locked. */ + db_indx_t dup_off; /* Offset within a duplicate set. */ + db_indx_t dup_len; /* Length of current duplicate. */ + db_indx_t dup_tlen; /* Total length of duplicate entry. */ + u_int32_t seek_size; /* Number of bytes we need for add. */ + db_pgno_t seek_found_page;/* Page on which we can insert. */ + u_int32_t order; /* Relative order among deleted curs. */ + +#define H_CONTINUE 0x0001 /* Join--search strictly fwd for data */ +#define H_DELETED 0x0002 /* Cursor item is deleted. */ +#define H_DIRTY 0x0004 /* Meta-data page needs to be written */ +#define H_DUPONLY 0x0008 /* Dups only; do not change key. */ +#define H_EXPAND 0x0010 /* Table expanded. */ +#define H_ISDUP 0x0020 /* Cursor is within duplicate set. */ +#define H_NEXT_NODUP 0x0040 /* Get next non-dup entry. */ +#define H_NOMORE 0x0080 /* No more entries in bucket. */ +#define H_OK 0x0100 /* Request succeeded. */ + u_int32_t flags; +} HASH_CURSOR; + +/* Test string. */ +#define CHARKEY "%$sniglet^&" + +/* Overflow management */ +/* + * The spares table indicates the page number at which each doubling begins. + * From this page number we subtract the number of buckets already allocated + * so that we can do a simple addition to calculate the page number here. + */ +#define BS_TO_PAGE(bucket, spares) \ + ((bucket) + (spares)[__db_log2((bucket) + 1)]) +#define BUCKET_TO_PAGE(I, B) (BS_TO_PAGE((B), (I)->hdr->spares)) + +/* Constraints about much data goes on a page. */ + +#define MINFILL 4 +#define ISBIG(I, N) (((N) > ((I)->hdr->dbmeta.pagesize / MINFILL)) ? 1 : 0) + +/* Shorthands for accessing structure */ +#define NDX_INVALID 0xFFFF +#define BUCKET_INVALID 0xFFFFFFFF + +/* On page duplicates are stored as a string of size-data-size triples. */ +#define DUP_SIZE(len) ((len) + 2 * sizeof(db_indx_t)) + +/* Log messages types (these are subtypes within a record type) */ +#define PAIR_KEYMASK 0x1 +#define PAIR_DATAMASK 0x2 +#define PAIR_DUPMASK 0x4 +#define PAIR_MASK 0xf +#define PAIR_ISKEYBIG(N) (N & PAIR_KEYMASK) +#define PAIR_ISDATABIG(N) (N & PAIR_DATAMASK) +#define PAIR_ISDATADUP(N) (N & PAIR_DUPMASK) +#define OPCODE_OF(N) (N & ~PAIR_MASK) + +#define PUTPAIR 0x20 +#define DELPAIR 0x30 +#define PUTOVFL 0x40 +#define DELOVFL 0x50 +#define HASH_UNUSED1 0x60 +#define HASH_UNUSED2 0x70 +#define SPLITOLD 0x80 +#define SPLITNEW 0x90 + +typedef enum { + DB_HAM_CHGPG = 1, + DB_HAM_DELFIRSTPG = 2, + DB_HAM_DELMIDPG = 3, + DB_HAM_DELLASTPG = 4, + DB_HAM_DUP = 5, + DB_HAM_SPLIT = 6 +} db_ham_mode; + +#include "dbinc_auto/hash_auto.h" +#include "dbinc_auto/hash_ext.h" +#include "dbinc/db_am.h" +#endif /* !_DB_HASH_H_ */ diff --git a/db/dbinc/hmac.h b/db/dbinc/hmac.h new file mode 100644 index 000000000..efc0cd93d --- /dev/null +++ b/db/dbinc/hmac.h @@ -0,0 +1,32 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: hmac.h,v 1.3 2002/08/06 06:37:08 bostic Exp + */ + +#ifndef _DB_HMAC_H_ +#define _DB_HMAC_H_ + +/* + * Algorithm specific information. + */ +/* + * SHA1 checksumming + */ +typedef struct { + u_int32_t state[5]; + u_int32_t count[2]; + unsigned char buffer[64]; +} SHA1_CTX; + +/* + * AES assumes the SHA1 checksumming (also called MAC) + */ +#define DB_MAC_MAGIC "mac derivation key magic value" +#define DB_ENC_MAGIC "encryption and decryption key value magic" + +#include "dbinc_auto/hmac_ext.h" +#endif /* !_DB_HMAC_H_ */ diff --git a/db/dbinc/lock.h b/db/dbinc/lock.h new file mode 100644 index 000000000..08da9a0ef --- /dev/null +++ b/db/dbinc/lock.h @@ -0,0 +1,212 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: lock.h,v 11.42 2002/05/18 01:34:13 bostic Exp + */ + +#ifndef _DB_LOCK_H_ +#define _DB_LOCK_H_ + +#define DB_LOCK_DEFAULT_N 1000 /* Default # of locks in region. */ + +/* + * The locker id space is divided between the transaction manager and the lock + * manager. Lock IDs start at 1 and go to DB_LOCK_MAXID. Txn IDs start at + * DB_LOCK_MAXID + 1 and go up to TXN_MAXIMUM. + */ +#define DB_LOCK_INVALIDID 0 +#define DB_LOCK_MAXID 0x7fffffff + +/* + * Out of band value for a lock. Locks contain an offset into a lock region, + * so we use an invalid region offset to indicate an invalid or unset lock. + */ +#define LOCK_INVALID INVALID_ROFF +#define LOCK_ISSET(lock) ((lock).off != LOCK_INVALID) +#define LOCK_INIT(lock) ((lock).off = LOCK_INVALID) + +/* + * Macro to identify a write lock for the purpose of counting locks + * for the NUMWRITES option to deadlock detection. + */ +#define IS_WRITELOCK(m) \ + ((m) == DB_LOCK_WRITE || (m) == DB_LOCK_IWRITE || (m) == DB_LOCK_IWR) + +/* + * Lock timers. + */ +typedef struct { + u_int32_t tv_sec; /* Seconds. */ + u_int32_t tv_usec; /* Microseconds. */ +} db_timeval_t; + +#define LOCK_TIME_ISVALID(time) ((time)->tv_sec != 0) +#define LOCK_SET_TIME_INVALID(time) ((time)->tv_sec = 0) +#define LOCK_TIME_EQUAL(t1, t2) \ + ((t1)->tv_sec == (t2)->tv_sec && (t1)->tv_usec == (t2)->tv_usec) + +/* + * DB_LOCKREGION -- + * The lock shared region. + */ +typedef struct __db_lockregion { + u_int32_t need_dd; /* flag for deadlock detector */ + u_int32_t detect; /* run dd on every conflict */ + /* free lock header */ + SH_TAILQ_HEAD(__flock) free_locks; + /* free obj header */ + SH_TAILQ_HEAD(__fobj) free_objs; + /* free locker header */ + SH_TAILQ_HEAD(__flocker) free_lockers; + SH_TAILQ_HEAD(__dobj) dd_objs; /* objects with waiters */ + SH_TAILQ_HEAD(__lkrs) lockers; /* list of lockers */ + + db_timeout_t lk_timeout; /* timeout for locks. */ + db_timeout_t tx_timeout; /* timeout for txns. */ + + u_int32_t locker_t_size; /* size of locker hash table */ + u_int32_t object_t_size; /* size of object hash table */ + + roff_t conf_off; /* offset of conflicts array */ + roff_t obj_off; /* offset of object hash table */ + roff_t osynch_off; /* offset of the object mutex table */ + roff_t locker_off; /* offset of locker hash table */ + roff_t lsynch_off; /* offset of the locker mutex table */ + + DB_LOCK_STAT stat; /* stats about locking. */ + +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES + roff_t maint_off; /* offset of region maintenance info */ +#endif +} DB_LOCKREGION; + +/* + * Since we will store DBTs in shared memory, we need the equivalent of a + * DBT that will work in shared memory. + */ +typedef struct __sh_dbt { + u_int32_t size; /* Byte length. */ + ssize_t off; /* Region offset. */ +} SH_DBT; + +#define SH_DBT_PTR(p) ((void *)(((u_int8_t *)(p)) + (p)->off)) + +/* + * Object structures; these live in the object hash table. + */ +typedef struct __db_lockobj { + SH_DBT lockobj; /* Identifies object locked. */ + SH_TAILQ_ENTRY links; /* Links for free list or hash list. */ + SH_TAILQ_ENTRY dd_links; /* Links for dd list. */ + SH_TAILQ_HEAD(__wait) waiters; /* List of waiting locks. */ + SH_TAILQ_HEAD(__hold) holders; /* List of held locks. */ + /* Declare room in the object to hold + * typical DB lock structures so that + * we do not have to allocate them from + * shalloc at run-time. */ + u_int8_t objdata[sizeof(struct __db_ilock)]; +} DB_LOCKOBJ; + +/* + * Locker structures; these live in the locker hash table. + */ +typedef struct __db_locker { + u_int32_t id; /* Locker id. */ + u_int32_t dd_id; /* Deadlock detector id. */ + u_int32_t nlocks; /* Number of locks held. */ + u_int32_t nwrites; /* Number of write locks held. */ + size_t master_locker; /* Locker of master transaction. */ + size_t parent_locker; /* Parent of this child. */ + SH_LIST_HEAD(_child) child_locker; /* List of descendant txns; + only used in a "master" + txn. */ + SH_LIST_ENTRY child_link; /* Links transactions in the family; + elements of the child_locker + list. */ + SH_TAILQ_ENTRY links; /* Links for free and hash list. */ + SH_TAILQ_ENTRY ulinks; /* Links in-use list. */ + SH_LIST_HEAD(_held) heldby; /* Locks held by this locker. */ + db_timeval_t lk_expire; /* When current lock expires. */ + db_timeval_t tx_expire; /* When this txn expires. */ + db_timeout_t lk_timeout; /* How long do we let locks live. */ + +#define DB_LOCKER_DELETED 0x0001 +#define DB_LOCKER_DIRTY 0x0002 +#define DB_LOCKER_INABORT 0x0004 +#define DB_LOCKER_TIMEOUT 0x0008 + u_int32_t flags; +} DB_LOCKER; + +/* + * DB_LOCKTAB -- + * The primary library lock data structure (i.e., the one referenced + * by the environment, as opposed to the internal one laid out in the region.) + */ +typedef struct __db_locktab { + DB_ENV *dbenv; /* Environment. */ + REGINFO reginfo; /* Region information. */ + u_int8_t *conflicts; /* Pointer to conflict matrix. */ + DB_HASHTAB *obj_tab; /* Beginning of object hash table. */ + DB_HASHTAB *locker_tab; /* Beginning of locker hash table. */ +} DB_LOCKTAB; + +/* Test for conflicts. */ +#define CONFLICTS(T, R, HELD, WANTED) \ + (T)->conflicts[(HELD) * (R)->stat.st_nmodes + (WANTED)] + +#define OBJ_LINKS_VALID(L) ((L)->links.stqe_prev != -1) + +struct __db_lock { + /* + * Wait on mutex to wait on lock. You reference your own mutex with + * ID 0 and others reference your mutex with ID 1. + */ + DB_MUTEX mutex; + + u_int32_t holder; /* Who holds this lock. */ + u_int32_t gen; /* Generation count. */ + SH_TAILQ_ENTRY links; /* Free or holder/waiter list. */ + SH_LIST_ENTRY locker_links; /* List of locks held by a locker. */ + u_int32_t refcount; /* Reference count the lock. */ + db_lockmode_t mode; /* What sort of lock. */ + ssize_t obj; /* Relative offset of object struct. */ + db_status_t status; /* Status of this lock. */ +}; + +/* + * Flag values for __lock_put_internal: + * DB_LOCK_DOALL: Unlock all references in this lock (instead of only 1). + * DB_LOCK_FREE: Free the lock (used in checklocker). + * DB_LOCK_IGNOREDEL: Remove from the locker hash table even if already + deleted (used in checklocker). + * DB_LOCK_NOPROMOTE: Don't bother running promotion when releasing locks + * (used by __lock_put_internal). + * DB_LOCK_UNLINK: Remove from the locker links (used in checklocker). + * Make sure that these do not conflict with the interface flags because + * we pass some of those around (i.e., DB_LOCK_REMOVE). + */ +#define DB_LOCK_DOALL 0x010000 +#define DB_LOCK_FREE 0x020000 +#define DB_LOCK_IGNOREDEL 0x040000 +#define DB_LOCK_NOPROMOTE 0x080000 +#define DB_LOCK_UNLINK 0x100000 +#define DB_LOCK_NOWAITERS 0x200000 + +/* + * Macros to get/release different types of mutexes. + */ +#define OBJECT_LOCK(lt, reg, obj, ndx) \ + ndx = __lock_ohash(obj) % (reg)->object_t_size +#define SHOBJECT_LOCK(lt, reg, shobj, ndx) \ + ndx = __lock_lhash(shobj) % (reg)->object_t_size +#define LOCKER_LOCK(lt, reg, locker, ndx) \ + ndx = __lock_locker_hash(locker) % (reg)->locker_t_size; + +#define LOCKREGION(dbenv, lt) R_LOCK((dbenv), &(lt)->reginfo) +#define UNLOCKREGION(dbenv, lt) R_UNLOCK((dbenv), &(lt)->reginfo) + +#include "dbinc_auto/lock_ext.h" +#endif /* !_DB_LOCK_H_ */ diff --git a/db/dbinc/log.h b/db/dbinc/log.h new file mode 100644 index 000000000..acc05ae43 --- /dev/null +++ b/db/dbinc/log.h @@ -0,0 +1,273 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: log.h,v 11.60 2002/08/06 06:37:08 bostic Exp + */ + +#ifndef _LOG_H_ +#define _LOG_H_ + +struct __db_log; typedef struct __db_log DB_LOG; +struct __hdr; typedef struct __hdr HDR; +struct __log; typedef struct __log LOG; +struct __log_persist; typedef struct __log_persist LOGP; + +#define LFPREFIX "log." /* Log file name prefix. */ +#define LFNAME "log.%010d" /* Log file name template. */ +#define LFNAME_V1 "log.%05d" /* Log file name template, rev 1. */ + +#define LG_MAX_DEFAULT (10 * MEGABYTE) /* 10 MB. */ +#define LG_BSIZE_DEFAULT (32 * 1024) /* 32 KB. */ +#define LG_BASE_REGION_SIZE (60 * 1024) /* 60 KB. */ + +/* + * The per-process table that maps log file-id's to DB structures. + */ +typedef struct __db_entry { + DB *dbp; /* Open dbp for this file id. */ + int deleted; /* File was not found during open. */ +} DB_ENTRY; + +/* + * DB_LOG + * Per-process log structure. + */ +struct __db_log { +/* + * These fields need to be protected for multi-threaded support. + * + * !!! + * As this structure is allocated in per-process memory, the mutex may need + * to be stored elsewhere on architectures unable to support mutexes in heap + * memory, e.g., HP/UX 9. + */ + DB_MUTEX *mutexp; /* Mutex for thread protection. */ + + DB_ENTRY *dbentry; /* Recovery file-id mapping. */ +#define DB_GROW_SIZE 64 + int32_t dbentry_cnt; /* Entries. Grows by DB_GROW_SIZE. */ + +/* + * These fields are always accessed while the region lock is held, so they do + * not have to be protected by the thread lock as well, OR, they are only used + * when threads are not being used, i.e. most cursor operations are disallowed + * on threaded logs. + */ + u_int32_t lfname; /* Log file "name". */ + DB_FH lfh; /* Log file handle. */ + + u_int8_t *bufp; /* Region buffer. */ + +/* These fields are not protected. */ + DB_ENV *dbenv; /* Reference to error information. */ + REGINFO reginfo; /* Region information. */ + +#define DBLOG_RECOVER 0x01 /* We are in recovery. */ +#define DBLOG_FORCE_OPEN 0x02 /* Force the DB open even if it appears + * to be deleted. + */ + u_int32_t flags; +}; + +/* + * HDR -- + * Log record header. + */ +struct __hdr { + u_int32_t prev; /* Previous offset. */ + u_int32_t len; /* Current length. */ + u_int8_t chksum[DB_MAC_KEY]; /* Current checksum. */ + u_int8_t iv[DB_IV_BYTES]; /* IV */ + u_int32_t orig_size; /* Original size of log record */ + /* !!! - 'size' is not written to log, must be last in hdr */ + size_t size; /* Size of header to use */ +}; + +/* + * We use HDR internally, and then when we write out, we write out + * prev, len, and then a 4-byte checksum if normal operation or + * a crypto-checksum and IV and original size if running in crypto + * mode. We must store the original size in case we pad. Set the + * size when we set up the header. We compute a DB_MAC_KEY size + * checksum regardless, but we can safely just use the first 4 bytes. + */ +#define HDR_NORMAL_SZ 12 +#define HDR_CRYPTO_SZ 12 + DB_MAC_KEY + DB_IV_BYTES + +struct __log_persist { + u_int32_t magic; /* DB_LOGMAGIC */ + u_int32_t version; /* DB_LOGVERSION */ + + u_int32_t log_size; /* Log file size. */ + u_int32_t mode; /* Log file mode. */ +}; + +/* + * LOG -- + * Shared log region. One of these is allocated in shared memory, + * and describes the log. + */ +struct __log { + /* + * Due to alignment constraints on some architectures (e.g. HP-UX), + * DB_MUTEXes must be the first element of shalloced structures, + * and as a corollary there can be only one per structure. Thus, + * flush_mutex_off points to a mutex in a separately-allocated chunk. + */ + DB_MUTEX fq_mutex; /* Mutex guarding file name list. */ + + LOGP persist; /* Persistent information. */ + + SH_TAILQ_HEAD(__fq1) fq; /* List of file names. */ + int32_t fid_max; /* Max fid allocated. */ + roff_t free_fid_stack; /* Stack of free file ids. */ + int free_fids; /* Height of free fid stack. */ + int free_fids_alloced; /* Number of free fid slots alloc'ed. */ + + /* + * 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. */ + + /* + * 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_int32_t w_off; /* Current write offset in the file. */ + u_int32_t len; /* Length of the last record. */ + + /* + * The s_lsn LSN is the last LSN that we know is on disk, not just + * written, but synced. This field is protected by the flush mutex + * rather than by the region mutex. + */ + int in_flush; /* Log flush in progress. */ + roff_t flush_mutex_off; /* Mutex guarding flushing. */ + DB_LSN s_lsn; /* LSN of the last sync. */ + + DB_LOG_STAT stat; /* Log statistics. */ + + /* + * The waiting_lsn is used by the replication system. It is the + * first LSN that we are holding without putting in the log, because + * we received one or more log records out of order. Associated with + * the waiting_lsn is the number of log records that we still have to + * receive before we decide that we should request it again. + */ + DB_LSN waiting_lsn; /* First log record after a gap. */ + DB_LSN verify_lsn; /* LSN we are waiting to verify. */ + u_int32_t wait_recs; /* Records to wait before requesting. */ + u_int32_t rcvd_recs; /* Records received while waiting. */ + + /* + * The ready_lsn is also used by the replication system. It is the + * next LSN we expect to receive. It's normally equal to "lsn", + * except at the beginning of a log file, at which point it's set + * to the LSN of the first record of the new file (after the + * header), rather than to 0. + */ + DB_LSN ready_lsn; + + /* + * During initialization, the log system walks forward through the + * last log file to find its end. If it runs into a checkpoint + * while it's doing so, it caches it here so that the transaction + * system doesn't need to walk through the file again on its + * initialization. + */ + DB_LSN cached_ckp_lsn; + + roff_t buffer_off; /* Log buffer offset in the region. */ + u_int32_t buffer_size; /* Log buffer size. */ + + u_int32_t log_size; /* Log file's size. */ + u_int32_t log_nsize; /* Next log file's size. */ + + u_int32_t ncommit; /* Number of txns waiting to commit. */ + + DB_LSN t_lsn; /* LSN of first commit */ + SH_TAILQ_HEAD(__commit) commits;/* list of txns waiting to commit. */ + SH_TAILQ_HEAD(__free) free_commits;/* free list of commit structs. */ + +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES +#define LG_MAINT_SIZE (sizeof(roff_t) * DB_MAX_HANDLES) + + roff_t maint_off; /* offset of region maintenance info */ +#endif +}; + +/* + * __db_commit structure -- + * One of these is allocated for each transaction waiting + * to commit. + */ +struct __db_commit { + DB_MUTEX mutex; /* Mutex for txn to wait on. */ + DB_LSN lsn; /* LSN of commit record. */ + SH_TAILQ_ENTRY links; /* Either on free or waiting list. */ + +#define DB_COMMIT_FLUSH 0x0001 /* Flush the log when you wake up. */ + u_int32_t flags; +}; + +/* + * FNAME -- + * File name and id. + */ +struct __fname { + SH_TAILQ_ENTRY q; /* File name queue. */ + + int32_t id; /* Logging file id. */ + DBTYPE s_type; /* Saved DB type. */ + + roff_t name_off; /* Name offset. */ + db_pgno_t meta_pgno; /* Page number of the meta page. */ + u_int8_t ufid[DB_FILE_ID_LEN]; /* Unique file id. */ + + u_int32_t create_txnid; /* + * Txn ID of the DB create, stored so + * we can log it at register time. + */ +}; + +/* 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. */ +#define LOG_RCLOSE 4 /* File close after recovery. */ + +#define CHECK_LSN(redo, cmp, lsn, prev) \ + DB_ASSERT(!DB_REDO(redo) || \ + (cmp) >= 0 || IS_NOT_LOGGED_LSN(*lsn)); \ + if (DB_REDO(redo) && (cmp) < 0 && !IS_NOT_LOGGED_LSN(*(lsn))) { \ + __db_err(dbenv, \ + "Log sequence error: page LSN %lu %lu; previous LSN %lu %lu", \ + (u_long)(lsn)->file, (u_long)(lsn)->offset, \ + (u_long)(prev)->file, (u_long)(prev)->offset); \ + goto out; \ + } + +/* + * Status codes indicating the validity of a log file examined by + * __log_valid(). + */ +typedef enum { + DB_LV_INCOMPLETE, + DB_LV_NONEXISTENT, + DB_LV_NORMAL, + DB_LV_OLD_READABLE, + DB_LV_OLD_UNREADABLE +} logfile_validity; + +#include "dbinc_auto/dbreg_auto.h" +#include "dbinc_auto/dbreg_ext.h" +#include "dbinc_auto/log_ext.h" +#endif /* !_LOG_H_ */ diff --git a/db/dbinc/mp.h b/db/dbinc/mp.h new file mode 100644 index 000000000..e94e320b6 --- /dev/null +++ b/db/dbinc/mp.h @@ -0,0 +1,293 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: mp.h,v 11.44 2002/08/06 06:11:21 bostic Exp + */ + +#ifndef _DB_MP_H_ +#define _DB_MP_H_ + +struct __bh; typedef struct __bh BH; +struct __db_mpool_hash; typedef struct __db_mpool_hash DB_MPOOL_HASH; +struct __db_mpreg; typedef struct __db_mpreg DB_MPREG; +struct __mpool; typedef struct __mpool MPOOL; + + /* We require at least 20KB of cache. */ +#define DB_CACHESIZE_MIN (20 * 1024) + +typedef enum { + DB_SYNC_ALLOC, /* Flush for allocation. */ + DB_SYNC_CACHE, /* Checkpoint or flush entire cache. */ + DB_SYNC_FILE, /* Flush file. */ + DB_SYNC_TRICKLE /* Trickle sync. */ +} db_sync_op; + +/* + * DB_MPOOL -- + * Per-process memory pool structure. + */ +struct __db_mpool { + /* These fields need to be protected for multi-threaded support. */ + DB_MUTEX *mutexp; /* Structure thread lock. */ + + /* List of pgin/pgout routines. */ + LIST_HEAD(__db_mpregh, __db_mpreg) dbregq; + + /* List of DB_MPOOLFILE's. */ + TAILQ_HEAD(__db_mpoolfileh, __db_mpoolfile) dbmfq; + + /* + * The dbenv, nreg and reginfo fields are not thread protected, + * as they are initialized during mpool creation, and not modified + * again. + */ + DB_ENV *dbenv; /* Enclosing environment. */ + + u_int32_t nreg; /* N underlying cache regions. */ + REGINFO *reginfo; /* Underlying cache regions. */ +}; + +/* + * DB_MPREG -- + * DB_MPOOL registry of pgin/pgout functions. + */ +struct __db_mpreg { + LIST_ENTRY(__db_mpreg) q; /* Linked list. */ + + int32_t ftype; /* File type. */ + /* Pgin, pgout routines. */ + int (*pgin) __P((DB_ENV *, db_pgno_t, void *, DBT *)); + int (*pgout) __P((DB_ENV *, db_pgno_t, void *, DBT *)); +}; + +/* + * NCACHE -- + * Select a cache based on the file and the page number. Assumes accesses + * are uniform across pages, which is probably OK. What we really want to + * avoid is anything that puts all pages from any single file in the same + * cache, as we expect that file access will be bursty, and to avoid + * putting all page number N pages in the same cache as we expect access + * to the metapages (page 0) and the root of a btree (page 1) to be much + * more frequent than a random data page. + */ +#define NCACHE(mp, mf_offset, pgno) \ + (((pgno) ^ ((mf_offset) >> 3)) % ((MPOOL *)mp)->nreg) + +/* + * NBUCKET -- + * We make the assumption that early pages of the file are more likely + * to be retrieved than the later pages, which means the top bits will + * be more interesting for hashing as they're less likely to collide. + * That said, as 512 8K pages represents a 4MB file, so only reasonably + * large files will have page numbers with any other than the bottom 9 + * bits set. We XOR in the MPOOL offset of the MPOOLFILE that backs the + * page, since that should also be unique for the page. We don't want + * to do anything very fancy -- speed is more important to us than using + * good hashing. + */ +#define NBUCKET(mc, mf_offset, pgno) \ + (((pgno) ^ ((mf_offset) << 9)) % (mc)->htab_buckets) + +/* + * MPOOL -- + * Shared memory pool region. + */ +struct __mpool { + /* + * The memory pool can be broken up into individual pieces/files. + * Not what we would have liked, but on Solaris you can allocate + * only a little more than 2GB of memory in a contiguous chunk, + * and I expect to see more systems with similar issues. + * + * While this structure is duplicated in each piece of the cache, + * the first of these pieces/files describes the entire pool, the + * second only describe a piece of the cache. + */ + + /* + * The lsn field and list of underlying MPOOLFILEs are thread protected + * by the region lock. + */ + DB_LSN lsn; /* Maximum checkpoint LSN. */ + + SH_TAILQ_HEAD(__mpfq) mpfq; /* List of MPOOLFILEs. */ + + /* + * The nreg, regids and maint_off fields are not thread protected, + * as they are initialized during mpool creation, and not modified + * again. + */ + u_int32_t nreg; /* Number of underlying REGIONS. */ + roff_t regids; /* Array of underlying REGION Ids. */ + +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES + roff_t maint_off; /* Maintenance information offset */ +#endif + + /* + * The following structure fields only describe the per-cache portion + * of the region. + * + * The htab and htab_buckets fields are not thread protected as they + * are initialized during mpool creation, and not modified again. + * + * The last_checked and lru_count fields are thread protected by + * the region lock. + */ + int htab_buckets; /* Number of hash table entries. */ + roff_t htab; /* Hash table offset. */ + u_int32_t last_checked; /* Last bucket checked for free. */ + u_int32_t lru_count; /* Counter for buffer LRU */ + + /* + * The stat fields are generally not thread protected, and cannot be + * trusted. Note that st_pages is an exception, and is always updated + * inside a region lock (although it is sometimes read outside of the + * region lock). + */ + DB_MPOOL_STAT stat; /* Per-cache mpool statistics. */ +}; + +struct __db_mpool_hash { + DB_MUTEX hash_mutex; /* Per-bucket mutex. */ + + DB_HASHTAB hash_bucket; /* Head of bucket. */ + + u_int32_t hash_page_dirty;/* Count of dirty pages. */ + u_int32_t hash_priority; /* Minimum priority of bucket buffer. */ +}; + +/* + * The base mpool priority is 1/4th of the name space, or just under 2^30. + * When the LRU counter wraps, we shift everybody down to a base-relative + * value. + */ +#define MPOOL_BASE_DECREMENT (UINT32_T_MAX - (UINT32_T_MAX / 4)) + +/* + * Mpool priorities from low to high. Defined in terms of fractions of the + * buffers in the pool. + */ +#define MPOOL_PRI_VERY_LOW -1 /* Dead duck. Check and set to 0. */ +#define MPOOL_PRI_LOW -2 /* Low. */ +#define MPOOL_PRI_DEFAULT 0 /* No adjustment -- special case.*/ +#define MPOOL_PRI_HIGH 10 /* With the dirty buffers. */ +#define MPOOL_PRI_DIRTY 10 /* Dirty gets a 10% boost. */ +#define MPOOL_PRI_VERY_HIGH 1 /* Add number of buffers in pool. */ + +/* + * MPOOLFILE_IGNORE -- + * Discard an MPOOLFILE and any buffers it references: update the flags + * so we never try to write buffers associated with the file, nor can we + * find it when looking for files to join. In addition, clear the ftype + * field, there's no reason to post-process pages, they can be discarded + * by any thread. + * + * Expects the MPOOLFILE mutex to be held. + */ +#define MPOOLFILE_IGNORE(mfp) { \ + (mfp)->ftype = 0; \ + F_SET(mfp, MP_DEADFILE); \ +} + +/* + * MPOOLFILE -- + * Shared DB_MPOOLFILE information. + */ +struct __mpoolfile { + DB_MUTEX mutex; + + /* Protected by MPOOLFILE mutex. */ + u_int32_t mpf_cnt; /* Ref count: DB_MPOOLFILEs. */ + u_int32_t block_cnt; /* Ref count: blocks in cache. */ + + roff_t path_off; /* File name location. */ + + /* Protected by mpool cache 0 region lock. */ + SH_TAILQ_ENTRY q; /* List of MPOOLFILEs */ + db_pgno_t last_pgno; /* Last page in the file. */ + db_pgno_t orig_last_pgno; /* Original last page in the file. */ + + /* + * None of the following fields are thread protected. + * + * There are potential races with the ftype field because it's read + * without holding a lock. However, it has to be set before adding + * any buffers to the cache that depend on it being set, so there + * would need to be incorrect operation ordering to have a problem. + * + * There are potential races with the priority field because it's read + * without holding a lock. However, a collision is unlikely and if it + * happens is of little consequence. + * + * We do not protect the statistics in "stat" because of the cost of + * the mutex in the get/put routines. There is a chance that a count + * will get lost. + * + * The remaining fields are initialized at open and never subsequently + * modified, except for the MP_DEADFILE, which is only set and never + * unset. (If there was more than one flag that was subsequently set, + * there might be a race, but with a single flag there can't be.) + */ + int32_t ftype; /* File type. */ + + int32_t priority; /* Priority when unpinning buffer. */ + + DB_MPOOL_FSTAT stat; /* Per-file mpool statistics. */ + + int32_t lsn_off; /* Page's LSN offset. */ + u_int32_t clear_len; /* Bytes to clear on page create. */ + + roff_t fileid_off; /* File ID string location. */ + + roff_t pgcookie_len; /* Pgin/pgout cookie length. */ + roff_t pgcookie_off; /* Pgin/pgout cookie location. */ + +#define MP_CAN_MMAP 0x01 /* If the file can be mmap'd. */ +#define MP_DEADFILE 0x02 /* Dirty pages can simply be trashed. */ +#define MP_DIRECT 0x04 /* No OS buffering. */ +#define MP_EXTENT 0x08 /* Extent file. */ +#define MP_TEMP 0x10 /* Backing file is a temporary. */ +#define MP_UNLINK 0x20 /* Unlink file on last close. */ + u_int32_t flags; +}; + +/* + * BH -- + * Buffer header. + */ +struct __bh { + DB_MUTEX mutex; /* Buffer thread/process lock. */ + + u_int16_t ref; /* Reference count. */ + u_int16_t ref_sync; /* Sync wait-for reference count. */ + +#define BH_CALLPGIN 0x001 /* Convert the page before use. */ +#define BH_DIRTY 0x002 /* Page was modified. */ +#define BH_DIRTY_CREATE 0x004 /* Page created, must be written. */ +#define BH_DISCARD 0x008 /* Page is useless. */ +#define BH_LOCKED 0x010 /* Page is locked (I/O in progress). */ +#define BH_TRASH 0x020 /* Page is garbage. */ + u_int16_t flags; + + u_int32_t priority; /* LRU priority. */ + SH_TAILQ_ENTRY hq; /* MPOOL hash bucket queue. */ + + db_pgno_t pgno; /* Underlying MPOOLFILE page number. */ + roff_t mf_offset; /* Associated MPOOLFILE offset. */ + + /* + * !!! + * This array must be at least size_t aligned -- the DB access methods + * put PAGE and other structures into it, and then access them directly. + * (We guarantee size_t alignment to applications in the documentation, + * too.) + */ + u_int8_t buf[1]; /* Variable length data. */ +}; + +#include "dbinc_auto/mp_ext.h" +#endif /* !_DB_MP_H_ */ diff --git a/db/dbinc/mutex.h b/db/dbinc/mutex.h new file mode 100644 index 000000000..8b5f5ad5f --- /dev/null +++ b/db/dbinc/mutex.h @@ -0,0 +1,879 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: mutex.h,v 11.69 2002/08/08 03:19:45 bostic Exp + */ + +#ifndef _DB_MUTEX_H_ +#define _DB_MUTEX_H_ + +/* + * Some of the Berkeley DB ports require single-threading at various + * places in the code. In those cases, these #defines will be set. + */ +#define DB_BEGIN_SINGLE_THREAD +#define DB_END_SINGLE_THREAD + +/********************************************************************* + * POSIX.1 pthreads interface. + *********************************************************************/ +#ifdef HAVE_MUTEX_PTHREADS +#include <pthread.h> + +#define MUTEX_FIELDS \ + pthread_mutex_t mutex; /* Mutex. */ \ + pthread_cond_t cond; /* Condition variable. */ +#endif + +/********************************************************************* + * Solaris lwp threads interface. + * + * !!! + * We use LWP mutexes on Solaris instead of UI or POSIX mutexes (both of + * which are available), for two reasons. First, the Solaris C library + * includes versions of the both UI and POSIX thread mutex interfaces, but + * they are broken in that they don't support inter-process locking, and + * there's no way to detect it, e.g., calls to configure the mutexes for + * inter-process locking succeed without error. So, we use LWP mutexes so + * that we don't fail in fairly undetectable ways because the application + * wasn't linked with the appropriate threads library. Second, there were + * bugs in SunOS 5.7 (Solaris 7) where if an application loaded the C library + * before loading the libthread/libpthread threads libraries (e.g., by using + * dlopen to load the DB library), the pwrite64 interface would be translated + * into a call to pwrite and DB would drop core. + *********************************************************************/ +#ifdef HAVE_MUTEX_SOLARIS_LWP +/* + * XXX + * Don't change <synch.h> to <sys/lwp.h> -- although lwp.h is listed in the + * Solaris manual page as the correct include to use, it causes the Solaris + * compiler on SunOS 2.6 to fail. + */ +#include <synch.h> + +#define MUTEX_FIELDS \ + lwp_mutex_t mutex; /* Mutex. */ \ + lwp_cond_t cond; /* Condition variable. */ +#endif + +/********************************************************************* + * Solaris/Unixware threads interface. + *********************************************************************/ +#ifdef HAVE_MUTEX_UI_THREADS +#include <thread.h> +#include <synch.h> + +#define MUTEX_FIELDS \ + mutex_t mutex; /* Mutex. */ \ + cond_t cond; /* Condition variable. */ +#endif + +/********************************************************************* + * AIX C library functions. + *********************************************************************/ +#ifdef HAVE_MUTEX_AIX_CHECK_LOCK +#include <sys/atomic_op.h> +typedef int tsl_t; +#define MUTEX_ALIGN sizeof(int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) 0 +#define MUTEX_SET(x) (!_check_lock(x, 0, 1)) +#define MUTEX_UNSET(x) _clear_lock(x, 0) +#endif +#endif + +/********************************************************************* + * General C library functions (msemaphore). + * + * !!! + * Check for HPPA as a special case, because it requires unusual alignment, + * and doesn't support semaphores in malloc(3) or shmget(2) memory. + * + * !!! + * Do not remove the MSEM_IF_NOWAIT flag. The problem is that if a single + * process makes two msem_lock() calls in a row, the second one returns an + * error. We depend on the fact that we can lock against ourselves in the + * locking subsystem, where we set up a mutex so that we can block ourselves. + * Tested on OSF1 v4.0. + *********************************************************************/ +#ifdef HAVE_MUTEX_HPPA_MSEM_INIT +#define MUTEX_NO_MALLOC_LOCKS +#define MUTEX_NO_SHMGET_LOCKS + +#define MUTEX_ALIGN 16 +#endif + +#if defined(HAVE_MUTEX_MSEM_INIT) || defined(HAVE_MUTEX_HPPA_MSEM_INIT) +#include <sys/mman.h> +typedef msemaphore tsl_t; + +#ifndef MUTEX_ALIGN +#define MUTEX_ALIGN sizeof(int) +#endif + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) (msem_init(x, MSEM_UNLOCKED) <= (msemaphore *)0) +#define MUTEX_SET(x) (!msem_lock(x, MSEM_IF_NOWAIT)) +#define MUTEX_UNSET(x) msem_unlock(x, 0) +#endif +#endif + +/********************************************************************* + * Plan 9 library functions. + *********************************************************************/ +#ifdef HAVE_MUTEX_PLAN9 +typedef Lock tsl_t; + +#define MUTEX_ALIGN sizeof(int) + +#define MUTEX_INIT(x) (memset(x, 0, sizeof(Lock)), 0) +#define MUTEX_SET(x) canlock(x) +#define MUTEX_UNSET(x) unlock(x) +#endif + +/********************************************************************* + * Reliant UNIX C library functions. + *********************************************************************/ +#ifdef HAVE_MUTEX_RELIANTUNIX_INITSPIN +#include <ulocks.h> +typedef spinlock_t tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) (initspin(x, 1), 0) +#define MUTEX_SET(x) (cspinlock(x) == 0) +#define MUTEX_UNSET(x) spinunlock(x) +#endif +#endif + +/********************************************************************* + * General C library functions (POSIX 1003.1 sema_XXX). + * + * !!! + * Never selected by autoconfig in this release (semaphore calls are known + * to not work in Solaris 5.5). + *********************************************************************/ +#ifdef HAVE_MUTEX_SEMA_INIT +#include <synch.h> +typedef sema_t tsl_t; +#define MUTEX_ALIGN sizeof(int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_DESTROY(x) sema_destroy(x) +#define MUTEX_INIT(x) (sema_init(x, 1, USYNC_PROCESS, NULL) != 0) +#define MUTEX_SET(x) (sema_wait(x) == 0) +#define MUTEX_UNSET(x) sema_post(x) +#endif +#endif + +/********************************************************************* + * SGI C library functions. + *********************************************************************/ +#ifdef HAVE_MUTEX_SGI_INIT_LOCK +#include <abi_mutex.h> +typedef abilock_t tsl_t; +#define MUTEX_ALIGN sizeof(int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) (init_lock(x) != 0) +#define MUTEX_SET(x) (!acquire_lock(x)) +#define MUTEX_UNSET(x) release_lock(x) +#endif +#endif + +/********************************************************************* + * Solaris C library functions. + * + * !!! + * These are undocumented functions, but they're the only ones that work + * correctly as far as we know. + *********************************************************************/ +#ifdef HAVE_MUTEX_SOLARIS_LOCK_TRY +#include <sys/machlock.h> +typedef lock_t tsl_t; +#define MUTEX_ALIGN sizeof(int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) 0 +#define MUTEX_SET(x) _lock_try(x) +#define MUTEX_UNSET(x) _lock_clear(x) +#endif +#endif + +/********************************************************************* + * VMS. + *********************************************************************/ +#ifdef HAVE_MUTEX_VMS +#include <sys/mman.h>; +#include <builtins.h> +typedef unsigned char tsl_t; +#define MUTEX_ALIGN sizeof(unsigned int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#ifdef __ALPHA +#define MUTEX_SET(tsl) (!__TESTBITSSI(tsl, 0)) +#else /* __VAX */ +#define MUTEX_SET(tsl) (!(int)_BBSSI(0, tsl)) +#endif +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * VxWorks + * Use basic binary semaphores in VxWorks, as we currently do not need + * any special features. We do need the ability to single-thread the + * entire system, however, because VxWorks doesn't support the open(2) + * flag O_EXCL, the mechanism we normally use to single thread access + * when we're first looking for a DB environment. + *********************************************************************/ +#ifdef HAVE_MUTEX_VXWORKS +#include "taskLib.h" +typedef SEM_ID tsl_t; +#define MUTEX_ALIGN sizeof(unsigned int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_SET(tsl) (semTake((*tsl), WAIT_FOREVER) == OK) +#define MUTEX_UNSET(tsl) (semGive((*tsl))) +#define MUTEX_INIT(tsl) \ + ((*(tsl) = semBCreate(SEM_Q_FIFO, SEM_FULL)) == NULL) +#define MUTEX_DESTROY(tsl) semDelete(*tsl) +#endif + +/* + * Use the taskLock() mutex to eliminate a race where two tasks are + * trying to initialize the global lock at the same time. + */ +#undef DB_BEGIN_SINGLE_THREAD +#define DB_BEGIN_SINGLE_THREAD \ +do { \ + if (DB_GLOBAL(db_global_init)) \ + (void)semTake(DB_GLOBAL(db_global_lock), WAIT_FOREVER); \ + else { \ + taskLock(); \ + if (DB_GLOBAL(db_global_init)) { \ + taskUnlock(); \ + (void)semTake(DB_GLOBAL(db_global_lock), \ + WAIT_FOREVER); \ + continue; \ + } \ + DB_GLOBAL(db_global_lock) = \ + semBCreate(SEM_Q_FIFO, SEM_EMPTY); \ + if (DB_GLOBAL(db_global_lock) != NULL) \ + DB_GLOBAL(db_global_init) = 1; \ + taskUnlock(); \ + } \ +} while (DB_GLOBAL(db_global_init) == 0) +#undef DB_END_SINGLE_THREAD +#define DB_END_SINGLE_THREAD (void)semGive(DB_GLOBAL(db_global_lock)) +#endif + +/********************************************************************* + * Win16 + * + * Win16 spinlocks are simple because we cannot possibly be preempted. + * + * !!! + * We should simplify this by always returning a no-need-to-lock lock + * when we initialize the mutex. + *********************************************************************/ +#ifdef HAVE_MUTEX_WIN16 +typedef unsigned int tsl_t; +#define MUTEX_ALIGN sizeof(unsigned int) + +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) 0 +#define MUTEX_SET(tsl) (*(tsl) = 1) +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#endif +#endif + +/********************************************************************* + * Win32 + *********************************************************************/ +#ifdef HAVE_MUTEX_WIN32 +#define MUTEX_FIELDS \ + LONG tas; \ + union { \ + HANDLE event; /* Windows event HANDLE for wakeups */ \ + u_int32_t id; /* ID used for shared mutexes */ \ + } /* anonymous */; \ + LONG nwaiters; + +#if defined(LOAD_ACTUAL_MUTEX_CODE) +#define MUTEX_INIT(x) 0 +#define MUTEX_SET(tsl) (!InterlockedExchange((PLONG)tsl, 1)) +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#endif +#endif + +/********************************************************************* + * 68K/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_68K_GCC_ASSEMBLY +typedef unsigned char tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * For gcc/68K, 0 is clear, 1 is set. + */ +#define MUTEX_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + int __r; \ + asm volatile("tas %1; \n \ + seq %0" \ + : "=dm" (__r), "=m" (*__l) \ + : "1" (*__l) \ + ); \ + __r & 1; \ +}) + +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * ALPHA/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY +typedef u_int32_t tsl_t; +#define MUTEX_ALIGN 4 + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * For gcc/alpha. Should return 0 if could not acquire the lock, 1 if + * lock was acquired properly. + */ +#ifdef __GNUC__ +static inline int +MUTEX_SET(tsl_t *tsl) { + register tsl_t *__l = tsl; + register tsl_t __r; + asm volatile( + "1: ldl_l %0,%2\n" + " blbs %0,2f\n" + " or $31,1,%0\n" + " stl_c %0,%1\n" + " beq %0,3f\n" + " mb\n" + " br 3f\n" + "2: xor %0,%0\n" + "3:" + : "=&r"(__r), "=m"(*__l) : "1"(*__l) : "memory"); + return __r; +} + +/* + * Unset mutex. Judging by Alpha Architecture Handbook, the mb instruction + * might be necessary before unlocking + */ +static inline int +MUTEX_UNSET(tsl_t *tsl) { + asm volatile(" mb\n"); + return *tsl = 0; +} +#endif + +#ifdef __DECC +#include <alpha/builtins.h> +#define MUTEX_SET(tsl) (__LOCK_LONG_RETRY((tsl), 1) != 0) +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#endif + +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * ARM/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_ARM_GCC_ASSEMBLY +typedef unsigned char tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * For arm/gcc, 0 is clear, 1 is set. + */ +#define MUTEX_SET(tsl) ({ \ + int __r; \ + asm volatile("swpb %0, %1, [%2]" \ + : "=r" (__r) \ + : "0" (1), "r" (tsl) \ + : "memory" \ + ); \ + __r & 1; \ +}) + +#define MUTEX_UNSET(tsl) (*(volatile tsl_t *)(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * HPPA/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_HPPA_GCC_ASSEMBLY +typedef u_int32_t tsl_t; +#define MUTEX_ALIGN 16 + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * The PA-RISC has a "load and clear" instead of a "test and set" instruction. + * The 32-bit word used by that instruction must be 16-byte aligned. We could + * use the "aligned" attribute in GCC but that doesn't work for stack variables. + */ +#define MUTEX_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + int __r; \ + asm volatile("ldcws 0(%1),%0" : "=r" (__r) : "r" (__l)); \ + __r & 1; \ +}) + +#define MUTEX_UNSET(tsl) (*(tsl) = -1) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * IA64/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_IA64_GCC_ASSEMBLY +typedef unsigned char tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * For gcc/ia64, 0 is clear, 1 is set. + */ +#define MUTEX_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + long __r; \ + asm volatile("xchg1 %0=%1,%3" : "=r"(__r), "=m"(*__l) : "1"(*__l), "r"(1));\ + __r ^ 1; \ +}) + +/* + * Store through a "volatile" pointer so we get a store with "release" + * semantics. + */ +#define MUTEX_UNSET(tsl) (*(volatile unsigned char *)(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * PowerPC/gcc assembly. + *********************************************************************/ +#if defined(HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY) || \ + (HAVE_MUTEX_PPC_APPLE_GCC_ASSEMBLY) +typedef u_int32_t tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * The PowerPC does a sort of pseudo-atomic locking. You set up a + * 'reservation' on a chunk of memory containing a mutex by loading the + * mutex value with LWARX. If the mutex has an 'unlocked' (arbitrary) + * value, you then try storing into it with STWCX. If no other process or + * thread broke your 'reservation' by modifying the memory containing the + * mutex, then the STCWX succeeds; otherwise it fails and you try to get + * a reservation again. + * + * While mutexes are explicitly 4 bytes, a 'reservation' applies to an + * entire cache line, normally 32 bytes, aligned naturally. If the mutex + * lives near data that gets changed a lot, there's a chance that you'll + * see more broken reservations than you might otherwise. The only + * situation in which this might be a problem is if one processor is + * beating on a variable in the same cache block as the mutex while another + * processor tries to acquire the mutex. That's bad news regardless + * because of the way it bashes caches, but if you can't guarantee that a + * mutex will reside in a relatively quiescent cache line, you might + * consider padding the mutex to force it to live in a cache line by + * itself. No, you aren't guaranteed that cache lines are 32 bytes. Some + * embedded processors use 16-byte cache lines, while some 64-bit + * processors use 128-bit cache lines. But assuming a 32-byte cache line + * won't get you into trouble for now. + * + * If mutex locking is a bottleneck, then you can speed it up by adding a + * regular LWZ load before the LWARX load, so that you can test for the + * common case of a locked mutex without wasting cycles making a reservation. + * + * 'set' mutexes have the value 1, like on Intel; the returned value from + * MUTEX_SET() is 1 if the mutex previously had its low bit clear, 0 otherwise. + * + * Mutexes on Mac OS X work the same way as the standard PowerPC version, but + * the assembler syntax is subtly different -- the standard PowerPC version + * assembles but doesn't work correctly. This version makes (unnecessary?) + * use of a stupid linker trick: __db_mutex_tas_dummy is never called, but the + * ___db_mutex_set label is used as a function name. + */ +#ifdef HAVE_MUTEX_PPC_APPLE_GCC_ASSEMBLY +extern int __db_mutex_set __P((volatile tsl_t *)); +void +__db_mutex_tas_dummy() +{ + __asm__ __volatile__(" \n\ + .globl ___db_mutex_set \n\ +___db_mutex_set: \n\ + lwarx r5,0,r3 \n\ + cmpwi r5,0 \n\ + bne fail \n\ + addi r5,r5,1 \n\ + stwcx. r5,0,r3 \n\ + beq success \n\ +fail: \n\ + li r3,0 \n\ + blr \n\ +success: \n\ + li r3,1 \n\ + blr"); +} +#define MUTEX_SET(tsl) __db_mutex_set(tsl) +#endif +#ifdef HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY +#define MUTEX_SET(tsl) ({ \ + int __one = 1; \ + int __r; \ + tsl_t *__l = (tsl); \ + asm volatile (" \ +0: \ + lwarx %0,0,%1; \ + cmpwi %0,0; \ + bne 1f; \ + stwcx. %2,0,%1; \ + bne- 0b; \ +1:" \ + : "=&r" (__r) \ + : "r" (__l), "r" (__one)); \ + !(__r & 1); \ +}) +#endif +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * S/390 32-bit assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_S390_GCC_ASSEMBLY +typedef int tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * For gcc/S390, 0 is clear, 1 is set. + */ +static inline int +MUTEX_SET(tsl_t *tsl) { \ + register tsl_t *__l = (tsl); \ + int __r; \ + asm volatile( \ + " la 1,%1\n" \ + " lhi 0,1\n" \ + " l %0,%1\n" \ + "0: cs %0,0,0(1)\n" \ + " jl 0b" \ + : "=&d" (__r), "+m" (*__l) \ + : : "0", "1", "cc"); \ + return !__r; \ +} + +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * SCO/cc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY +typedef unsigned char tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * UnixWare has threads in libthread, but OpenServer doesn't (yet). + * + * For cc/x86, 0 is clear, 1 is set. + */ + +#if defined(__USLC__) +asm int +_tsl_set(void *tsl) +{ +%mem tsl + movl tsl, %ecx + movl $1, %eax + lock + xchgb (%ecx),%al + xorl $1,%eax +} +#endif + +#define MUTEX_SET(tsl) _tsl_set(tsl) +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * Sparc/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_SPARC_GCC_ASSEMBLY +typedef unsigned char tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * + * The ldstub instruction takes the location specified by its first argument + * (a register containing a memory address) and loads its contents into its + * second argument (a register) and atomically sets the contents the location + * specified by its first argument to a byte of 1s. (The value in the second + * argument is never read, but only overwritten.) + * + * The stbar is needed for v8, and is implemented as membar #sync on v9, + * so is functional there as well. For v7, stbar may generate an illegal + * instruction and we have no way to tell what we're running on. Some + * operating systems notice and skip this instruction in the fault handler. + * + * For gcc/sparc, 0 is clear, 1 is set. + */ +#define MUTEX_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + register tsl_t __r; \ + __asm__ volatile \ + ("ldstub [%1],%0; stbar" \ + : "=r"( __r) : "r" (__l)); \ + !__r; \ +}) + +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/********************************************************************* + * UTS/cc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_UTS_CC_ASSEMBLY +typedef int tsl_t; + +#define MUTEX_ALIGN sizeof(int) +#ifdef LOAD_ACTUAL_MUTEX_CODE +#define MUTEX_INIT(x) 0 +#define MUTEX_SET(x) (!uts_lock(x, 1)) +#define MUTEX_UNSET(x) (*(x) = 0) +#endif +#endif + +/********************************************************************* + * x86/gcc assembly. + *********************************************************************/ +#ifdef HAVE_MUTEX_X86_GCC_ASSEMBLY +typedef unsigned char tsl_t; + +#ifdef LOAD_ACTUAL_MUTEX_CODE +/* + * For gcc/x86, 0 is clear, 1 is set. + */ +#define MUTEX_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + int __r; \ + asm volatile("movl $1,%%eax; lock; xchgb %1,%%al; xorl $1,%%eax"\ + : "=&a" (__r), "=m" (*__l) \ + : "1" (*__l) \ + ); \ + __r & 1; \ +}) + +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) +#endif +#endif + +/* + * Mutex alignment defaults to one byte. + * + * !!! + * Various systems require different alignments for mutexes (the worst we've + * seen so far is 16-bytes on some HP architectures). Malloc(3) is assumed + * to return reasonable alignment, all other mutex users must ensure proper + * alignment locally. + */ +#ifndef MUTEX_ALIGN +#define MUTEX_ALIGN 1 +#endif + +/* + * Mutex destruction defaults to a no-op. + */ +#ifdef LOAD_ACTUAL_MUTEX_CODE +#ifndef MUTEX_DESTROY +#define MUTEX_DESTROY(x) +#endif +#endif + +/* + * !!! + * These defines are separated into the u_int8_t flags stored in the + * mutex below, and the 32 bit flags passed to __db_mutex_setup. + * But they must co-exist and not overlap. Flags to __db_mutex_setup are: + * + * MUTEX_ALLOC - Use when the mutex to initialize needs to be allocated. + * The 'ptr' arg to __db_mutex_setup should be a DB_MUTEX ** whenever + * you use this flag. If this flag is not set, the 'ptr' arg is + * a DB_MUTEX *. + * MUTEX_NO_RECORD - Explicitly do not record the mutex in the region. + * Otherwise the mutex will be recorded by default. If you set + * this you need to understand why you don't need it recorded. The + * *only* ones not recorded are those that are part of region structures + * that only get destroyed when the regions are destroyed. + * MUTEX_NO_RLOCK - Explicitly do not lock the given region otherwise + * the region will be locked by default. + * MUTEX_SELF_BLOCK - Set if self blocking mutex. + * MUTEX_THREAD - Set if mutex is a thread-only mutex. + */ +#define MUTEX_IGNORE 0x001 /* Ignore, no lock required. */ +#define MUTEX_INITED 0x002 /* Mutex is successfully initialized */ +#define MUTEX_MPOOL 0x004 /* Allocated from mpool. */ +#define MUTEX_SELF_BLOCK 0x008 /* Must block self. */ +/* Flags only, may be larger than 0xff. */ +#define MUTEX_ALLOC 0x00000100 /* Allocate and init a mutex */ +#define MUTEX_NO_RECORD 0x00000200 /* Do not record lock */ +#define MUTEX_NO_RLOCK 0x00000400 /* Do not acquire region lock */ +#define MUTEX_THREAD 0x00000800 /* Thread-only mutex. */ + +/* Mutex. */ +struct __mutex_t { +#ifdef HAVE_MUTEX_THREADS +#ifdef MUTEX_FIELDS + MUTEX_FIELDS +#else + tsl_t tas; /* Test and set. */ +#endif + u_int32_t spins; /* Spins before block. */ + u_int32_t locked; /* !0 if locked. */ +#else + u_int32_t off; /* Byte offset to lock. */ + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif + u_int32_t mutex_set_wait; /* Granted after wait. */ + u_int32_t mutex_set_nowait; /* Granted without waiting. */ + u_int32_t mutex_set_spin; /* Granted without spinning. */ + u_int32_t mutex_set_spins; /* Total number of spins. */ +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES + roff_t reg_off; /* Shared lock info offset. */ +#endif + + u_int8_t flags; /* MUTEX_XXX */ +}; + +/* Redirect calls to the correct functions. */ +#ifdef HAVE_MUTEX_THREADS +#if defined(HAVE_MUTEX_PTHREADS) || \ + defined(HAVE_MUTEX_SOLARIS_LWP) || \ + defined(HAVE_MUTEX_UI_THREADS) +#define __db_mutex_init_int(a, b, c, d) __db_pthread_mutex_init(a, b, d) +#define __db_mutex_lock(a, b) __db_pthread_mutex_lock(a, b) +#define __db_mutex_unlock(a, b) __db_pthread_mutex_unlock(a, b) +#define __db_mutex_destroy(a) __db_pthread_mutex_destroy(a) +#elif defined(HAVE_MUTEX_WIN32) +#define __db_mutex_init_int(a, b, c, d) __db_win32_mutex_init(a, b, d) +#define __db_mutex_lock(a, b) __db_win32_mutex_lock(a, b) +#define __db_mutex_unlock(a, b) __db_win32_mutex_unlock(a, b) +#define __db_mutex_destroy(a) __db_win32_mutex_destroy(a) +#else +#define __db_mutex_init_int(a, b, c, d) __db_tas_mutex_init(a, b, d) +#define __db_mutex_lock(a, b) __db_tas_mutex_lock(a, b) +#define __db_mutex_unlock(a, b) __db_tas_mutex_unlock(a, b) +#define __db_mutex_destroy(a) __db_tas_mutex_destroy(a) +#endif +#else +#define __db_mutex_init_int(a, b, c, d) __db_fcntl_mutex_init(a, b, c) +#define __db_mutex_lock(a, b) __db_fcntl_mutex_lock(a, b) +#define __db_mutex_unlock(a, b) __db_fcntl_mutex_unlock(a, b) +#define __db_mutex_destroy(a) __db_fcntl_mutex_destroy(a) +#endif + +/* Redirect system resource calls to correct functions */ +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES +#define __db_maintinit(a, b, c) __db_shreg_maintinit(a, b, c) +#define __db_shlocks_clear(a, b, c) __db_shreg_locks_clear(a, b, c) +#define __db_shlocks_destroy(a, b) __db_shreg_locks_destroy(a, b) +#define __db_mutex_init(a, b, c, d, e, f) \ + __db_shreg_mutex_init(a, b, c, d, e, f) +#else +#define __db_maintinit(a, b, c) +#define __db_shlocks_clear(a, b, c) +#define __db_shlocks_destroy(a, b) +#define __db_mutex_init(a, b, c, d, e, f) __db_mutex_init_int(a, b, c, d) +#endif + +/* + * Lock/unlock a mutex. If the mutex was marked as uninteresting, the thread + * of control can proceed without it. + * + * If the lock is for threads-only, then it was optionally not allocated and + * file handles aren't necessary, as threaded applications aren't supported by + * fcntl(2) locking. + */ +#ifdef DIAGNOSTIC + /* + * XXX + * We want to switch threads as often as possible. Yield every time + * we get a mutex to ensure contention. + */ +#define MUTEX_LOCK(dbenv, mp) \ + if (!F_ISSET((mp), MUTEX_IGNORE)) \ + DB_ASSERT(__db_mutex_lock(dbenv, mp) == 0); \ + if (F_ISSET(dbenv, DB_ENV_YIELDCPU)) \ + __os_yield(NULL, 1); +#else +#define MUTEX_LOCK(dbenv, mp) \ + if (!F_ISSET((mp), MUTEX_IGNORE)) \ + (void)__db_mutex_lock(dbenv, mp); +#endif +#define MUTEX_UNLOCK(dbenv, mp) \ + if (!F_ISSET((mp), MUTEX_IGNORE)) \ + (void)__db_mutex_unlock(dbenv, mp); +#define MUTEX_THREAD_LOCK(dbenv, mp) \ + if (mp != NULL) \ + MUTEX_LOCK(dbenv, mp) +#define MUTEX_THREAD_UNLOCK(dbenv, mp) \ + if (mp != NULL) \ + MUTEX_UNLOCK(dbenv, mp) + +/* + * We use a single file descriptor for fcntl(2) locking, and (generally) the + * object's offset in a shared region as the byte that we're locking. So, + * there's a (remote) possibility that two objects might have the same offsets + * such that the locks could conflict, resulting in deadlock. To avoid this + * possibility, we offset the region offset by a small integer value, using a + * different offset for each subsystem's locks. Since all region objects are + * suitably aligned, the offset guarantees that we don't collide with another + * region's objects. + */ +#define DB_FCNTL_OFF_GEN 0 /* Everything else. */ +#define DB_FCNTL_OFF_LOCK 1 /* Lock subsystem offset. */ +#define DB_FCNTL_OFF_MPOOL 2 /* Mpool subsystem offset. */ + +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES +/* + * When the underlying mutexes require library (most likely heap) or system + * resources, we have to clean up when we discard mutexes (for the library + * resources) and both when discarding mutexes and after application failure + * (for the mutexes requiring system resources). This violates the rule that + * we never look at a shared region after application failure, but we've no + * other choice. In those cases, the #define HAVE_MUTEX_SYSTEM_RESOURCES is + * set. + * + * To support mutex release after application failure, allocate thread-handle + * mutexes in shared memory instead of in the heap. The number of slots we + * allocate for this purpose isn't configurable, but this tends to be an issue + * only on embedded systems where we don't expect large server applications. + */ +#define DB_MAX_HANDLES 100 /* Mutex slots for handles. */ +#endif +#endif /* !_DB_MUTEX_H_ */ diff --git a/db/dbinc/os.h b/db/dbinc/os.h new file mode 100644 index 000000000..aabf98ea3 --- /dev/null +++ b/db/dbinc/os.h @@ -0,0 +1,54 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: os.h,v 11.14 2002/03/27 04:34:55 bostic Exp + */ + +#ifndef _DB_OS_H_ +#define _DB_OS_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* DB filehandle. */ +struct __fh_t { +#if defined(DB_WIN32) + HANDLE handle; /* Windows/32 file handle. */ +#endif + int fd; /* POSIX file descriptor. */ + char *name; /* File name. */ + + u_int32_t log_size; /* XXX: Log file size. */ + u_int32_t pagesize; /* XXX: Page size. */ + +#define DB_FH_NOSYNC 0x01 /* Handle doesn't need to be sync'd. */ +#define DB_FH_UNLINK 0x02 /* Unlink on close */ +#define DB_FH_VALID 0x04 /* Handle is valid. */ + u_int8_t flags; +}; + +/* + * We group certain seek/write calls into a single function so that we + * can use pread(2)/pwrite(2) where they're available. + */ +#define DB_IO_READ 1 +#define DB_IO_WRITE 2 +typedef struct __io_t { + DB_FH *fhp; /* I/O file handle. */ + DB_MUTEX *mutexp; /* Mutex to lock. */ + size_t pagesize; /* Page size. */ + db_pgno_t pgno; /* Page number. */ + u_int8_t *buf; /* Buffer. */ + size_t bytes; /* Bytes read/written. */ +} DB_IO; + +#if defined(__cplusplus) +} +#endif + +#include "dbinc_auto/os_ext.h" +#endif /* !_DB_OS_H_ */ diff --git a/db/dbinc/qam.h b/db/dbinc/qam.h new file mode 100644 index 000000000..bbd1cf971 --- /dev/null +++ b/db/dbinc/qam.h @@ -0,0 +1,156 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + * + * Id: qam.h,v 11.38 2002/08/06 06:11:21 bostic Exp + */ + +#ifndef _DB_QAM_H_ +#define _DB_QAM_H_ + +/* + * QAM data elements: a status field and the data. + */ +typedef struct _qamdata { + u_int8_t flags; /* 00: delete bit. */ +#define QAM_VALID 0x01 +#define QAM_SET 0x02 + u_int8_t data[1]; /* Record. */ +} QAMDATA; + +struct __queue; typedef struct __queue QUEUE; +struct __qcursor; typedef struct __qcursor QUEUE_CURSOR; + +struct __qcursor { + /* struct __dbc_internal */ + __DBC_INTERNAL + + /* Queue private part */ + + /* Per-thread information: queue private. */ + db_recno_t recno; /* Current record number. */ + + u_int32_t flags; +}; + +typedef struct __mpfarray { + u_int32_t n_extent; /* Number of extents in table. */ + u_int32_t low_extent; /* First extent open. */ + u_int32_t hi_extent; /* Last extent open. */ + struct __qmpf { + int pinref; + DB_MPOOLFILE *mpf; + } *mpfarray; /* Array of open extents. */ +} MPFARRAY; + +/* + * The in-memory, per-tree queue data structure. + */ +struct __queue { + db_pgno_t q_meta; /* Database meta-data page. */ + db_pgno_t q_root; /* Database root page. */ + + int re_pad; /* Fixed-length padding byte. */ + u_int32_t re_len; /* Length for fixed-length records. */ + u_int32_t rec_page; /* records per page */ + u_int32_t page_ext; /* Pages per extent */ + MPFARRAY array1, array2; /* File arrays. */ + + /* Extent file configuration: */ + DBT pgcookie; /* Initialized pgcookie. */ + DB_PGINFO pginfo; /* Initialized pginfo struct. */ + + char *path; /* Space allocated to file pathname. */ + char *name; /* The name of the file. */ + char *dir; /* The dir of the file. */ + int mode; /* Mode to open extents. */ +}; + +/* Format for queue extent names. */ +#define QUEUE_EXTENT "%s%c__dbq.%s.%d" + +typedef struct __qam_filelist { + DB_MPOOLFILE *mpf; + u_int32_t id; +} QUEUE_FILELIST; + +/* + * Caculate the page number of a recno + * + * Number of records per page = + * Divide the available space on the page by the record len + header. + * + * Page number for record = + * divide the physical record number by the records per page + * add the root page number + * For now the root page will always be 1, but we might want to change + * in the future (e.g. multiple fixed len queues per file). + * + * Index of record on page = + * physical record number, less the logical pno times records/page + */ +#define CALC_QAM_RECNO_PER_PAGE(dbp) \ + (((dbp)->pgsize - QPAGE_SZ(dbp)) / \ + ALIGN(((QUEUE *)(dbp)->q_internal)->re_len + \ + sizeof(QAMDATA) - SSZA(QAMDATA, data), sizeof(u_int32_t))) + +#define QAM_RECNO_PER_PAGE(dbp) (((QUEUE*)(dbp)->q_internal)->rec_page) + +#define QAM_RECNO_PAGE(dbp, recno) \ + (((QUEUE *)(dbp)->q_internal)->q_root \ + + (((recno) - 1) / QAM_RECNO_PER_PAGE(dbp))) + +#define QAM_RECNO_INDEX(dbp, pgno, recno) \ + (((recno) - 1) - (QAM_RECNO_PER_PAGE(dbp) \ + * (pgno - ((QUEUE *)(dbp)->q_internal)->q_root))) + +#define QAM_GET_RECORD(dbp, page, index) \ + ((QAMDATA *)((u_int8_t *)(page) + \ + QPAGE_SZ(dbp) + (ALIGN(sizeof(QAMDATA) - SSZA(QAMDATA, data) + \ + ((QUEUE *)(dbp)->q_internal)->re_len, sizeof(u_int32_t)) * index))) + +#define QAM_AFTER_CURRENT(meta, recno) \ + ((recno) > (meta)->cur_recno && \ + ((meta)->first_recno <= (meta)->cur_recno || (recno) < (meta)->first_recno)) + +#define QAM_BEFORE_FIRST(meta, recno) \ + ((recno) < (meta)->first_recno && \ + ((meta->first_recno <= (meta)->cur_recno || (recno) > (meta)->cur_recno))) + +#define QAM_NOT_VALID(meta, recno) \ + (recno == RECNO_OOB || \ + QAM_BEFORE_FIRST(meta, recno) || QAM_AFTER_CURRENT(meta, recno)) + +/* + * Log opcodes for the mvptr routine. + */ +#define QAM_SETFIRST 0x01 +#define QAM_SETCUR 0x02 +#define QAM_TRUNCATE 0x04 + +/* + * Parameter to __qam_position. + */ +typedef enum { + QAM_READ, + QAM_WRITE, + QAM_CONSUME +} qam_position_mode; + +typedef enum { + QAM_PROBE_GET, + QAM_PROBE_PUT, + QAM_PROBE_MPF +} qam_probe_mode; + +#define __qam_fget(dbp, pgnoaddr, flags, addrp) \ + __qam_fprobe(dbp, *pgnoaddr, addrp, QAM_PROBE_GET, flags) + +#define __qam_fput(dbp, pageno, addrp, flags) \ + __qam_fprobe(dbp, pageno, addrp, QAM_PROBE_PUT, flags) + +#include "dbinc_auto/qam_auto.h" +#include "dbinc_auto/qam_ext.h" +#endif /* !_DB_QAM_H_ */ diff --git a/db/dbinc/queue.h b/db/dbinc/queue.h new file mode 100644 index 000000000..8d4a771ad --- /dev/null +++ b/db/dbinc/queue.h @@ -0,0 +1,319 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +/* + * XXX + * We #undef the queue macros because there are incompatible versions of this + * file and these macros on various systems. What makes the problem worse is + * they are included and/or defined by system include files which we may have + * already loaded into Berkeley DB before getting here. For example, FreeBSD's + * <rpc/rpc.h> includes its system <sys/queue.h>, and VxWorks UnixLib.h defines + * several of the LIST_XXX macros. Make sure we use ours. + */ +#undef LIST_HEAD +#undef LIST_ENTRY +#undef LIST_FIRST +#undef LIST_NEXT +#undef LIST_INIT +#undef LIST_INSERT_AFTER +#undef LIST_INSERT_BEFORE +#undef LIST_INSERT_HEAD +#undef LIST_REMOVE +#undef TAILQ_HEAD +#undef TAILQ_ENTRY +#undef TAILQ_FIRST +#undef TAILQ_NEXT +#undef TAILQ_INIT +#undef TAILQ_INSERT_HEAD +#undef TAILQ_INSERT_TAIL +#undef TAILQ_INSERT_AFTER +#undef TAILQ_INSERT_BEFORE +#undef TAILQ_REMOVE +#undef CIRCLEQ_HEAD +#undef CIRCLEQ_ENTRY +#undef CIRCLEQ_FIRST +#undef CIRCLEQ_LAST +#undef CIRCLEQ_NEXT +#undef CIRCLEQ_PREV +#undef CIRCLEQ_INIT +#undef CIRCLEQ_INSERT_AFTER +#undef CIRCLEQ_INSERT_BEFORE +#undef CIRCLEQ_INSERT_HEAD +#undef CIRCLEQ_INSERT_TAIL +#undef CIRCLEQ_REMOVE + +/* + * This file defines three types of data structures: lists, tail queues, + * and circular queues. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may only be traversed in the forward direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +/* + * List functions. + */ +#define LIST_INIT(head) { \ + (head)->lh_first = NULL; \ +} + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (0) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (0) + +/* + * Tail queue definitions. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (0) + +/* + * This macro is used to fixup the queue after moving the head. + */ +#define TAILQ_REINSERT_HEAD(head, elm, field) do { \ + DB_ASSERT((head)->tqh_first == (elm)); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (0) + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (0) + +#if defined(__cplusplus) +} +#endif diff --git a/db/dbinc/region.h b/db/dbinc/region.h new file mode 100644 index 000000000..f588cc315 --- /dev/null +++ b/db/dbinc/region.h @@ -0,0 +1,304 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998-2002 + * Sleepycat Software. All rights reserved. + * + * Id: region.h,v 11.33 2002/08/06 06:11:22 bostic Exp + */ + +#ifndef _DB_REGION_H_ +#define _DB_REGION_H_ + +/* + * The DB environment consists of some number of "regions", which are described + * by the following four structures: + * + * REGENV -- shared information about the environment + * REGENV_REF -- file describing system memory version of REGENV + * REGION -- shared information about a single region + * REGINFO -- per-process information about a REGION + * + * There are three types of memory that hold regions: + * per-process heap (malloc) + * file mapped into memory (mmap, MapViewOfFile) + * system memory (shmget, CreateFileMapping) + * + * If the regions are private to a process, they're in malloc. If they're + * public, they're in file mapped memory, or, optionally, in system memory. + * Regions in the filesystem are named "__db.001", "__db.002" and so on. If + * we're not using a private environment allocated using malloc(3), the file + * "__db.001" will always exist, as we use it to synchronize on the regions, + * whether they exist in file mapped memory or system memory. + * + * The file "__db.001" contains a REGENV structure and a linked list of some + * number of REGION structures. Each of the REGION structures describes and + * locks one of the underlying shared regions used by DB. + * + * __db.001 + * +---------+ + * |REGENV | + * +---------+ +----------+ + * |REGION |-> | __db.002 | + * | | +----------+ + * +---------+ +----------+ + * |REGION |-> | __db.003 | + * | | +----------+ + * +---------+ +----------+ + * |REGION |-> | __db.004 | + * | | +----------+ + * +---------+ + * + * The only tricky part about manipulating the regions is correctly creating + * or joining the REGENV file, i.e., __db.001. We have to be absolutely sure + * that only one process creates it, and that everyone else joins it without + * seeing inconsistent data. Once that region is created, we can use normal + * shared locking procedures to do mutal exclusion for all other regions. + * + * One of the REGION structures in the main environment region describes the + * environment region itself. + * + * To lock a region, locate the REGION structure that describes it and acquire + * the region's mutex. There is one exception to this rule -- the lock for the + * environment region itself is in the REGENV structure, and not in the REGION + * that describes the environment region. That's so that we can acquire a lock + * without walking linked lists that could potentially change underneath us. + * The REGION will not be moved or removed during the life of the region, and + * so long-lived references to it can be held by the process. + * + * All requests to create or join a region return a REGINFO structure, which + * is held by the caller and used to open and subsequently close the reference + * to the region. The REGINFO structure contains the per-process information + * that we need to access the region. + * + * The one remaining complication. If the regions (including the environment + * region) live in system memory, and the system memory isn't "named" somehow + * in the filesystem name space, we need some way of finding it. Do this by + * by writing the REGENV_REF structure into the "__db.001" file. When we find + * a __db.001 file that is too small to be a real, on-disk environment, we use + * the information it contains to redirect to the real "__db.001" file/memory. + * This currently only happens when the REGENV file is in shared system memory. + * + * Although DB does not currently grow regions when they run out of memory, it + * would be possible to do so. To grow a region, allocate a new region of the + * appropriate size, then copy the old region over it and insert the additional + * space into the already existing shalloc arena. Callers may have to fix up + * local references, but that should be easy to do. This failed in historic + * versions of DB because the region lock lived in the mapped memory, and when + * it was unmapped and remapped (or copied), threads could lose track of it. + * Once we moved that lock into a region that is never unmapped, growing should + * work. That all said, current versions of DB don't implement region grow + * because some systems don't support mutex copying, e.g., from OSF1 V4.0: + * + * The address of an msemaphore structure may be significant. If the + * msemaphore structure contains any value copied from an msemaphore + * structure at a different address, the result is undefined. + */ + +#if defined(__cplusplus) +extern "C" { +#endif + +#define DB_REGION_FMT "__db.%03d" /* Region file name format. */ +#define DB_REGION_NAME_NUM 5 /* First digit offset in file names. */ +#define DB_REGION_NAME_LENGTH 8 /* Length of file names. */ + +#define DB_REGION_ENV "__db.001" /* Primary environment name. */ + +#define INVALID_REGION_ID 0 /* Out-of-band region ID. */ +#define REGION_ID_ENV 1 /* Primary environment ID. */ + +typedef enum { + INVALID_REGION_TYPE=0, /* Region type. */ + REGION_TYPE_ENV, + REGION_TYPE_LOCK, + REGION_TYPE_LOG, + REGION_TYPE_MPOOL, + REGION_TYPE_MUTEX, + REGION_TYPE_TXN } reg_type; + +#define INVALID_REGION_SEGID -1 /* Segment IDs are either shmget(2) or + * Win16 segment identifiers. They are + * both stored in a "long", and we need + * an out-of-band value. + */ +/* + * Nothing can live at region offset 0, because, in all cases, that's where + * we store *something*. Lots of code needs an out-of-band value for region + * offsets, so we use 0. + */ +#define INVALID_ROFF 0 + +/* Reference describing system memory version of REGENV. */ +typedef struct __db_reg_env_ref { + roff_t size; /* Region size. */ + long segid; /* UNIX shmget ID, VxWorks ID. */ +} REGENV_REF; + +/* Per-environment region information. */ +typedef struct __db_reg_env { + /* + * !!! + * The mutex must be the first entry in the structure to guarantee + * correct alignment. + */ + DB_MUTEX mutex; /* Environment mutex. */ + + /* + * !!! + * Note, the magic and panic fields are NOT protected by any mutex, + * and for this reason cannot be anything more complicated than a + * zero/non-zero value. + * + * !!! + * The valid region magic number must appear at the same byte offset + * in both the environment and each shared region, as Windows/95 uses + * it to determine if the memory has been zeroed since it was last used. + */ + u_int32_t magic; /* Valid region magic number. */ + + int envpanic; /* Environment is dead. */ + + int majver; /* Major DB version number. */ + int minver; /* Minor DB version number. */ + int patch; /* Patch DB version number. */ + + u_int32_t init_flags; /* Flags the env was initialized with.*/ + roff_t cipher_off; /* Offset of cipher area */ + + /* List of regions. */ + SH_LIST_HEAD(__db_regionh) regionq; + + u_int32_t refcnt; /* References to the environment. */ + + roff_t rep_off; /* Offset of the replication area. */ + + size_t pad; /* Guarantee that following memory is + * size_t aligned. This is necessary + * because we're going to store the + * allocation region information there. + */ +} REGENV; + +/* Per-region shared region information. */ +typedef struct __db_region { + /* + * !!! + * The mutex must be the first entry in the structure to guarantee + * correct alignment. + */ + DB_MUTEX mutex; /* Region mutex. */ + + /* + * !!! + * The valid region magic number must appear at the same byte offset + * in both the environment and each shared region, as Windows/95 uses + * it to determine if the memory has been zeroed since it was last used. + */ + u_int32_t magic; + + SH_LIST_ENTRY q; /* Linked list of REGIONs. */ + + reg_type type; /* Region type. */ + u_int32_t id; /* Region id. */ + + roff_t size; /* Region size in bytes. */ + + roff_t primary; /* Primary data structure offset. */ + + long segid; /* UNIX shmget(2), Win16 segment ID. */ +} REGION; + +/* + * Per-process/per-attachment information about a single region. + */ +struct __db_reginfo_t { /* __db_r_attach IN parameters. */ + reg_type type; /* Region type. */ + u_int32_t id; /* Region id. */ + int mode; /* File creation mode. */ + + /* __db_r_attach OUT parameters. */ + REGION *rp; /* Shared region. */ + + char *name; /* Region file name. */ + + void *addr; /* Region allocation address. */ + void *primary; /* Primary data structure address. */ + + void *wnt_handle; /* Win/NT HANDLE. */ + +#define REGION_CREATE 0x01 /* Caller created region. */ +#define REGION_CREATE_OK 0x02 /* Caller willing to create region. */ +#define REGION_JOIN_OK 0x04 /* Caller is looking for a match. */ + u_int32_t flags; +}; + +/* + * Mutex maintenance information each subsystem region must keep track + * of to manage resources adequately. + */ +typedef struct __db_regmaint_stat_t { + u_int32_t st_hint_hit; + u_int32_t st_hint_miss; + u_int32_t st_records; + u_int32_t st_clears; + u_int32_t st_destroys; + u_int32_t st_max_locks; +} REGMAINT_STAT; + +typedef struct __db_regmaint_t { + u_int32_t reglocks; /* Maximum # of mutexes we track. */ + u_int32_t regmutex_hint; /* Hint for next slot */ + REGMAINT_STAT stat; /* Stats */ + roff_t regmutexes[1]; /* Region mutexes in use. */ +} REGMAINT; + +/* + * R_ADDR Return a per-process address for a shared region offset. + * R_OFFSET Return a shared region offset for a per-process address. + * + * !!! + * R_OFFSET should really be returning a ptrdiff_t, but that's not yet + * portable. We use u_int32_t, which restricts regions to 4Gb in size. + */ +#define R_ADDR(base, offset) \ + ((void *)((u_int8_t *)((base)->addr) + offset)) +#define R_OFFSET(base, p) \ + ((u_int32_t)((u_int8_t *)(p) - (u_int8_t *)(base)->addr)) + +/* + * R_LOCK Lock/unlock a region. + * R_UNLOCK + */ +#define R_LOCK(dbenv, reginfo) \ + MUTEX_LOCK(dbenv, &(reginfo)->rp->mutex) +#define R_UNLOCK(dbenv, reginfo) \ + MUTEX_UNLOCK(dbenv, &(reginfo)->rp->mutex) + +/* PANIC_CHECK: Check to see if the DB environment is dead. */ +#define PANIC_CHECK(dbenv) \ + if (!F_ISSET((dbenv), DB_ENV_NOPANIC) && \ + (dbenv)->reginfo != NULL && ((REGENV *) \ + ((REGINFO *)(dbenv)->reginfo)->primary)->envpanic != 0) \ + return (__db_panic_msg(dbenv)); + +#define PANIC_SET(dbenv, onoff) \ + ((REGENV *)((REGINFO *)(dbenv)->reginfo)->primary)->envpanic = (onoff); + +/* + * All regions are created on 8K boundaries out of sheer paranoia, so we + * don't make some underlying VM unhappy. Make sure we don't overflow or + * underflow. + */ +#define OS_VMPAGESIZE (8 * 1024) +#define OS_VMROUNDOFF(i) { \ + if ((i) < \ + (UINT32_T_MAX - OS_VMPAGESIZE) + 1 || (i) < OS_VMPAGESIZE) \ + (i) += OS_VMPAGESIZE - 1; \ + (i) -= (i) % OS_VMPAGESIZE; \ +} + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_REGION_H_ */ diff --git a/db/dbinc/rep.h b/db/dbinc/rep.h new file mode 100644 index 000000000..1e315494c --- /dev/null +++ b/db/dbinc/rep.h @@ -0,0 +1,184 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#ifndef _REP_H_ +#define _REP_H_ + +#define REP_ALIVE 1 /* I am alive message. */ +#define REP_ALIVE_REQ 2 /* Request for alive messages. */ +#define REP_ALL_REQ 3 /* Request all log records greater than LSN. */ +#define REP_ELECT 4 /* Indicates that all listeners should */ + /* begin master election */ +#define REP_FILE 6 /* Page of a database file. */ +#define REP_FILE_REQ 7 /* Request for a database file. */ +#define REP_LOG 8 /* Log record. */ +#define REP_LOG_MORE 9 /* There are more log records to request. */ +#define REP_LOG_REQ 10 /* Request for a log record. */ +#define REP_MASTER_REQ 11 /* Who is the master */ +#define REP_NEWCLIENT 12 /* Announces the presence of a new client. */ +#define REP_NEWFILE 13 /* Announce a log file change. */ +#define REP_NEWMASTER 14 /* Announces who the master is. */ +#define REP_NEWSITE 15 /* Announces that a site has heard from a new + * site; like NEWCLIENT, but indirect. A + * NEWCLIENT message comes directly from the new + * client while a NEWSITE comes indirectly from + * someone who heard about a NEWSITE. + */ +#define REP_PAGE 16 /* Database page. */ +#define REP_PAGE_REQ 17 /* Request for a database page. */ +#define REP_PLIST 18 /* Database page list. */ +#define REP_PLIST_REQ 19 /* Request for a page list. */ +#define REP_VERIFY 20 /* A log record for verification. */ +#define REP_VERIFY_FAIL 21 /* The client is outdated. */ +#define REP_VERIFY_REQ 22 /* Request for a log record to verify. */ +#define REP_VOTE1 23 /* Send out your information for an election. */ +#define REP_VOTE2 24 /* Send a "you are master" vote. */ + +/* Used to consistently designate which messages ought to be received where. */ +#define MASTER_ONLY(dbenv) \ + if (!F_ISSET(dbenv, DB_ENV_REP_MASTER)) return (EINVAL) + +#define CLIENT_ONLY(dbenv) \ + if (!F_ISSET(dbenv, DB_ENV_REP_CLIENT)) return (EINVAL) + +#define ANYSITE(dbenv) + +/* Shared replication structure. */ + +typedef struct __rep { + /* + * Due to alignment constraints on some architectures (e.g. HP-UX), + * DB_MUTEXes must be the first element of shalloced structures, + * and as a corollary there can be only one per structure. Thus, + * db_mutex_off points to a mutex in a separately-allocated chunk. + */ + DB_MUTEX mutex; /* Region lock. */ + roff_t db_mutex_off; /* Client database mutex. */ + u_int32_t tally_off; /* Offset of the tally region. */ + int eid; /* Environment id. */ + int master_id; /* ID of the master site. */ + u_int32_t gen; /* Replication generation number */ + int asites; /* Space allocated for sites. */ + int nsites; /* Number of sites in group. */ + int priority; /* My priority in an election. */ + u_int32_t gbytes; /* Limit on data sent in single... */ + u_int32_t bytes; /* __rep_process_message call. */ +#define DB_REP_REQUEST_GAP 4 +#define DB_REP_MAX_GAP 128 + u_int32_t request_gap; /* # of records to receive before we + * request a missing log record. */ + u_int32_t max_gap; /* Maximum number of records before + * requesting a missing log record. */ + + /* Vote tallying information. */ + int sites; /* Sites heard from. */ + int winner; /* Current winner. */ + int w_priority; /* Winner priority. */ + u_int32_t w_gen; /* Winner generation. */ + DB_LSN w_lsn; /* Winner LSN. */ + int w_tiebreaker; /* Winner tiebreaking value. */ + int votes; /* Number of votes for this site. */ + + /* Statistics. */ + DB_REP_STAT stat; + +#define REP_F_EPHASE1 0x01 /* In phase 1 of election. */ +#define REP_F_EPHASE2 0x02 /* In phase 2 of election. */ +#define REP_F_LOGSONLY 0x04 /* Log-site only; cannot be upgraded. */ +#define REP_F_MASTER 0x08 /* Master replica. */ +#define REP_F_RECOVER 0x10 +#define REP_F_UPGRADE 0x20 /* Upgradeable replica. */ +#define REP_ISCLIENT (REP_F_UPGRADE | REP_F_LOGSONLY) + u_int32_t flags; +} REP; + +#define IN_ELECTION(R) F_ISSET((R), REP_F_EPHASE1 | REP_F_EPHASE2) +#define ELECTION_DONE(R) F_CLR((R), REP_F_EPHASE1 | REP_F_EPHASE2) + +/* + * Per-process replication structure. + */ +struct __db_rep { + DB_MUTEX *mutexp; + + DB_MUTEX *db_mutexp; /* Mutex for bookkeeping database. */ + DB *rep_db; /* Bookkeeping database. */ + + REP *region; /* In memory structure. */ + int (*rep_send) /* Send function. */ + __P((DB_ENV *, + const DBT *, const DBT *, int, u_int32_t)); +}; + +/* + * Control structure for replication communication infrastructure. + * + * Note that the version information should be at the beginning of the + * structure, so that we can rearrange the rest of it while letting the + * version checks continue to work. DB_REPVERSION should be revved any time + * the rest of the structure changes. + */ +typedef struct __rep_control { +#define DB_REPVERSION 1 + u_int32_t rep_version; /* Replication version number. */ + u_int32_t log_version; /* Log version number. */ + + DB_LSN lsn; /* Log sequence number. */ + u_int32_t rectype; /* Message type. */ + u_int32_t gen; /* Generation number. */ + u_int32_t flags; /* log_put flag value. */ +} REP_CONTROL; + +/* Election vote information. */ +typedef struct __rep_vote { + int priority; /* My site's priority. */ + int nsites; /* Number of sites I've been in + * communication with. */ + int tiebreaker; /* Tie-breaking quasi-random int. */ +} REP_VOTE_INFO; + +/* + * This structure takes care of representing a transaction. + * It holds all the records, sorted by page number so that + * we can obtain locks and apply updates in a deadlock free + * order. + */ +typedef struct __lsn_page { + DB_LSN lsn; + u_int32_t fid; + DB_LOCK_ILOCK pgdesc; +#define LSN_PAGE_NOLOCK 0x0001 /* No lock necessary for log rec. */ + u_int32_t flags; +} LSN_PAGE; + +typedef struct __txn_recs { + int npages; + int nalloc; + LSN_PAGE *array; + u_int32_t txnid; + u_int32_t lockid; +} TXN_RECS; + +typedef struct __lsn_collection { + int nlsns; + int nalloc; + DB_LSN *array; +} LSN_COLLECTION; + +/* + * This is used by the page-prep routines to do the lock_vec call to + * apply the updates for a single transaction or a collection of + * transactions. + */ +typedef struct _linfo { + int n; + DB_LOCKREQ *reqs; + DBT *objs; +} linfo_t; + +#include "dbinc_auto/rep_ext.h" +#endif /* !_REP_H_ */ diff --git a/db/dbinc/shqueue.h b/db/dbinc/shqueue.h new file mode 100644 index 000000000..e0b81d537 --- /dev/null +++ b/db/dbinc/shqueue.h @@ -0,0 +1,337 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: shqueue.h,v 11.9 2002/01/11 15:52:30 bostic Exp + */ + +#ifndef _SYS_SHQUEUE_H_ +#define _SYS_SHQUEUE_H_ + +/* + * This file defines three types of data structures: lists, tail queues, and + * circular queues, similarly to the include file <sys/queue.h>. + * + * The difference is that this set of macros can be used for structures that + * reside in shared memory that may be mapped at different addresses in each + * process. In most cases, the macros for shared structures exactly mirror + * the normal macros, although the macro calls require an additional type + * parameter, only used by the HEAD and ENTRY macros of the standard macros. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * Shared list definitions. + */ +#define SH_LIST_HEAD(name) \ +struct name { \ + ssize_t slh_first; /* first element */ \ +} + +#define SH_LIST_ENTRY \ +struct { \ + ssize_t sle_next; /* relative offset next element */ \ + ssize_t sle_prev; /* relative offset of prev element */ \ +} + +/* + * Shared list functions. Since we use relative offsets for pointers, + * 0 is a valid offset. Therefore, we use -1 to indicate end of list. + * The macros ending in "P" return pointers without checking for end + * of list, the others check for end of list and evaluate to either a + * pointer or NULL. + */ + +#define SH_LIST_FIRSTP(head, type) \ + ((struct type *)(((u_int8_t *)(head)) + (head)->slh_first)) + +#define SH_LIST_FIRST(head, type) \ + ((head)->slh_first == -1 ? NULL : \ + ((struct type *)(((u_int8_t *)(head)) + (head)->slh_first))) + +#define SH_LIST_NEXTP(elm, field, type) \ + ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next)) + +#define SH_LIST_NEXT(elm, field, type) \ + ((elm)->field.sle_next == -1 ? NULL : \ + ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next))) + +#define SH_LIST_PREV(elm, field) \ + ((ssize_t *)(((u_int8_t *)(elm)) + (elm)->field.sle_prev)) + +#define SH_PTR_TO_OFF(src, dest) \ + ((ssize_t)(((u_int8_t *)(dest)) - ((u_int8_t *)(src)))) + +/* + * Take the element's next pointer and calculate what the corresponding + * Prev pointer should be -- basically it is the negation plus the offset + * of the next field in the structure. + */ +#define SH_LIST_NEXT_TO_PREV(elm, field) \ + (-(elm)->field.sle_next + SH_PTR_TO_OFF(elm, &(elm)->field.sle_next)) + +#define SH_LIST_INIT(head) (head)->slh_first = -1 + +#define SH_LIST_INSERT_AFTER(listelm, elm, field, type) do { \ + if ((listelm)->field.sle_next != -1) { \ + (elm)->field.sle_next = SH_PTR_TO_OFF(elm, \ + SH_LIST_NEXTP(listelm, field, type)); \ + SH_LIST_NEXTP(listelm, field, type)->field.sle_prev = \ + SH_LIST_NEXT_TO_PREV(elm, field); \ + } else \ + (elm)->field.sle_next = -1; \ + (listelm)->field.sle_next = SH_PTR_TO_OFF(listelm, elm); \ + (elm)->field.sle_prev = SH_LIST_NEXT_TO_PREV(listelm, field); \ +} while (0) + +#define SH_LIST_INSERT_HEAD(head, elm, field, type) do { \ + if ((head)->slh_first != -1) { \ + (elm)->field.sle_next = \ + (head)->slh_first - SH_PTR_TO_OFF(head, elm); \ + SH_LIST_FIRSTP(head, type)->field.sle_prev = \ + SH_LIST_NEXT_TO_PREV(elm, field); \ + } else \ + (elm)->field.sle_next = -1; \ + (head)->slh_first = SH_PTR_TO_OFF(head, elm); \ + (elm)->field.sle_prev = SH_PTR_TO_OFF(elm, &(head)->slh_first); \ +} while (0) + +#define SH_LIST_REMOVE(elm, field, type) do { \ + if ((elm)->field.sle_next != -1) { \ + SH_LIST_NEXTP(elm, field, type)->field.sle_prev = \ + (elm)->field.sle_prev - (elm)->field.sle_next; \ + *SH_LIST_PREV(elm, field) += (elm)->field.sle_next; \ + } else \ + *SH_LIST_PREV(elm, field) = -1; \ +} while (0) + +/* + * Shared tail queue definitions. + */ +#define SH_TAILQ_HEAD(name) \ +struct name { \ + ssize_t stqh_first; /* relative offset of first element */ \ + ssize_t stqh_last; /* relative offset of last's next */ \ +} + +#define SH_TAILQ_ENTRY \ +struct { \ + ssize_t stqe_next; /* relative offset of next element */ \ + ssize_t stqe_prev; /* relative offset of prev's next */ \ +} + +/* + * Shared tail queue functions. + */ +#define SH_TAILQ_FIRSTP(head, type) \ + ((struct type *)((u_int8_t *)(head) + (head)->stqh_first)) + +#define SH_TAILQ_FIRST(head, type) \ + ((head)->stqh_first == -1 ? NULL : SH_TAILQ_FIRSTP(head, type)) + +#define SH_TAILQ_NEXTP(elm, field, type) \ + ((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next)) + +#define SH_TAILQ_NEXT(elm, field, type) \ + ((elm)->field.stqe_next == -1 ? NULL : SH_TAILQ_NEXTP(elm, field, type)) + +#define SH_TAILQ_PREVP(elm, field) \ + ((ssize_t *)((u_int8_t *)(elm) + (elm)->field.stqe_prev)) + +#define SH_TAILQ_LAST(head) \ + ((ssize_t *)(((u_int8_t *)(head)) + (head)->stqh_last)) + +#define SH_TAILQ_NEXT_TO_PREV(elm, field) \ + (-(elm)->field.stqe_next + SH_PTR_TO_OFF(elm, &(elm)->field.stqe_next)) + +#define SH_TAILQ_INIT(head) { \ + (head)->stqh_first = -1; \ + (head)->stqh_last = SH_PTR_TO_OFF(head, &(head)->stqh_first); \ +} + +#define SH_TAILQ_INSERT_HEAD(head, elm, field, type) do { \ + if ((head)->stqh_first != -1) { \ + (elm)->field.stqe_next = \ + (head)->stqh_first - SH_PTR_TO_OFF(head, elm); \ + SH_TAILQ_FIRSTP(head, type)->field.stqe_prev = \ + SH_TAILQ_NEXT_TO_PREV(elm, field); \ + } else { \ + (elm)->field.stqe_next = -1; \ + (head)->stqh_last = \ + SH_PTR_TO_OFF(head, &(elm)->field.stqe_next); \ + } \ + (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \ + (elm)->field.stqe_prev = \ + SH_PTR_TO_OFF(elm, &(head)->stqh_first); \ +} while (0) + +#define SH_TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = -1; \ + (elm)->field.stqe_prev = \ + -SH_PTR_TO_OFF(head, elm) + (head)->stqh_last; \ + if ((head)->stqh_last == \ + SH_PTR_TO_OFF((head), &(head)->stqh_first)) \ + (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \ + else \ + *SH_TAILQ_LAST(head) = -(head)->stqh_last + \ + SH_PTR_TO_OFF((elm), &(elm)->field.stqe_next) + \ + SH_PTR_TO_OFF(head, elm); \ + (head)->stqh_last = \ + SH_PTR_TO_OFF(head, &((elm)->field.stqe_next)); \ +} while (0) + +#define SH_TAILQ_INSERT_AFTER(head, listelm, elm, field, type) do { \ + if ((listelm)->field.stqe_next != -1) { \ + (elm)->field.stqe_next = (listelm)->field.stqe_next - \ + SH_PTR_TO_OFF(listelm, elm); \ + SH_TAILQ_NEXTP(listelm, field, type)->field.stqe_prev = \ + SH_TAILQ_NEXT_TO_PREV(elm, field); \ + } else { \ + (elm)->field.stqe_next = -1; \ + (head)->stqh_last = \ + SH_PTR_TO_OFF(head, &elm->field.stqe_next); \ + } \ + (listelm)->field.stqe_next = SH_PTR_TO_OFF(listelm, elm); \ + (elm)->field.stqe_prev = SH_TAILQ_NEXT_TO_PREV(listelm, field); \ +} while (0) + +#define SH_TAILQ_REMOVE(head, elm, field, type) do { \ + if ((elm)->field.stqe_next != -1) { \ + SH_TAILQ_NEXTP(elm, field, type)->field.stqe_prev = \ + (elm)->field.stqe_prev + \ + SH_PTR_TO_OFF(SH_TAILQ_NEXTP(elm, \ + field, type), elm); \ + *SH_TAILQ_PREVP(elm, field) += elm->field.stqe_next; \ + } else { \ + (head)->stqh_last = (elm)->field.stqe_prev + \ + SH_PTR_TO_OFF(head, elm); \ + *SH_TAILQ_PREVP(elm, field) = -1; \ + } \ +} while (0) + +/* + * Shared circular queue definitions. + */ +#define SH_CIRCLEQ_HEAD(name) \ +struct name { \ + ssize_t scqh_first; /* first element */ \ + ssize_t scqh_last; /* last element */ \ +} + +#define SH_CIRCLEQ_ENTRY \ +struct { \ + ssize_t scqe_next; /* next element */ \ + ssize_t scqe_prev; /* previous element */ \ +} + +/* + * Shared circular queue functions. + */ +#define SH_CIRCLEQ_FIRSTP(head, type) \ + ((struct type *)(((u_int8_t *)(head)) + (head)->scqh_first)) + +#define SH_CIRCLEQ_FIRST(head, type) \ + ((head)->scqh_first == -1 ? \ + (void *)head : SH_CIRCLEQ_FIRSTP(head, type)) + +#define SH_CIRCLEQ_LASTP(head, type) \ + ((struct type *)(((u_int8_t *)(head)) + (head)->scqh_last)) + +#define SH_CIRCLEQ_LAST(head, type) \ + ((head)->scqh_last == -1 ? (void *)head : SH_CIRCLEQ_LASTP(head, type)) + +#define SH_CIRCLEQ_NEXTP(elm, field, type) \ + ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.scqe_next)) + +#define SH_CIRCLEQ_NEXT(head, elm, field, type) \ + ((elm)->field.scqe_next == SH_PTR_TO_OFF(elm, head) ? \ + (void *)head : SH_CIRCLEQ_NEXTP(elm, field, type)) + +#define SH_CIRCLEQ_PREVP(elm, field, type) \ + ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.scqe_prev)) + +#define SH_CIRCLEQ_PREV(head, elm, field, type) \ + ((elm)->field.scqe_prev == SH_PTR_TO_OFF(elm, head) ? \ + (void *)head : SH_CIRCLEQ_PREVP(elm, field, type)) + +#define SH_CIRCLEQ_INIT(head) { \ + (head)->scqh_first = 0; \ + (head)->scqh_last = 0; \ +} + +#define SH_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field, type) do { \ + (elm)->field.scqe_prev = SH_PTR_TO_OFF(elm, listelm); \ + (elm)->field.scqe_next = (listelm)->field.scqe_next + \ + (elm)->field.scqe_prev; \ + if (SH_CIRCLEQ_NEXTP(listelm, field, type) == (void *)head) \ + (head)->scqh_last = SH_PTR_TO_OFF(head, elm); \ + else \ + SH_CIRCLEQ_NEXTP(listelm, \ + field, type)->field.scqe_prev = \ + SH_PTR_TO_OFF(SH_CIRCLEQ_NEXTP(listelm, \ + field, type), elm); \ + (listelm)->field.scqe_next = -(elm)->field.scqe_prev; \ +} while (0) + +#define SH_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field, type) do { \ + (elm)->field.scqe_next = SH_PTR_TO_OFF(elm, listelm); \ + (elm)->field.scqe_prev = (elm)->field.scqe_next - \ + SH_CIRCLEQ_PREVP(listelm, field, type)->field.scqe_next;\ + if (SH_CIRCLEQ_PREVP(listelm, field, type) == (void *)(head)) \ + (head)->scqh_first = SH_PTR_TO_OFF(head, elm); \ + else \ + SH_CIRCLEQ_PREVP(listelm, \ + field, type)->field.scqe_next = \ + SH_PTR_TO_OFF(SH_CIRCLEQ_PREVP(listelm, \ + field, type), elm); \ + (listelm)->field.scqe_prev = -(elm)->field.scqe_next; \ +} while (0) + +#define SH_CIRCLEQ_INSERT_HEAD(head, elm, field, type) do { \ + (elm)->field.scqe_prev = SH_PTR_TO_OFF(elm, head); \ + (elm)->field.scqe_next = (head)->scqh_first + \ + (elm)->field.scqe_prev; \ + if ((head)->scqh_last == 0) \ + (head)->scqh_last = -(elm)->field.scqe_prev; \ + else \ + SH_CIRCLEQ_FIRSTP(head, type)->field.scqe_prev = \ + SH_PTR_TO_OFF(SH_CIRCLEQ_FIRSTP(head, type), elm); \ + (head)->scqh_first = -(elm)->field.scqe_prev; \ +} while (0) + +#define SH_CIRCLEQ_INSERT_TAIL(head, elm, field, type) do { \ + (elm)->field.scqe_next = SH_PTR_TO_OFF(elm, head); \ + (elm)->field.scqe_prev = (head)->scqh_last + \ + (elm)->field.scqe_next; \ + if ((head)->scqh_first == 0) \ + (head)->scqh_first = -(elm)->field.scqe_next; \ + else \ + SH_CIRCLEQ_LASTP(head, type)->field.scqe_next = \ + SH_PTR_TO_OFF(SH_CIRCLEQ_LASTP(head, type), elm); \ + (head)->scqh_last = -(elm)->field.scqe_next; \ +} while (0) + +#define SH_CIRCLEQ_REMOVE(head, elm, field, type) do { \ + if (SH_CIRCLEQ_NEXTP(elm, field, type) == (void *)(head)) \ + (head)->scqh_last += (elm)->field.scqe_prev; \ + else \ + SH_CIRCLEQ_NEXTP(elm, field, type)->field.scqe_prev += \ + (elm)->field.scqe_prev; \ + if (SH_CIRCLEQ_PREVP(elm, field, type) == (void *)(head)) \ + (head)->scqh_first += (elm)->field.scqe_next; \ + else \ + SH_CIRCLEQ_PREVP(elm, field, type)->field.scqe_next += \ + (elm)->field.scqe_next; \ +} while (0) + +#if defined(__cplusplus) +} +#endif +#endif /* !_SYS_SHQUEUE_H_ */ diff --git a/db/dbinc/tcl_db.h b/db/dbinc/tcl_db.h new file mode 100644 index 000000000..adfa94db9 --- /dev/null +++ b/db/dbinc/tcl_db.h @@ -0,0 +1,261 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + * + * Id: tcl_db.h,v 11.30 2002/08/06 06:11:22 bostic Exp + */ + +#ifndef _DB_TCL_DB_H_ +#define _DB_TCL_DB_H_ + +#define MSG_SIZE 100 /* Message size */ + +enum INFOTYPE { + I_ENV, I_DB, I_DBC, I_TXN, I_MP, I_PG, I_LOCK, I_LOGC, I_NDBM, I_MUTEX }; + +#define MAX_ID 8 /* Maximum number of sub-id's we need */ +#define DBTCL_PREP 64 /* Size of txn_recover preplist */ + +#define DBTCL_DBM 1 +#define DBTCL_NDBM 2 + +typedef struct _mutex_entry { + union { + struct { + DB_MUTEX real_m; + u_int32_t real_val; + } r; + /* + * This is here to make sure that each of the mutex structures + * are 16-byte aligned, which is required on HP architectures. + * The db_mutex_t structure might be >32 bytes itself, or the + * real_val might push it over the 32 byte boundary. The best + * we can do is use a 48 byte boundary. + */ + char c[48]; + } u; +} _MUTEX_ENTRY; + +#define m u.r.real_m +#define val u.r.real_val + +typedef struct _mutex_data { + DB_ENV *env; + REGINFO reginfo; + _MUTEX_ENTRY *marray; + size_t size; + u_int32_t n_mutex; +} _MUTEX_DATA; + +/* + * Why use a home grown package over the Tcl_Hash functions? + * + * We could have implemented the stuff below without maintaining our + * own list manipulation, efficiently hashing it with the available + * Tcl functions (Tcl_CreateHashEntry, Tcl_GetHashValue, etc). I chose + * not to do so for these reasons: + * + * We still need the information below. Using the hashing only removes + * us from needing the next/prev pointers. We still need the structure + * itself because we need more than one value associated with a widget. + * We need to keep track of parent pointers for sub-widgets (like cursors) + * so we can correctly close. We need to keep track of individual widget's + * id counters for any sub-widgets they may have. We need to be able to + * associate the name/client data outside the scope of the widget. + * + * So, is it better to use the hashing rather than + * the linear list we have now? I decided against it for the simple reason + * that to access the structure would require two calls. The first is + * Tcl_FindHashEntry(table, key) and then, once we have the entry, we'd + * have to do Tcl_GetHashValue(entry) to get the pointer of the structure. + * + * I believe the number of simultaneous DB widgets in existence at one time + * is not going to be that large (more than several dozen) such that + * linearly searching the list is not going to impact performance in a + * noticable way. Should performance be impacted due to the size of the + * info list, then perhaps it is time to revisit this decision. + */ +typedef struct dbtcl_info { + LIST_ENTRY(dbtcl_info) entries; + Tcl_Interp *i_interp; + char *i_name; + enum INFOTYPE i_type; + union infop { + DB_ENV *envp; + void *anyp; + DB *dbp; + DBC *dbcp; + DB_TXN *txnp; + DB_MPOOLFILE *mp; + DB_LOCK *lock; + _MUTEX_DATA *mutex; + DB_LOGC *logc; + } un; + union data { + int anydata; + db_pgno_t pgno; + u_int32_t lockid; + } und; + union data2 { + int anydata; + size_t pagesz; + } und2; + DBT i_lockobj; + FILE *i_err; + char *i_errpfx; + + /* Callbacks--Tcl_Objs containing proc names */ + Tcl_Obj *i_btcompare; + Tcl_Obj *i_dupcompare; + Tcl_Obj *i_hashproc; + Tcl_Obj *i_rep_send; + Tcl_Obj *i_second_call; + + /* Environment ID for the i_rep_send callback. */ + Tcl_Obj *i_rep_eid; + + struct dbtcl_info *i_parent; + int i_otherid[MAX_ID]; +} DBTCL_INFO; + +#define i_anyp un.anyp +#define i_pagep un.anyp +#define i_envp un.envp +#define i_dbp un.dbp +#define i_dbcp un.dbcp +#define i_txnp un.txnp +#define i_mp un.mp +#define i_lock un.lock +#define i_mutex un.mutex +#define i_logc un.logc + +#define i_data und.anydata +#define i_pgno und.pgno +#define i_locker und.lockid +#define i_data2 und2.anydata +#define i_pgsz und2.pagesz + +#define i_envtxnid i_otherid[0] +#define i_envmpid i_otherid[1] +#define i_envlockid i_otherid[2] +#define i_envmutexid i_otherid[3] +#define i_envlogcid i_otherid[4] + +#define i_mppgid i_otherid[0] + +#define i_dbdbcid i_otherid[0] + +extern int __debug_on, __debug_print, __debug_stop, __debug_test; + +typedef struct dbtcl_global { + LIST_HEAD(infohead, dbtcl_info) g_infohead; +} DBTCL_GLOBAL; +#define __db_infohead __dbtcl_global.g_infohead + +extern DBTCL_GLOBAL __dbtcl_global; + +#define NAME_TO_ENV(name) (DB_ENV *)_NameToPtr((name)) +#define NAME_TO_DB(name) (DB *)_NameToPtr((name)) +#define NAME_TO_DBC(name) (DBC *)_NameToPtr((name)) +#define NAME_TO_TXN(name) (DB_TXN *)_NameToPtr((name)) +#define NAME_TO_MP(name) (DB_MPOOLFILE *)_NameToPtr((name)) +#define NAME_TO_LOCK(name) (DB_LOCK *)_NameToPtr((name)) + +/* + * MAKE_STAT_LIST appends a {name value} pair to a result list + * that MUST be called 'res' that is a Tcl_Obj * in the local + * function. This macro also assumes a label "error" to go to + * in the even of a Tcl error. For stat functions this will + * typically go before the "free" function to free the stat structure + * returned by DB. + */ +#define MAKE_STAT_LIST(s,v) \ +do { \ + result = _SetListElemInt(interp, res, (s), (v)); \ + if (result != TCL_OK) \ + goto error; \ +} while (0) + +/* + * MAKE_STAT_LSN appends a {name {LSNfile LSNoffset}} pair to a result list + * that MUST be called 'res' that is a Tcl_Obj * in the local + * function. This macro also assumes a label "error" to go to + * in the even of a Tcl error. For stat functions this will + * typically go before the "free" function to free the stat structure + * returned by DB. + */ +#define MAKE_STAT_LSN(s, lsn) \ +do { \ + myobjc = 2; \ + myobjv[0] = Tcl_NewLongObj((long)(lsn)->file); \ + myobjv[1] = Tcl_NewLongObj((long)(lsn)->offset); \ + lsnlist = Tcl_NewListObj(myobjc, myobjv); \ + myobjc = 2; \ + myobjv[0] = Tcl_NewStringObj((s), strlen(s)); \ + myobjv[1] = lsnlist; \ + thislist = Tcl_NewListObj(myobjc, myobjv); \ + result = Tcl_ListObjAppendElement(interp, res, thislist); \ + if (result != TCL_OK) \ + goto error; \ +} while (0) + +/* + * MAKE_STAT_STRLIST appends a {name string} pair to a result list + * that MUST be called 'res' that is a Tcl_Obj * in the local + * function. This macro also assumes a label "error" to go to + * in the even of a Tcl error. For stat functions this will + * typically go before the "free" function to free the stat structure + * returned by DB. + */ +#define MAKE_STAT_STRLIST(s,s1) \ +do { \ + result = _SetListElem(interp, res, (s), strlen(s), \ + (s1), strlen(s1)); \ + if (result != TCL_OK) \ + goto error; \ +} while (0) + +/* + * FLAG_CHECK checks that the given flag is not set yet. + * If it is, it sets up an error message. + */ +#define FLAG_CHECK(flag) \ +do { \ + if ((flag) != 0) { \ + Tcl_SetResult(interp, \ + " Only 1 policy can be specified.\n", \ + TCL_STATIC); \ + result = TCL_ERROR; \ + break; \ + } \ +} while (0) + +/* + * FLAG_CHECK2 checks that the given flag is not set yet or is + * only set to the given allowed value. + * If it is, it sets up an error message. + */ +#define FLAG_CHECK2(flag,val) \ +do { \ + if (((flag) & ~(val)) != 0) { \ + Tcl_SetResult(interp, \ + " Only 1 policy can be specified.\n", \ + TCL_STATIC); \ + result = TCL_ERROR; \ + break; \ + } \ +} while (0) + +/* + * IS_HELP checks whether the arg we bombed on is -?, which is a help option. + * If it is, we return TCL_OK (but leave the result set to whatever + * Tcl_GetIndexFromObj says, which lists all the valid options. Otherwise + * return TCL_ERROR. + */ +#define IS_HELP(s) \ + (strcmp(Tcl_GetStringFromObj(s,NULL), "-?") == 0) ? TCL_OK : TCL_ERROR + +#include "dbinc_auto/tcl_ext.h" +#endif /* !_DB_TCL_DB_H_ */ diff --git a/db/dbinc/txn.h b/db/dbinc/txn.h new file mode 100644 index 000000000..580c3a05c --- /dev/null +++ b/db/dbinc/txn.h @@ -0,0 +1,144 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: txn.h,v 11.42 2002/08/06 06:11:22 bostic Exp + */ + +#ifndef _TXN_H_ +#define _TXN_H_ + +#include "dbinc/xa.h" + +/* Operation parameters to the delayed commit processing code. */ +typedef enum { + TXN_REMOVE, /* Remove a file. */ + TXN_TRADE, /* Trade lockers. */ + TXN_TRADED /* Already traded; downgrade lock. */ +} TXN_EVENT_T; + +struct __db_txnregion; typedef struct __db_txnregion DB_TXNREGION; + +/* + * !!! + * TXN_MINIMUM = (DB_LOCK_MAXID + 1) but this makes compilers complain. + */ +#define TXN_MINIMUM 0x80000000 +#define TXN_MAXIMUM 0xffffffff /* Maximum number of txn ids. */ +#define TXN_INVALID 0 /* Invalid transaction ID. */ + +#define DEF_MAX_TXNS 20 /* Default max transactions. */ + +/* + * Internal data maintained in shared memory for each transaction. + */ +typedef struct __txn_detail { + u_int32_t txnid; /* current transaction id + used to link free list also */ + DB_LSN last_lsn; /* last lsn written for this txn */ + DB_LSN begin_lsn; /* lsn of begin record */ + roff_t parent; /* Offset of transaction's parent. */ + +#define TXN_RUNNING 1 +#define TXN_ABORTED 2 +#define TXN_PREPARED 3 +#define TXN_COMMITTED 4 + u_int32_t status; /* status of the transaction */ +#define TXN_COLLECTED 0x1 +#define TXN_RESTORED 0x2 +#define TXN_DEFER_DEALLOC 0x4 + u_int32_t flags; /* collected during txn_recover */ + + SH_TAILQ_ENTRY links; /* free/active list */ + +#define TXN_XA_ABORTED 1 +#define TXN_XA_DEADLOCKED 2 +#define TXN_XA_ENDED 3 +#define TXN_XA_PREPARED 4 +#define TXN_XA_STARTED 5 +#define TXN_XA_SUSPENDED 6 + u_int32_t xa_status; /* XA status */ + + /* + * XID (xid_t) structure: because these fields are logged, the + * sizes have to be explicit. + */ + u_int8_t xid[XIDDATASIZE]; /* XA global transaction id */ + u_int32_t bqual; /* bqual_length from XID */ + u_int32_t gtrid; /* gtrid_length from XID */ + int32_t format; /* XA format */ +} TXN_DETAIL; + +/* + * DB_TXNMGR -- + * The transaction manager encapsulates the transaction system. + */ +struct __db_txnmgr { +/* + * These fields need to be protected for multi-threaded support. + * + * !!! + * As this structure is allocated in per-process memory, the mutex may need + * to be stored elsewhere on architectures unable to support mutexes in heap + * memory, e.g., HP/UX 9. + */ + DB_MUTEX *mutexp; /* Lock list of active transactions + * (including the content of each + * TXN_DETAIL structure on the list). + */ + /* List of active transactions. */ + TAILQ_HEAD(_chain, __db_txn) txn_chain; + u_int32_t n_discards; /* Number of txns discarded. */ + +/* These fields are never updated after creation, and so not protected. */ + DB_ENV *dbenv; /* Environment. */ + REGINFO reginfo; /* Region information. */ +}; + +/* + * DB_TXNREGION -- + * The primary transaction data structure in the shared memory region. + */ +struct __db_txnregion { + u_int32_t maxtxns; /* maximum number of active TXNs */ + u_int32_t last_txnid; /* last transaction id given out */ + u_int32_t cur_maxid; /* current max unused id. */ + DB_LSN last_ckp; /* lsn of the last checkpoint */ + time_t time_ckp; /* time of last checkpoint */ + u_int32_t logtype; /* type of logging */ + u_int32_t locktype; /* lock type */ + DB_TXN_STAT stat; /* Statistics for txns. */ + +#define TXN_IN_RECOVERY 0x01 /* environment is being recovered */ + u_int32_t flags; + /* active TXN list */ + SH_TAILQ_HEAD(__active) active_txn; +#ifdef HAVE_MUTEX_SYSTEM_RESOURCES +#define TXN_MAINT_SIZE (sizeof(roff_t) * DB_MAX_HANDLES) + + roff_t maint_off; /* offset of region maintenance info */ +#endif +}; + +/* + * Log record types. Note that these are *not* alphabetical. This is + * intentional so that we don't change the meaning of values between + * software upgrades. EXPECTED, UNEXPECTED, IGNORE, NOTFOUND and OK + * are used in the + * txnlist functions. + */ +#define TXN_OK 0 +#define TXN_COMMIT 1 +#define TXN_PREPARE 2 +#define TXN_ABORT 3 +#define TXN_NOTFOUND 4 +#define TXN_IGNORE 5 +#define TXN_EXPECTED 6 +#define TXN_UNEXPECTED 7 + +#include "dbinc_auto/txn_auto.h" +#include "dbinc_auto/txn_ext.h" +#include "dbinc_auto/xa_ext.h" +#endif /* !_TXN_H_ */ diff --git a/db/dbinc/xa.h b/db/dbinc/xa.h new file mode 100644 index 000000000..578e7f984 --- /dev/null +++ b/db/dbinc/xa.h @@ -0,0 +1,179 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998-2002 + * Sleepycat Software. All rights reserved. + * + * Id: xa.h,v 11.5 2002/01/11 15:52:30 bostic Exp + */ +/* + * Start of xa.h header + * + * Define a symbol to prevent multiple inclusions of this header file + */ +#ifndef XA_H +#define XA_H + +/* + * Transaction branch identification: XID and NULLXID: + */ +#define XIDDATASIZE 128 /* size in bytes */ +#define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ +#define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ + +struct xid_t { + long formatID; /* format identifier */ + long gtrid_length; /* value from 1 through 64 */ + long bqual_length; /* value from 1 through 64 */ + char data[XIDDATASIZE]; +}; +typedef struct xid_t XID; +/* + * A value of -1 in formatID means that the XID is null. + */ + +/* + * Declarations of routines by which RMs call TMs: + */ +extern int ax_reg __P((int, XID *, long)); +extern int ax_unreg __P((int, long)); + +/* + * XA Switch Data Structure + */ +#define RMNAMESZ 32 /* length of resource manager name, */ + /* including the null terminator */ +#define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */ + /* strings, including the null + terminator */ +struct xa_switch_t { + char name[RMNAMESZ]; /* name of resource manager */ + long flags; /* resource manager specific options */ + long version; /* must be 0 */ + int (*xa_open_entry) /* xa_open function pointer */ + __P((char *, int, long)); + int (*xa_close_entry) /* xa_close function pointer */ + __P((char *, int, long)); + int (*xa_start_entry) /* xa_start function pointer */ + __P((XID *, int, long)); + int (*xa_end_entry) /* xa_end function pointer */ + __P((XID *, int, long)); + int (*xa_rollback_entry) /* xa_rollback function pointer */ + __P((XID *, int, long)); + int (*xa_prepare_entry) /* xa_prepare function pointer */ + __P((XID *, int, long)); + int (*xa_commit_entry) /* xa_commit function pointer */ + __P((XID *, int, long)); + int (*xa_recover_entry) /* xa_recover function pointer */ + __P((XID *, long, int, long)); + int (*xa_forget_entry) /* xa_forget function pointer */ + __P((XID *, int, long)); + int (*xa_complete_entry) /* xa_complete function pointer */ + __P((int *, int *, int, long)); +}; + +/* + * Flag definitions for the RM switch + */ +#define TMNOFLAGS 0x00000000L /* no resource manager features + selected */ +#define TMREGISTER 0x00000001L /* resource manager dynamically + registers */ +#define TMNOMIGRATE 0x00000002L /* resource manager does not support + association migration */ +#define TMUSEASYNC 0x00000004L /* resource manager supports + asynchronous operations */ +/* + * Flag definitions for xa_ and ax_ routines + */ +/* use TMNOFLAGGS, defined above, when not specifying other flags */ +#define TMASYNC 0x80000000L /* perform routine asynchronously */ +#define TMONEPHASE 0x40000000L /* caller is using one-phase commit + optimisation */ +#define TMFAIL 0x20000000L /* dissociates caller and marks + transaction branch rollback-only */ +#define TMNOWAIT 0x10000000L /* return if blocking condition + exists */ +#define TMRESUME 0x08000000L /* caller is resuming association with + suspended transaction branch */ +#define TMSUCCESS 0x04000000L /* dissociate caller from transaction + branch */ +#define TMSUSPEND 0x02000000L /* caller is suspending, not ending, + association */ +#define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ +#define TMENDRSCAN 0x00800000L /* end a recovery scan */ +#define TMMULTIPLE 0x00400000L /* wait for any asynchronous + operation */ +#define TMJOIN 0x00200000L /* caller is joining existing + transaction branch */ +#define TMMIGRATE 0x00100000L /* caller intends to perform + migration */ + +/* + * ax_() return codes (transaction manager reports to resource manager) + */ +#define TM_JOIN 2 /* caller is joining existing + transaction branch */ +#define TM_RESUME 1 /* caller is resuming association with + suspended transaction branch */ +#define TM_OK 0 /* normal execution */ +#define TMER_TMERR -1 /* an error occurred in the transaction + manager */ +#define TMER_INVAL -2 /* invalid arguments were given */ +#define TMER_PROTO -3 /* routine invoked in an improper + context */ + +/* + * xa_() return codes (resource manager reports to transaction manager) + */ +#define XA_RBBASE 100 /* The inclusive lower bound of the + rollback codes */ +#define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an + unspecified reason */ +#define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a + communication failure */ +#define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ +#define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the + integrity of the resources was + detected */ +#define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the + transaction branch for a reason not + on this list */ +#define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the + resource manager */ +#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */ +#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ +#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the + rollback codes */ +#define XA_NOMIGRATE 9 /* resumption must occur where + suspension occurred */ +#define XA_HEURHAZ 8 /* the transaction branch may have + been heuristically completed */ +#define XA_HEURCOM 7 /* the transaction branch has been + heuristically committed */ +#define XA_HEURRB 6 /* the transaction branch has been + heuristically rolled back */ +#define XA_HEURMIX 5 /* the transaction branch has been + heuristically committed and rolled + back */ +#define XA_RETRY 4 /* routine returned with no effect and + may be re-issued */ +#define XA_RDONLY 3 /* the transaction branch was read-only + and has been committed */ +#define XA_OK 0 /* normal execution */ +#define XAER_ASYNC -2 /* asynchronous operation already + outstanding */ +#define XAER_RMERR -3 /* a resource manager error occurred in + the transaction branch */ +#define XAER_NOTA -4 /* the XID is not valid */ +#define XAER_INVAL -5 /* invalid arguments were given */ +#define XAER_PROTO -6 /* routine invoked in an improper + context */ +#define XAER_RMFAIL -7 /* resource manager unavailable */ +#define XAER_DUPID -8 /* the XID already exists */ +#define XAER_OUTSIDE -9 /* resource manager doing work outside + transaction */ +#endif /* ifndef XA_H */ +/* + * End of xa.h header + */ diff --git a/db/dbinc_auto/btree_auto.h b/db/dbinc_auto/btree_auto.h new file mode 100644 index 000000000..4feb07ad9 --- /dev/null +++ b/db/dbinc_auto/btree_auto.h @@ -0,0 +1,128 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __bam_AUTO_H +#define __bam_AUTO_H +#define DB___bam_split 62 +typedef struct ___bam_split_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t left; + DB_LSN llsn; + db_pgno_t right; + DB_LSN rlsn; + u_int32_t indx; + db_pgno_t npgno; + DB_LSN nlsn; + db_pgno_t root_pgno; + DBT pg; + u_int32_t opflags; +} __bam_split_args; + +#define DB___bam_rsplit 63 +typedef struct ___bam_rsplit_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DBT pgdbt; + db_pgno_t root_pgno; + db_pgno_t nrec; + DBT rootent; + DB_LSN rootlsn; +} __bam_rsplit_args; + +#define DB___bam_adj 55 +typedef struct ___bam_adj_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; + u_int32_t indx_copy; + u_int32_t is_insert; +} __bam_adj_args; + +#define DB___bam_cadjust 56 +typedef struct ___bam_cadjust_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; + int32_t adjust; + u_int32_t opflags; +} __bam_cadjust_args; + +#define DB___bam_cdel 57 +typedef struct ___bam_cdel_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; +} __bam_cdel_args; + +#define DB___bam_repl 58 +typedef struct ___bam_repl_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + 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; + +#define DB___bam_root 59 +typedef struct ___bam_root_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t meta_pgno; + db_pgno_t root_pgno; + DB_LSN meta_lsn; +} __bam_root_args; + +#define DB___bam_curadj 64 +typedef struct ___bam_curadj_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_ca_mode mode; + db_pgno_t from_pgno; + db_pgno_t to_pgno; + db_pgno_t left_pgno; + u_int32_t first_indx; + u_int32_t from_indx; + u_int32_t to_indx; +} __bam_curadj_args; + +#define DB___bam_rcuradj 65 +typedef struct ___bam_rcuradj_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + ca_recno_arg mode; + db_pgno_t root; + db_recno_t recno; + u_int32_t order; +} __bam_rcuradj_args; + +#endif diff --git a/db/dbinc_auto/btree_ext.h b/db/dbinc_auto/btree_ext.h new file mode 100644 index 000000000..ec5468acf --- /dev/null +++ b/db/dbinc_auto/btree_ext.h @@ -0,0 +1,132 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _btree_ext_h_ +#define _btree_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __bam_cmp __P((DB *, const DBT *, PAGE *, u_int32_t, int (*)(DB *, const DBT *, const DBT *), int *)); +int __bam_defcmp __P((DB *, const DBT *, const DBT *)); +size_t __bam_defpfx __P((DB *, const DBT *, const DBT *)); +int __bam_pgin __P((DB_ENV *, DB *, db_pgno_t, void *, DBT *)); +int __bam_pgout __P((DB_ENV *, DB *, db_pgno_t, void *, DBT *)); +int __bam_mswap __P((PAGE *)); +void __bam_cprint __P((DBC *)); +int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, int)); +int __ram_ca_delete __P((DB *, db_pgno_t)); +int __bam_ca_di __P((DBC *, db_pgno_t, u_int32_t, int)); +int __bam_ca_dup __P((DBC *, u_int32_t, db_pgno_t, u_int32_t, db_pgno_t, u_int32_t)); +int __bam_ca_undodup __P((DB *, u_int32_t, db_pgno_t, u_int32_t, u_int32_t)); +int __bam_ca_rsplit __P((DBC *, db_pgno_t, db_pgno_t)); +int __bam_ca_split __P((DBC *, db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, int)); +void __bam_ca_undosplit __P((DB *, db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t)); +int __bam_c_init __P((DBC *, DBTYPE)); +int __bam_c_refresh __P((DBC *)); +int __bam_c_count __P((DBC *, db_recno_t *)); +int __bam_c_dup __P((DBC *, DBC *)); +int __bam_bulk_overflow __P((DBC *, u_int32_t, db_pgno_t, u_int8_t *)); +int __bam_bulk_duplicates __P((DBC *, db_pgno_t, u_int8_t *, int32_t *, int32_t **, u_int8_t **, u_int32_t *, int)); +int __bam_c_rget __P((DBC *, DBT *)); +int __bam_ditem __P((DBC *, PAGE *, u_int32_t)); +int __bam_adjindx __P((DBC *, PAGE *, u_int32_t, u_int32_t, int)); +int __bam_dpages __P((DBC *, EPG *)); +int __bam_db_create __P((DB *)); +int __bam_db_close __P((DB *)); +int __bam_set_flags __P((DB *, u_int32_t *flagsp)); +int __ram_set_flags __P((DB *, u_int32_t *flagsp)); +int __bam_open __P((DB *, DB_TXN *, const char *, db_pgno_t, u_int32_t)); +int __bam_metachk __P((DB *, const char *, BTMETA *)); +int __bam_read_root __P((DB *, DB_TXN *, db_pgno_t, u_int32_t)); +int __bam_new_file __P((DB *, DB_TXN *, DB_FH *, const char *)); +int __bam_new_subdb __P((DB *, DB *, DB_TXN *)); +int __bam_iitem __P((DBC *, DBT *, DBT *, u_int32_t, u_int32_t)); +int __bam_ritem __P((DBC *, PAGE *, u_int32_t, DBT *)); +int __bam_split_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_rsplit_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_adj_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_cadjust_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_cdel_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_repl_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_root_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_curadj_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_rcuradj_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_reclaim __P((DB *, DB_TXN *)); +int __bam_truncate __P((DB *, DB_TXN *, u_int32_t *)); +int __ram_open __P((DB *, DB_TXN *, const char *, db_pgno_t, u_int32_t)); +int __ram_append __P((DBC *, DBT *, DBT *)); +int __ram_c_del __P((DBC *)); +int __ram_c_get __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); +int __ram_c_put __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); +int __ram_ca __P((DBC *, ca_recno_arg)); +int __ram_getno __P((DBC *, const DBT *, db_recno_t *, int)); +int __ram_writeback __P((DB *)); +int __bam_rsearch __P((DBC *, db_recno_t *, u_int32_t, int, int *)); +int __bam_adjust __P((DBC *, int32_t)); +int __bam_nrecs __P((DBC *, db_recno_t *)); +db_recno_t __bam_total __P((DB *, PAGE *)); +int __bam_search __P((DBC *, db_pgno_t, const DBT *, u_int32_t, int, db_recno_t *, int *)); +int __bam_stkrel __P((DBC *, u_int32_t)); +int __bam_stkgrow __P((DB_ENV *, BTREE_CURSOR *)); +int __bam_split __P((DBC *, void *, db_pgno_t *)); +int __bam_copy __P((DB *, PAGE *, PAGE *, u_int32_t, u_int32_t)); +int __bam_stat __P((DB *, void *, u_int32_t)); +int __bam_traverse __P((DBC *, db_lockmode_t, db_pgno_t, int (*)(DB *, PAGE *, void *, int *), void *)); +int __bam_stat_callback __P((DB *, PAGE *, void *, int *)); +int __bam_key_range __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t)); +int __bam_30_btreemeta __P((DB *, char *, u_int8_t *)); +int __bam_31_btreemeta __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *)); +int __bam_31_lbtree __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *)); +int __bam_vrfy_meta __P((DB *, VRFY_DBINFO *, BTMETA *, db_pgno_t, u_int32_t)); +int __ram_vrfy_leaf __P((DB *, VRFY_DBINFO *, PAGE *, db_pgno_t, u_int32_t)); +int __bam_vrfy __P((DB *, VRFY_DBINFO *, PAGE *, db_pgno_t, u_int32_t)); +int __bam_vrfy_itemorder __P((DB *, VRFY_DBINFO *, PAGE *, db_pgno_t, u_int32_t, int, int, u_int32_t)); +int __bam_vrfy_structure __P((DB *, VRFY_DBINFO *, db_pgno_t, u_int32_t)); +int __bam_vrfy_subtree __P((DB *, VRFY_DBINFO *, db_pgno_t, void *, void *, u_int32_t, u_int32_t *, u_int32_t *, u_int32_t *)); +int __bam_salvage __P((DB *, VRFY_DBINFO *, db_pgno_t, u_int32_t, PAGE *, void *, int (*)(void *, const void *), DBT *, u_int32_t)); +int __bam_salvage_walkdupint __P((DB *, VRFY_DBINFO *, PAGE *, DBT *, void *, int (*)(void *, const void *), u_int32_t)); +int __bam_meta2pgset __P((DB *, VRFY_DBINFO *, BTMETA *, u_int32_t, DB *)); +int __bam_split_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, const DBT *, u_int32_t)); +int __bam_split_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_split_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_split_read __P((DB_ENV *, void *, __bam_split_args **)); +int __bam_rsplit_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, const DBT *, db_pgno_t, db_pgno_t, const DBT *, DB_LSN *)); +int __bam_rsplit_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_rsplit_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_rsplit_read __P((DB_ENV *, void *, __bam_rsplit_args **)); +int __bam_adj_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t, u_int32_t)); +int __bam_adj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_adj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_adj_read __P((DB_ENV *, void *, __bam_adj_args **)); +int __bam_cadjust_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, int32_t, u_int32_t)); +int __bam_cadjust_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_cadjust_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_cadjust_read __P((DB_ENV *, void *, __bam_cadjust_args **)); +int __bam_cdel_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, u_int32_t)); +int __bam_cdel_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_cdel_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_cdel_read __P((DB_ENV *, void *, __bam_cdel_args **)); +int __bam_repl_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t, const DBT *, const DBT *, u_int32_t, u_int32_t)); +int __bam_repl_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_repl_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_repl_read __P((DB_ENV *, void *, __bam_repl_args **)); +int __bam_root_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, db_pgno_t, DB_LSN *)); +int __bam_root_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_root_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_root_read __P((DB_ENV *, void *, __bam_root_args **)); +int __bam_curadj_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_ca_mode, db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, u_int32_t, u_int32_t)); +int __bam_curadj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_curadj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_curadj_read __P((DB_ENV *, void *, __bam_curadj_args **)); +int __bam_rcuradj_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, ca_recno_arg, db_pgno_t, db_recno_t, u_int32_t)); +int __bam_rcuradj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_rcuradj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __bam_rcuradj_read __P((DB_ENV *, void *, __bam_rcuradj_args **)); +int __bam_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __bam_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __bam_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_btree_ext_h_ */ diff --git a/db/dbinc_auto/clib_ext.h b/db/dbinc_auto/clib_ext.h new file mode 100644 index 000000000..7e2817d62 --- /dev/null +++ b/db/dbinc_auto/clib_ext.h @@ -0,0 +1,49 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _clib_ext_h_ +#define _clib_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifndef HAVE_GETCWD +char *getcwd __P((char *, size_t)); +#endif +#ifndef HAVE_GETOPT +int getopt __P((int, char * const *, const char *)); +#endif +#ifndef HAVE_MEMCMP +int memcmp __P((const void *, const void *, size_t)); +#endif +#ifndef HAVE_MEMCPY +void *memcpy __P((void *, const void *, size_t)); +#endif +#ifndef HAVE_MEMMOVE +void *memmove __P((void *, const void *, size_t)); +#endif +#ifndef HAVE_RAISE +int raise __P((int)); +#endif +#ifndef HAVE_SNPRINTF +int snprintf __P((char *, size_t, const char *, ...)); +#endif +#ifndef HAVE_STRCASECMP +int strcasecmp __P((const char *, const char *)); +#endif +#ifndef HAVE_STRCASECMP +int strncasecmp __P((const char *, const char *, size_t)); +#endif +#ifndef HAVE_STRDUP +char *strdup __P((const char *)); +#endif +#ifndef HAVE_STRERROR +char *strerror __P((int)); +#endif +#ifndef HAVE_VSNPRINTF +int vsnprintf __P((char *, size_t, const char *, va_list)); +#endif + +#if defined(__cplusplus) +} +#endif +#endif /* !_clib_ext_h_ */ diff --git a/db/dbinc_auto/common_ext.h b/db/dbinc_auto/common_ext.h new file mode 100644 index 000000000..7744982fe --- /dev/null +++ b/db/dbinc_auto/common_ext.h @@ -0,0 +1,44 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _common_ext_h_ +#define _common_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __db_isbigendian __P((void)); +int __db_byteorder __P((DB_ENV *, int)); +int __db_fchk __P((DB_ENV *, const char *, u_int32_t, u_int32_t)); +int __db_fcchk __P((DB_ENV *, const char *, u_int32_t, u_int32_t, u_int32_t)); +int __db_ferr __P((const DB_ENV *, const char *, int)); +void __db_pgerr __P((DB *, db_pgno_t, int)); +int __db_pgfmt __P((DB_ENV *, db_pgno_t)); +int __db_eopnotsup __P((const DB_ENV *)); +#ifdef DIAGNOSTIC +void __db_assert __P((const char *, const char *, int)); +#endif +int __db_panic_msg __P((DB_ENV *)); +int __db_panic __P((DB_ENV *, int)); +void __db_err __P((const DB_ENV *, const char *, ...)); +void __db_errcall __P((const DB_ENV *, int, int, const char *, va_list)); +void __db_errfile __P((const DB_ENV *, int, int, const char *, va_list)); +void __db_logmsg __P((const DB_ENV *, DB_TXN *, const char *, u_int32_t, const char *, ...)); +int __db_unknown_flag __P((DB_ENV *, char *, u_int32_t)); +int __db_unknown_type __P((DB_ENV *, char *, DBTYPE)); +int __db_check_txn __P((DB *, DB_TXN *, u_int32_t, int)); +int __db_not_txn_env __P((DB_ENV *)); +int __db_getlong __P((DB *, const char *, char *, long, long, long *)); +int __db_getulong __P((DB *, const char *, char *, u_long, u_long, u_long *)); +void __db_idspace __P((u_int32_t *, int, u_int32_t *, u_int32_t *)); +u_int32_t __db_log2 __P((u_int32_t)); +int __db_util_arg __P((char *, char *, int *, char ***)); +int __db_util_cache __P((DB_ENV *, DB *, u_int32_t *, int *)); +int __db_util_logset __P((const char *, char *)); +void __db_util_siginit __P((void)); +int __db_util_interrupted __P((void)); +void __db_util_sigresend __P((void)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_common_ext_h_ */ diff --git a/db/dbinc_auto/crdel_auto.h b/db/dbinc_auto/crdel_auto.h new file mode 100644 index 000000000..bdae193fa --- /dev/null +++ b/db/dbinc_auto/crdel_auto.h @@ -0,0 +1,16 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __crdel_AUTO_H +#define __crdel_AUTO_H +#define DB___crdel_metasub 142 +typedef struct ___crdel_metasub_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DBT page; + DB_LSN lsn; +} __crdel_metasub_args; + +#endif diff --git a/db/dbinc_auto/crypto_ext.h b/db/dbinc_auto/crypto_ext.h new file mode 100644 index 000000000..da1ae8a94 --- /dev/null +++ b/db/dbinc_auto/crypto_ext.h @@ -0,0 +1,37 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _crypto_ext_h_ +#define _crypto_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __aes_setup __P((DB_ENV *, DB_CIPHER *)); +int __aes_adj_size __P((size_t)); +int __aes_close __P((DB_ENV *, void *)); +int __aes_decrypt __P((DB_ENV *, void *, void *, u_int8_t *, size_t)); +int __aes_encrypt __P((DB_ENV *, void *, void *, u_int8_t *, size_t)); +int __aes_init __P((DB_ENV *, DB_CIPHER *)); +int __crypto_region_init __P((DB_ENV *)); +int __crypto_dbenv_close __P((DB_ENV *)); +int __crypto_algsetup __P((DB_ENV *, DB_CIPHER *, u_int32_t, int)); +int __crypto_decrypt_meta __P((DB_ENV *, DB *, u_int8_t *, size_t, int)); +int __db_generate_iv __P((DB_ENV *, u_int32_t *)); +int __db_rijndaelKeySetupEnc __P((u32 *, const u8 *, int)); +int __db_rijndaelKeySetupDec __P((u32 *, const u8 *, int)); +void __db_rijndaelEncrypt __P((u32 *, int, const u8 *, u8 *)); +void __db_rijndaelDecrypt __P((u32 *, int, const u8 *, u8 *)); +void __db_rijndaelEncryptRound __P((const u32 *, int, u8 *, int)); +void __db_rijndaelDecryptRound __P((const u32 *, int, u8 *, int)); +int __db_makeKey __P((keyInstance *, int, int, char *)); +int __db_cipherInit __P((cipherInstance *, int, char *)); +int __db_blockEncrypt __P((cipherInstance *, keyInstance *, BYTE *, size_t, BYTE *)); +int __db_padEncrypt __P((cipherInstance *, keyInstance *, BYTE *, int, BYTE *)); +int __db_blockDecrypt __P((cipherInstance *, keyInstance *, BYTE *, size_t, BYTE *)); +int __db_padDecrypt __P((cipherInstance *, keyInstance *, BYTE *, int, BYTE *)); +int __db_cipherUpdateRounds __P((cipherInstance *, keyInstance *, BYTE *, int, BYTE *, int)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_crypto_ext_h_ */ diff --git a/db/dbinc_auto/db_auto.h b/db/dbinc_auto/db_auto.h new file mode 100644 index 000000000..e56f38b38 --- /dev/null +++ b/db/dbinc_auto/db_auto.h @@ -0,0 +1,118 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __db_AUTO_H +#define __db_AUTO_H +#define DB___db_addrem 41 +typedef struct ___db_addrem_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t fileid; + db_pgno_t pgno; + u_int32_t indx; + u_int32_t nbytes; + DBT hdr; + DBT dbt; + DB_LSN pagelsn; +} __db_addrem_args; + +#define DB___db_big 43 +typedef struct ___db_big_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t fileid; + db_pgno_t pgno; + db_pgno_t prev_pgno; + db_pgno_t next_pgno; + DBT dbt; + DB_LSN pagelsn; + DB_LSN prevlsn; + DB_LSN nextlsn; +} __db_big_args; + +#define DB___db_ovref 44 +typedef struct ___db_ovref_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + int32_t adjust; + DB_LSN lsn; +} __db_ovref_args; + +#define DB___db_relink 45 +typedef struct ___db_relink_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + db_pgno_t prev; + DB_LSN lsn_prev; + db_pgno_t next; + DB_LSN lsn_next; +} __db_relink_args; + +#define DB___db_debug 47 +typedef struct ___db_debug_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT op; + int32_t fileid; + DBT key; + DBT data; + u_int32_t arg_flags; +} __db_debug_args; + +#define DB___db_noop 48 +typedef struct ___db_noop_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DB_LSN prevlsn; +} __db_noop_args; + +#define DB___db_pg_alloc 49 +typedef struct ___db_pg_alloc_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + DB_LSN meta_lsn; + db_pgno_t meta_pgno; + DB_LSN page_lsn; + db_pgno_t pgno; + u_int32_t ptype; + db_pgno_t next; +} __db_pg_alloc_args; + +#define DB___db_pg_free 50 +typedef struct ___db_pg_free_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + DB_LSN meta_lsn; + db_pgno_t meta_pgno; + DBT header; + db_pgno_t next; +} __db_pg_free_args; + +#define DB___db_cksum 51 +typedef struct ___db_cksum_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; +} __db_cksum_args; + +#endif diff --git a/db/dbinc_auto/db_ext.h b/db/dbinc_auto/db_ext.h new file mode 100644 index 000000000..39594e1d2 --- /dev/null +++ b/db/dbinc_auto/db_ext.h @@ -0,0 +1,223 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _db_ext_h_ +#define _db_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __crdel_metasub_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, const DBT *, DB_LSN *)); +int __crdel_metasub_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __crdel_metasub_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __crdel_metasub_read __P((DB_ENV *, void *, __crdel_metasub_args **)); +int __crdel_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __crdel_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __crdel_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __crdel_metasub_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_master_open __P((DB *, DB_TXN *, const char *, u_int32_t, int, DB **)); +int __db_master_update __P((DB *, DB *, DB_TXN *, const char *, DBTYPE, mu_action, const char *, u_int32_t)); +int __db_dbenv_setup __P((DB *, DB_TXN *, const char *, u_int32_t, u_int32_t)); +int __db_close __P((DB *, u_int32_t)); +int __db_close_i __P((DB *, DB_TXN *, u_int32_t)); +int __db_refresh __P((DB *, DB_TXN *, u_int32_t)); +int __db_log_page __P((DB *, DB_TXN *, DB_LSN *, db_pgno_t, PAGE *)); +int __db_backup_name __P((DB_ENV *, const char *, DB_TXN *, char **, DB_LSN *)); +DB *__dblist_get __P((DB_ENV *, u_int32_t)); +#if CONFIG_TEST +int __db_testcopy __P((DB_ENV *, DB *, const char *)); +#endif +int __db_cursor __P((DB *, DB_TXN *, DBC **, u_int32_t)); +int __db_icursor __P((DB *, DB_TXN *, DBTYPE, db_pgno_t, int, u_int32_t, DBC **)); +int __db_cprint __P((DB *)); +int __db_fd __P((DB *, int *)); +int __db_get __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +int __db_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +int __db_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); +int __db_sync __P((DB *, u_int32_t)); +int __db_associate __P((DB *, DB_TXN *, DB *, int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t)); +int __db_pget __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t)); +int __db_addrem_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, db_pgno_t, u_int32_t, u_int32_t, const DBT *, const DBT *, DB_LSN *)); +int __db_addrem_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_addrem_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_addrem_read __P((DB_ENV *, void *, __db_addrem_args **)); +int __db_big_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, db_pgno_t, const DBT *, DB_LSN *, DB_LSN *, DB_LSN *)); +int __db_big_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_big_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_big_read __P((DB_ENV *, void *, __db_big_args **)); +int __db_ovref_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, int32_t, DB_LSN *)); +int __db_ovref_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_ovref_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_ovref_read __P((DB_ENV *, void *, __db_ovref_args **)); +int __db_relink_log __P((DB *, 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 *)); +int __db_relink_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_relink_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_relink_read __P((DB_ENV *, void *, __db_relink_args **)); +int __db_debug_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *, int32_t, const DBT *, const DBT *, u_int32_t)); +int __db_debug_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_debug_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_debug_read __P((DB_ENV *, void *, __db_debug_args **)); +int __db_noop_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *)); +int __db_noop_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_noop_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_noop_read __P((DB_ENV *, void *, __db_noop_args **)); +int __db_pg_alloc_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, DB_LSN *, db_pgno_t, DB_LSN *, db_pgno_t, u_int32_t, db_pgno_t)); +int __db_pg_alloc_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_pg_alloc_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_pg_alloc_read __P((DB_ENV *, void *, __db_pg_alloc_args **)); +int __db_pg_free_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, const DBT *, db_pgno_t)); +int __db_pg_free_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_pg_free_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_pg_free_read __P((DB_ENV *, void *, __db_pg_free_args **)); +int __db_cksum_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t)); +int __db_cksum_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_cksum_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_cksum_read __P((DB_ENV *, void *, __db_cksum_args **)); +int __db_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __db_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __db_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __db_c_close __P((DBC *)); +int __db_c_destroy __P((DBC *)); +int __db_c_count __P((DBC *, db_recno_t *, u_int32_t)); +int __db_c_del __P((DBC *, u_int32_t)); +int __db_c_dup __P((DBC *, DBC **, u_int32_t)); +int __db_c_idup __P((DBC *, DBC **, u_int32_t)); +int __db_c_newopd __P((DBC *, db_pgno_t, DBC *, DBC **)); +int __db_c_get __P((DBC *, DBT *, DBT *, u_int32_t)); +int __db_c_put __P((DBC *, DBT *, DBT *, u_int32_t)); +int __db_duperr __P((DB *, u_int32_t)); +int __db_c_secondary_get __P((DBC *, DBT *, DBT *, u_int32_t)); +int __db_c_pget __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); +int __db_c_del_primary __P((DBC *)); +DB *__db_s_first __P((DB *)); +int __db_s_next __P((DB **)); +int __db_s_done __P((DB *)); +u_int32_t __db_partsize __P((u_int32_t, DBT *)); +int __db_pgin __P((DB_ENV *, db_pgno_t, void *, DBT *)); +int __db_pgout __P((DB_ENV *, db_pgno_t, void *, DBT *)); +void __db_metaswap __P((PAGE *)); +int __db_byteswap __P((DB_ENV *, DB *, db_pgno_t, PAGE *, size_t, int)); +int __db_dispatch __P((DB_ENV *, int (**)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)), size_t, DBT *, DB_LSN *, db_recops, void *)); +int __db_add_recovery __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *, int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), u_int32_t)); +int __db_txnlist_init __P((DB_ENV *, u_int32_t, u_int32_t, DB_LSN *, void *)); +int __db_txnlist_add __P((DB_ENV *, void *, u_int32_t, int32_t, DB_LSN *)); +int __db_txnlist_remove __P((DB_ENV *, void *, u_int32_t)); +void __db_txnlist_ckp __P((DB_ENV *, void *, DB_LSN *)); +void __db_txnlist_end __P((DB_ENV *, void *)); +int __db_txnlist_find __P((DB_ENV *, void *, u_int32_t)); +int __db_txnlist_update __P((DB_ENV *, void *, u_int32_t, u_int32_t, DB_LSN *)); +int __db_txnlist_gen __P((DB_ENV *, void *, int, u_int32_t, u_int32_t)); +int __db_txnlist_lsnadd __P((DB_ENV *, void *, DB_LSN *, u_int32_t)); +int __db_txnlist_lsninit __P((DB_ENV *, DB_TXNHEAD *, DB_LSN *)); +int __db_add_limbo __P((DB_ENV *, void *, int32_t, db_pgno_t, int32_t)); +int __db_do_the_limbo __P((DB_ENV *, DB_TXN *, DB_TXN *, DB_TXNHEAD *)); +void __db_txnlist_print __P((void *)); +int __db_ditem __P((DBC *, PAGE *, u_int32_t, u_int32_t)); +int __db_pitem __P((DBC *, PAGE *, u_int32_t, u_int32_t, DBT *, DBT *)); +int __db_relink __P((DBC *, u_int32_t, PAGE *, PAGE **, int)); +int __db_cursorchk __P((const DB *, u_int32_t)); +int __db_ccountchk __P((const DB *, u_int32_t, int)); +int __db_cdelchk __P((const DB *, u_int32_t, int)); +int __db_cgetchk __P((const DB *, DBT *, DBT *, u_int32_t, int)); +int __db_cputchk __P((const DB *, const DBT *, DBT *, u_int32_t, int)); +int __db_pgetchk __P((const DB *, const DBT *, DBT *, DBT *, u_int32_t)); +int __db_cpgetchk __P((const DB *, DBT *, DBT *, DBT *, u_int32_t, int)); +int __db_delchk __P((const DB *, DBT *, u_int32_t)); +int __db_getchk __P((const DB *, const DBT *, DBT *, u_int32_t)); +int __db_joinchk __P((const DB *, DBC * const *, u_int32_t)); +int __db_joingetchk __P((const DB *, DBT *, u_int32_t)); +int __db_putchk __P((const DB *, DBT *, const DBT *, u_int32_t, int)); +int __db_statchk __P((const DB *, u_int32_t)); +int __db_syncchk __P((const DB *, u_int32_t)); +int __db_secondary_corrupt __P((DB *)); +int __db_associatechk __P((DB *, DB *, int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t)); +int __db_txn_auto __P((DB *, DB_TXN **)); +int __db_join __P((DB *, DBC **, DBC **, u_int32_t)); +int __db_new __P((DBC *, u_int32_t, PAGE **)); +int __db_free __P((DBC *, PAGE *)); +int __db_lprint __P((DBC *)); +int __db_lget __P((DBC *, int, db_pgno_t, db_lockmode_t, u_int32_t, DB_LOCK *)); +int __db_lput __P((DBC *, DB_LOCK *)); +int __dbh_am_chk __P((DB *, u_int32_t)); +int __db_set_lorder __P((DB *, int)); +int __db_open __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int)); +int __db_dbopen __P((DB *, DB_TXN *, const char *, const char *, u_int32_t, int, db_pgno_t)); +int __db_new_file __P((DB *, DB_TXN *, DB_FH *, const char *)); +int __db_init_subdb __P((DB *, DB *, const char *, DB_TXN *)); +int __db_chk_meta __P((DB_ENV *, DB *, DBMETA *, int)); +int __db_meta_setup __P((DB_ENV *, DB *, const char *, DBMETA *, u_int32_t, int)); +int __db_goff __P((DB *, DBT *, u_int32_t, db_pgno_t, void **, u_int32_t *)); +int __db_poff __P((DBC *, const DBT *, db_pgno_t *)); +int __db_ovref __P((DBC *, db_pgno_t, int32_t)); +int __db_doff __P((DBC *, db_pgno_t)); +int __db_moff __P((DB *, const DBT *, db_pgno_t, u_int32_t, int (*)(DB *, const DBT *, const DBT *), int *)); +int __db_vrfy_overflow __P((DB *, VRFY_DBINFO *, PAGE *, db_pgno_t, u_int32_t)); +int __db_vrfy_ovfl_structure __P((DB *, VRFY_DBINFO *, db_pgno_t, u_int32_t, u_int32_t)); +int __db_safe_goff __P((DB *, VRFY_DBINFO *, db_pgno_t, DBT *, void **, u_int32_t)); +void __db_loadme __P((void)); +int __db_dump __P((DB *, char *, char *)); +void __db_inmemdbflags __P((u_int32_t, void *, void (*)(u_int32_t, const FN *, void *))); +int __db_prnpage __P((DB *, db_pgno_t, FILE *)); +int __db_prpage __P((DB *, PAGE *, FILE *, u_int32_t)); +void __db_pr __P((u_int8_t *, u_int32_t, FILE *)); +int __db_prdbt __P((DBT *, int, const char *, void *, int (*)(void *, const void *), int, VRFY_DBINFO *)); +void __db_prflags __P((u_int32_t, const FN *, void *)); +int __db_prheader __P((DB *, char *, int, int, void *, int (*)(void *, const void *), VRFY_DBINFO *, db_pgno_t)); +int __db_prfooter __P((void *, int (*)(void *, const void *))); +int __db_addrem_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_big_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_ovref_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_relink_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_debug_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_noop_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_pg_alloc_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_pg_free_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_cksum_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __db_traverse_big __P((DB *, db_pgno_t, int (*)(DB *, PAGE *, void *, int *), void *)); +int __db_reclaim_callback __P((DB *, PAGE *, void *, int *)); +int __db_truncate_callback __P((DB *, PAGE *, void *, int *)); +int __dbenv_dbremove __P((DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)); +int __db_remove __P((DB *, const char *, const char *, u_int32_t)); +int __db_remove_i __P((DB *, DB_TXN *, const char *, const char *)); +int __dbenv_dbrename __P((DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)); +int __db_rename __P((DB *, const char *, const char *, const char *, u_int32_t)); +int __db_rename_i __P((DB *, DB_TXN *, const char *, const char *, const char *)); +int __db_ret __P((DB *, PAGE *, u_int32_t, DBT *, void **, u_int32_t *)); +int __db_retcopy __P((DB_ENV *, DBT *, void *, u_int32_t, void **, u_int32_t *)); +int __db_truncate __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); +int __db_upgrade __P((DB *, const char *, u_int32_t)); +int __db_lastpgno __P((DB *, char *, DB_FH *, db_pgno_t *)); +int __db_31_offdup __P((DB *, char *, DB_FH *, int, db_pgno_t *)); +int __db_verify __P((DB *, const char *, const char *, FILE *, u_int32_t)); +int __db_verify_callback __P((void *, const void *)); +int __db_verify_internal __P((DB *, const char *, const char *, void *, int (*)(void *, const void *), u_int32_t)); +int __db_vrfy_datapage __P((DB *, VRFY_DBINFO *, PAGE *, db_pgno_t, u_int32_t)); +int __db_vrfy_meta __P((DB *, VRFY_DBINFO *, DBMETA *, db_pgno_t, u_int32_t)); +void __db_vrfy_struct_feedback __P((DB *, VRFY_DBINFO *)); +int __db_vrfy_inpitem __P((DB *, PAGE *, db_pgno_t, u_int32_t, int, u_int32_t, u_int32_t *, u_int32_t *)); +int __db_vrfy_duptype __P((DB *, VRFY_DBINFO *, db_pgno_t, u_int32_t)); +int __db_salvage_duptree __P((DB *, VRFY_DBINFO *, db_pgno_t, DBT *, void *, int (*)(void *, const void *), u_int32_t)); +int __db_vrfy_dbinfo_create __P((DB_ENV *, u_int32_t, VRFY_DBINFO **)); +int __db_vrfy_dbinfo_destroy __P((DB_ENV *, VRFY_DBINFO *)); +int __db_vrfy_getpageinfo __P((VRFY_DBINFO *, db_pgno_t, VRFY_PAGEINFO **)); +int __db_vrfy_putpageinfo __P((DB_ENV *, VRFY_DBINFO *, VRFY_PAGEINFO *)); +int __db_vrfy_pgset __P((DB_ENV *, u_int32_t, DB **)); +int __db_vrfy_pgset_get __P((DB *, db_pgno_t, int *)); +int __db_vrfy_pgset_inc __P((DB *, db_pgno_t)); +int __db_vrfy_pgset_dec __P((DB *, db_pgno_t)); +int __db_vrfy_pgset_next __P((DBC *, db_pgno_t *)); +int __db_vrfy_childcursor __P((VRFY_DBINFO *, DBC **)); +int __db_vrfy_childput __P((VRFY_DBINFO *, db_pgno_t, VRFY_CHILDINFO *)); +int __db_vrfy_ccset __P((DBC *, db_pgno_t, VRFY_CHILDINFO **)); +int __db_vrfy_ccnext __P((DBC *, VRFY_CHILDINFO **)); +int __db_vrfy_ccclose __P((DBC *)); +int __db_salvage_init __P((VRFY_DBINFO *)); +void __db_salvage_destroy __P((VRFY_DBINFO *)); +int __db_salvage_getnext __P((VRFY_DBINFO *, db_pgno_t *, u_int32_t *)); +int __db_salvage_isdone __P((VRFY_DBINFO *, db_pgno_t)); +int __db_salvage_markdone __P((VRFY_DBINFO *, db_pgno_t)); +int __db_salvage_markneeded __P((VRFY_DBINFO *, db_pgno_t, u_int32_t)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_db_ext_h_ */ diff --git a/db/dbinc_auto/db_server.h b/db/dbinc_auto/db_server.h new file mode 100644 index 000000000..3409eed1a --- /dev/null +++ b/db/dbinc_auto/db_server.h @@ -0,0 +1,1006 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _DB_SERVER_H_RPCGEN +#define _DB_SERVER_H_RPCGEN + + +struct __env_cachesize_msg { + u_int dbenvcl_id; + u_int gbytes; + u_int bytes; + u_int ncache; +}; +typedef struct __env_cachesize_msg __env_cachesize_msg; + +struct __env_cachesize_reply { + int status; +}; +typedef struct __env_cachesize_reply __env_cachesize_reply; + +struct __env_close_msg { + u_int dbenvcl_id; + u_int flags; +}; +typedef struct __env_close_msg __env_close_msg; + +struct __env_close_reply { + int status; +}; +typedef struct __env_close_reply __env_close_reply; + +struct __env_create_msg { + u_int timeout; +}; +typedef struct __env_create_msg __env_create_msg; + +struct __env_create_reply { + int status; + u_int envcl_id; +}; +typedef struct __env_create_reply __env_create_reply; + +struct __env_dbremove_msg { + u_int dbenvcl_id; + u_int txnpcl_id; + char *name; + char *subdb; + u_int flags; +}; +typedef struct __env_dbremove_msg __env_dbremove_msg; + +struct __env_dbremove_reply { + int status; +}; +typedef struct __env_dbremove_reply __env_dbremove_reply; + +struct __env_dbrename_msg { + u_int dbenvcl_id; + u_int txnpcl_id; + char *name; + char *subdb; + char *newname; + u_int flags; +}; +typedef struct __env_dbrename_msg __env_dbrename_msg; + +struct __env_dbrename_reply { + int status; +}; +typedef struct __env_dbrename_reply __env_dbrename_reply; + +struct __env_encrypt_msg { + u_int dbenvcl_id; + char *passwd; + u_int flags; +}; +typedef struct __env_encrypt_msg __env_encrypt_msg; + +struct __env_encrypt_reply { + int status; +}; +typedef struct __env_encrypt_reply __env_encrypt_reply; + +struct __env_flags_msg { + u_int dbenvcl_id; + u_int flags; + u_int onoff; +}; +typedef struct __env_flags_msg __env_flags_msg; + +struct __env_flags_reply { + int status; +}; +typedef struct __env_flags_reply __env_flags_reply; + +struct __env_open_msg { + u_int dbenvcl_id; + char *home; + u_int flags; + u_int mode; +}; +typedef struct __env_open_msg __env_open_msg; + +struct __env_open_reply { + int status; + u_int envcl_id; +}; +typedef struct __env_open_reply __env_open_reply; + +struct __env_remove_msg { + u_int dbenvcl_id; + char *home; + u_int flags; +}; +typedef struct __env_remove_msg __env_remove_msg; + +struct __env_remove_reply { + int status; +}; +typedef struct __env_remove_reply __env_remove_reply; + +struct __txn_abort_msg { + u_int txnpcl_id; +}; +typedef struct __txn_abort_msg __txn_abort_msg; + +struct __txn_abort_reply { + int status; +}; +typedef struct __txn_abort_reply __txn_abort_reply; + +struct __txn_begin_msg { + u_int dbenvcl_id; + u_int parentcl_id; + u_int flags; +}; +typedef struct __txn_begin_msg __txn_begin_msg; + +struct __txn_begin_reply { + int status; + u_int txnidcl_id; +}; +typedef struct __txn_begin_reply __txn_begin_reply; + +struct __txn_commit_msg { + u_int txnpcl_id; + u_int flags; +}; +typedef struct __txn_commit_msg __txn_commit_msg; + +struct __txn_commit_reply { + int status; +}; +typedef struct __txn_commit_reply __txn_commit_reply; + +struct __txn_discard_msg { + u_int txnpcl_id; + u_int flags; +}; +typedef struct __txn_discard_msg __txn_discard_msg; + +struct __txn_discard_reply { + int status; +}; +typedef struct __txn_discard_reply __txn_discard_reply; + +struct __txn_prepare_msg { + u_int txnpcl_id; + char gid[128]; +}; +typedef struct __txn_prepare_msg __txn_prepare_msg; + +struct __txn_prepare_reply { + int status; +}; +typedef struct __txn_prepare_reply __txn_prepare_reply; + +struct __txn_recover_msg { + u_int dbenvcl_id; + u_int count; + u_int flags; +}; +typedef struct __txn_recover_msg __txn_recover_msg; + +struct __txn_recover_reply { + int status; + struct { + u_int txn_len; + u_int *txn_val; + } txn; + struct { + u_int gid_len; + char *gid_val; + } gid; + u_int retcount; +}; +typedef struct __txn_recover_reply __txn_recover_reply; + +struct __db_associate_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int sdbpcl_id; + u_int flags; +}; +typedef struct __db_associate_msg __db_associate_msg; + +struct __db_associate_reply { + int status; +}; +typedef struct __db_associate_reply __db_associate_reply; + +struct __db_bt_maxkey_msg { + u_int dbpcl_id; + u_int maxkey; +}; +typedef struct __db_bt_maxkey_msg __db_bt_maxkey_msg; + +struct __db_bt_maxkey_reply { + int status; +}; +typedef struct __db_bt_maxkey_reply __db_bt_maxkey_reply; + +struct __db_bt_minkey_msg { + u_int dbpcl_id; + u_int minkey; +}; +typedef struct __db_bt_minkey_msg __db_bt_minkey_msg; + +struct __db_bt_minkey_reply { + int status; +}; +typedef struct __db_bt_minkey_reply __db_bt_minkey_reply; + +struct __db_close_msg { + u_int dbpcl_id; + u_int flags; +}; +typedef struct __db_close_msg __db_close_msg; + +struct __db_close_reply { + int status; +}; +typedef struct __db_close_reply __db_close_reply; + +struct __db_create_msg { + u_int dbenvcl_id; + u_int flags; +}; +typedef struct __db_create_msg __db_create_msg; + +struct __db_create_reply { + int status; + u_int dbcl_id; +}; +typedef struct __db_create_reply __db_create_reply; + +struct __db_del_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int keydlen; + u_int keydoff; + u_int keyulen; + u_int keyflags; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + u_int flags; +}; +typedef struct __db_del_msg __db_del_msg; + +struct __db_del_reply { + int status; +}; +typedef struct __db_del_reply __db_del_reply; + +struct __db_encrypt_msg { + u_int dbpcl_id; + char *passwd; + u_int flags; +}; +typedef struct __db_encrypt_msg __db_encrypt_msg; + +struct __db_encrypt_reply { + int status; +}; +typedef struct __db_encrypt_reply __db_encrypt_reply; + +struct __db_extentsize_msg { + u_int dbpcl_id; + u_int extentsize; +}; +typedef struct __db_extentsize_msg __db_extentsize_msg; + +struct __db_extentsize_reply { + int status; +}; +typedef struct __db_extentsize_reply __db_extentsize_reply; + +struct __db_flags_msg { + u_int dbpcl_id; + u_int flags; +}; +typedef struct __db_flags_msg __db_flags_msg; + +struct __db_flags_reply { + int status; +}; +typedef struct __db_flags_reply __db_flags_reply; + +struct __db_get_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int keydlen; + u_int keydoff; + u_int keyulen; + u_int keyflags; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + u_int datadlen; + u_int datadoff; + u_int dataulen; + u_int dataflags; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; + u_int flags; +}; +typedef struct __db_get_msg __db_get_msg; + +struct __db_get_reply { + int status; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; +}; +typedef struct __db_get_reply __db_get_reply; + +struct __db_h_ffactor_msg { + u_int dbpcl_id; + u_int ffactor; +}; +typedef struct __db_h_ffactor_msg __db_h_ffactor_msg; + +struct __db_h_ffactor_reply { + int status; +}; +typedef struct __db_h_ffactor_reply __db_h_ffactor_reply; + +struct __db_h_nelem_msg { + u_int dbpcl_id; + u_int nelem; +}; +typedef struct __db_h_nelem_msg __db_h_nelem_msg; + +struct __db_h_nelem_reply { + int status; +}; +typedef struct __db_h_nelem_reply __db_h_nelem_reply; + +struct __db_key_range_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int keydlen; + u_int keydoff; + u_int keyulen; + u_int keyflags; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + u_int flags; +}; +typedef struct __db_key_range_msg __db_key_range_msg; + +struct __db_key_range_reply { + int status; + double less; + double equal; + double greater; +}; +typedef struct __db_key_range_reply __db_key_range_reply; + +struct __db_lorder_msg { + u_int dbpcl_id; + u_int lorder; +}; +typedef struct __db_lorder_msg __db_lorder_msg; + +struct __db_lorder_reply { + int status; +}; +typedef struct __db_lorder_reply __db_lorder_reply; + +struct __db_open_msg { + u_int dbpcl_id; + u_int txnpcl_id; + char *name; + char *subdb; + u_int type; + u_int flags; + u_int mode; +}; +typedef struct __db_open_msg __db_open_msg; + +struct __db_open_reply { + int status; + u_int dbcl_id; + u_int type; + u_int dbflags; + u_int lorder; +}; +typedef struct __db_open_reply __db_open_reply; + +struct __db_pagesize_msg { + u_int dbpcl_id; + u_int pagesize; +}; +typedef struct __db_pagesize_msg __db_pagesize_msg; + +struct __db_pagesize_reply { + int status; +}; +typedef struct __db_pagesize_reply __db_pagesize_reply; + +struct __db_pget_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int skeydlen; + u_int skeydoff; + u_int skeyulen; + u_int skeyflags; + struct { + u_int skeydata_len; + char *skeydata_val; + } skeydata; + u_int pkeydlen; + u_int pkeydoff; + u_int pkeyulen; + u_int pkeyflags; + struct { + u_int pkeydata_len; + char *pkeydata_val; + } pkeydata; + u_int datadlen; + u_int datadoff; + u_int dataulen; + u_int dataflags; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; + u_int flags; +}; +typedef struct __db_pget_msg __db_pget_msg; + +struct __db_pget_reply { + int status; + struct { + u_int skeydata_len; + char *skeydata_val; + } skeydata; + struct { + u_int pkeydata_len; + char *pkeydata_val; + } pkeydata; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; +}; +typedef struct __db_pget_reply __db_pget_reply; + +struct __db_put_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int keydlen; + u_int keydoff; + u_int keyulen; + u_int keyflags; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + u_int datadlen; + u_int datadoff; + u_int dataulen; + u_int dataflags; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; + u_int flags; +}; +typedef struct __db_put_msg __db_put_msg; + +struct __db_put_reply { + int status; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; +}; +typedef struct __db_put_reply __db_put_reply; + +struct __db_re_delim_msg { + u_int dbpcl_id; + u_int delim; +}; +typedef struct __db_re_delim_msg __db_re_delim_msg; + +struct __db_re_delim_reply { + int status; +}; +typedef struct __db_re_delim_reply __db_re_delim_reply; + +struct __db_re_len_msg { + u_int dbpcl_id; + u_int len; +}; +typedef struct __db_re_len_msg __db_re_len_msg; + +struct __db_re_len_reply { + int status; +}; +typedef struct __db_re_len_reply __db_re_len_reply; + +struct __db_re_pad_msg { + u_int dbpcl_id; + u_int pad; +}; +typedef struct __db_re_pad_msg __db_re_pad_msg; + +struct __db_re_pad_reply { + int status; +}; +typedef struct __db_re_pad_reply __db_re_pad_reply; + +struct __db_remove_msg { + u_int dbpcl_id; + char *name; + char *subdb; + u_int flags; +}; +typedef struct __db_remove_msg __db_remove_msg; + +struct __db_remove_reply { + int status; +}; +typedef struct __db_remove_reply __db_remove_reply; + +struct __db_rename_msg { + u_int dbpcl_id; + char *name; + char *subdb; + char *newname; + u_int flags; +}; +typedef struct __db_rename_msg __db_rename_msg; + +struct __db_rename_reply { + int status; +}; +typedef struct __db_rename_reply __db_rename_reply; + +struct __db_stat_msg { + u_int dbpcl_id; + u_int flags; +}; +typedef struct __db_stat_msg __db_stat_msg; + +struct __db_stat_reply { + int status; + struct { + u_int stats_len; + u_int *stats_val; + } stats; +}; +typedef struct __db_stat_reply __db_stat_reply; + +struct __db_sync_msg { + u_int dbpcl_id; + u_int flags; +}; +typedef struct __db_sync_msg __db_sync_msg; + +struct __db_sync_reply { + int status; +}; +typedef struct __db_sync_reply __db_sync_reply; + +struct __db_truncate_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int flags; +}; +typedef struct __db_truncate_msg __db_truncate_msg; + +struct __db_truncate_reply { + int status; + u_int count; +}; +typedef struct __db_truncate_reply __db_truncate_reply; + +struct __db_cursor_msg { + u_int dbpcl_id; + u_int txnpcl_id; + u_int flags; +}; +typedef struct __db_cursor_msg __db_cursor_msg; + +struct __db_cursor_reply { + int status; + u_int dbcidcl_id; +}; +typedef struct __db_cursor_reply __db_cursor_reply; + +struct __db_join_msg { + u_int dbpcl_id; + struct { + u_int curs_len; + u_int *curs_val; + } curs; + u_int flags; +}; +typedef struct __db_join_msg __db_join_msg; + +struct __db_join_reply { + int status; + u_int dbcidcl_id; +}; +typedef struct __db_join_reply __db_join_reply; + +struct __dbc_close_msg { + u_int dbccl_id; +}; +typedef struct __dbc_close_msg __dbc_close_msg; + +struct __dbc_close_reply { + int status; +}; +typedef struct __dbc_close_reply __dbc_close_reply; + +struct __dbc_count_msg { + u_int dbccl_id; + u_int flags; +}; +typedef struct __dbc_count_msg __dbc_count_msg; + +struct __dbc_count_reply { + int status; + u_int dupcount; +}; +typedef struct __dbc_count_reply __dbc_count_reply; + +struct __dbc_del_msg { + u_int dbccl_id; + u_int flags; +}; +typedef struct __dbc_del_msg __dbc_del_msg; + +struct __dbc_del_reply { + int status; +}; +typedef struct __dbc_del_reply __dbc_del_reply; + +struct __dbc_dup_msg { + u_int dbccl_id; + u_int flags; +}; +typedef struct __dbc_dup_msg __dbc_dup_msg; + +struct __dbc_dup_reply { + int status; + u_int dbcidcl_id; +}; +typedef struct __dbc_dup_reply __dbc_dup_reply; + +struct __dbc_get_msg { + u_int dbccl_id; + u_int keydlen; + u_int keydoff; + u_int keyulen; + u_int keyflags; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + u_int datadlen; + u_int datadoff; + u_int dataulen; + u_int dataflags; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; + u_int flags; +}; +typedef struct __dbc_get_msg __dbc_get_msg; + +struct __dbc_get_reply { + int status; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; +}; +typedef struct __dbc_get_reply __dbc_get_reply; + +struct __dbc_pget_msg { + u_int dbccl_id; + u_int skeydlen; + u_int skeydoff; + u_int skeyulen; + u_int skeyflags; + struct { + u_int skeydata_len; + char *skeydata_val; + } skeydata; + u_int pkeydlen; + u_int pkeydoff; + u_int pkeyulen; + u_int pkeyflags; + struct { + u_int pkeydata_len; + char *pkeydata_val; + } pkeydata; + u_int datadlen; + u_int datadoff; + u_int dataulen; + u_int dataflags; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; + u_int flags; +}; +typedef struct __dbc_pget_msg __dbc_pget_msg; + +struct __dbc_pget_reply { + int status; + struct { + u_int skeydata_len; + char *skeydata_val; + } skeydata; + struct { + u_int pkeydata_len; + char *pkeydata_val; + } pkeydata; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; +}; +typedef struct __dbc_pget_reply __dbc_pget_reply; + +struct __dbc_put_msg { + u_int dbccl_id; + u_int keydlen; + u_int keydoff; + u_int keyulen; + u_int keyflags; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; + u_int datadlen; + u_int datadoff; + u_int dataulen; + u_int dataflags; + struct { + u_int datadata_len; + char *datadata_val; + } datadata; + u_int flags; +}; +typedef struct __dbc_put_msg __dbc_put_msg; + +struct __dbc_put_reply { + int status; + struct { + u_int keydata_len; + char *keydata_val; + } keydata; +}; +typedef struct __dbc_put_reply __dbc_put_reply; + +#define __DB_env_cachesize ((unsigned long)(1)) +extern __env_cachesize_reply * __db_env_cachesize_4001(); +#define __DB_env_close ((unsigned long)(2)) +extern __env_close_reply * __db_env_close_4001(); +#define __DB_env_create ((unsigned long)(3)) +extern __env_create_reply * __db_env_create_4001(); +#define __DB_env_dbremove ((unsigned long)(4)) +extern __env_dbremove_reply * __db_env_dbremove_4001(); +#define __DB_env_dbrename ((unsigned long)(5)) +extern __env_dbrename_reply * __db_env_dbrename_4001(); +#define __DB_env_encrypt ((unsigned long)(6)) +extern __env_encrypt_reply * __db_env_encrypt_4001(); +#define __DB_env_flags ((unsigned long)(7)) +extern __env_flags_reply * __db_env_flags_4001(); +#define __DB_env_open ((unsigned long)(8)) +extern __env_open_reply * __db_env_open_4001(); +#define __DB_env_remove ((unsigned long)(9)) +extern __env_remove_reply * __db_env_remove_4001(); +#define __DB_txn_abort ((unsigned long)(10)) +extern __txn_abort_reply * __db_txn_abort_4001(); +#define __DB_txn_begin ((unsigned long)(11)) +extern __txn_begin_reply * __db_txn_begin_4001(); +#define __DB_txn_commit ((unsigned long)(12)) +extern __txn_commit_reply * __db_txn_commit_4001(); +#define __DB_txn_discard ((unsigned long)(13)) +extern __txn_discard_reply * __db_txn_discard_4001(); +#define __DB_txn_prepare ((unsigned long)(14)) +extern __txn_prepare_reply * __db_txn_prepare_4001(); +#define __DB_txn_recover ((unsigned long)(15)) +extern __txn_recover_reply * __db_txn_recover_4001(); +#define __DB_db_associate ((unsigned long)(16)) +extern __db_associate_reply * __db_db_associate_4001(); +#define __DB_db_bt_maxkey ((unsigned long)(17)) +extern __db_bt_maxkey_reply * __db_db_bt_maxkey_4001(); +#define __DB_db_bt_minkey ((unsigned long)(18)) +extern __db_bt_minkey_reply * __db_db_bt_minkey_4001(); +#define __DB_db_close ((unsigned long)(19)) +extern __db_close_reply * __db_db_close_4001(); +#define __DB_db_create ((unsigned long)(20)) +extern __db_create_reply * __db_db_create_4001(); +#define __DB_db_del ((unsigned long)(21)) +extern __db_del_reply * __db_db_del_4001(); +#define __DB_db_encrypt ((unsigned long)(22)) +extern __db_encrypt_reply * __db_db_encrypt_4001(); +#define __DB_db_extentsize ((unsigned long)(23)) +extern __db_extentsize_reply * __db_db_extentsize_4001(); +#define __DB_db_flags ((unsigned long)(24)) +extern __db_flags_reply * __db_db_flags_4001(); +#define __DB_db_get ((unsigned long)(25)) +extern __db_get_reply * __db_db_get_4001(); +#define __DB_db_h_ffactor ((unsigned long)(26)) +extern __db_h_ffactor_reply * __db_db_h_ffactor_4001(); +#define __DB_db_h_nelem ((unsigned long)(27)) +extern __db_h_nelem_reply * __db_db_h_nelem_4001(); +#define __DB_db_key_range ((unsigned long)(28)) +extern __db_key_range_reply * __db_db_key_range_4001(); +#define __DB_db_lorder ((unsigned long)(29)) +extern __db_lorder_reply * __db_db_lorder_4001(); +#define __DB_db_open ((unsigned long)(30)) +extern __db_open_reply * __db_db_open_4001(); +#define __DB_db_pagesize ((unsigned long)(31)) +extern __db_pagesize_reply * __db_db_pagesize_4001(); +#define __DB_db_pget ((unsigned long)(32)) +extern __db_pget_reply * __db_db_pget_4001(); +#define __DB_db_put ((unsigned long)(33)) +extern __db_put_reply * __db_db_put_4001(); +#define __DB_db_re_delim ((unsigned long)(34)) +extern __db_re_delim_reply * __db_db_re_delim_4001(); +#define __DB_db_re_len ((unsigned long)(35)) +extern __db_re_len_reply * __db_db_re_len_4001(); +#define __DB_db_re_pad ((unsigned long)(36)) +extern __db_re_pad_reply * __db_db_re_pad_4001(); +#define __DB_db_remove ((unsigned long)(37)) +extern __db_remove_reply * __db_db_remove_4001(); +#define __DB_db_rename ((unsigned long)(38)) +extern __db_rename_reply * __db_db_rename_4001(); +#define __DB_db_stat ((unsigned long)(39)) +extern __db_stat_reply * __db_db_stat_4001(); +#define __DB_db_sync ((unsigned long)(40)) +extern __db_sync_reply * __db_db_sync_4001(); +#define __DB_db_truncate ((unsigned long)(41)) +extern __db_truncate_reply * __db_db_truncate_4001(); +#define __DB_db_cursor ((unsigned long)(42)) +extern __db_cursor_reply * __db_db_cursor_4001(); +#define __DB_db_join ((unsigned long)(43)) +extern __db_join_reply * __db_db_join_4001(); +#define __DB_dbc_close ((unsigned long)(44)) +extern __dbc_close_reply * __db_dbc_close_4001(); +#define __DB_dbc_count ((unsigned long)(45)) +extern __dbc_count_reply * __db_dbc_count_4001(); +#define __DB_dbc_del ((unsigned long)(46)) +extern __dbc_del_reply * __db_dbc_del_4001(); +#define __DB_dbc_dup ((unsigned long)(47)) +extern __dbc_dup_reply * __db_dbc_dup_4001(); +#define __DB_dbc_get ((unsigned long)(48)) +extern __dbc_get_reply * __db_dbc_get_4001(); +#define __DB_dbc_pget ((unsigned long)(49)) +extern __dbc_pget_reply * __db_dbc_pget_4001(); +#define __DB_dbc_put ((unsigned long)(50)) +extern __dbc_put_reply * __db_dbc_put_4001(); +extern int db_rpc_serverprog_4001_freeresult(); + +/* the xdr functions */ +extern bool_t xdr___env_cachesize_msg(); +extern bool_t xdr___env_cachesize_reply(); +extern bool_t xdr___env_close_msg(); +extern bool_t xdr___env_close_reply(); +extern bool_t xdr___env_create_msg(); +extern bool_t xdr___env_create_reply(); +extern bool_t xdr___env_dbremove_msg(); +extern bool_t xdr___env_dbremove_reply(); +extern bool_t xdr___env_dbrename_msg(); +extern bool_t xdr___env_dbrename_reply(); +extern bool_t xdr___env_encrypt_msg(); +extern bool_t xdr___env_encrypt_reply(); +extern bool_t xdr___env_flags_msg(); +extern bool_t xdr___env_flags_reply(); +extern bool_t xdr___env_open_msg(); +extern bool_t xdr___env_open_reply(); +extern bool_t xdr___env_remove_msg(); +extern bool_t xdr___env_remove_reply(); +extern bool_t xdr___txn_abort_msg(); +extern bool_t xdr___txn_abort_reply(); +extern bool_t xdr___txn_begin_msg(); +extern bool_t xdr___txn_begin_reply(); +extern bool_t xdr___txn_commit_msg(); +extern bool_t xdr___txn_commit_reply(); +extern bool_t xdr___txn_discard_msg(); +extern bool_t xdr___txn_discard_reply(); +extern bool_t xdr___txn_prepare_msg(); +extern bool_t xdr___txn_prepare_reply(); +extern bool_t xdr___txn_recover_msg(); +extern bool_t xdr___txn_recover_reply(); +extern bool_t xdr___db_associate_msg(); +extern bool_t xdr___db_associate_reply(); +extern bool_t xdr___db_bt_maxkey_msg(); +extern bool_t xdr___db_bt_maxkey_reply(); +extern bool_t xdr___db_bt_minkey_msg(); +extern bool_t xdr___db_bt_minkey_reply(); +extern bool_t xdr___db_close_msg(); +extern bool_t xdr___db_close_reply(); +extern bool_t xdr___db_create_msg(); +extern bool_t xdr___db_create_reply(); +extern bool_t xdr___db_del_msg(); +extern bool_t xdr___db_del_reply(); +extern bool_t xdr___db_encrypt_msg(); +extern bool_t xdr___db_encrypt_reply(); +extern bool_t xdr___db_extentsize_msg(); +extern bool_t xdr___db_extentsize_reply(); +extern bool_t xdr___db_flags_msg(); +extern bool_t xdr___db_flags_reply(); +extern bool_t xdr___db_get_msg(); +extern bool_t xdr___db_get_reply(); +extern bool_t xdr___db_h_ffactor_msg(); +extern bool_t xdr___db_h_ffactor_reply(); +extern bool_t xdr___db_h_nelem_msg(); +extern bool_t xdr___db_h_nelem_reply(); +extern bool_t xdr___db_key_range_msg(); +extern bool_t xdr___db_key_range_reply(); +extern bool_t xdr___db_lorder_msg(); +extern bool_t xdr___db_lorder_reply(); +extern bool_t xdr___db_open_msg(); +extern bool_t xdr___db_open_reply(); +extern bool_t xdr___db_pagesize_msg(); +extern bool_t xdr___db_pagesize_reply(); +extern bool_t xdr___db_pget_msg(); +extern bool_t xdr___db_pget_reply(); +extern bool_t xdr___db_put_msg(); +extern bool_t xdr___db_put_reply(); +extern bool_t xdr___db_re_delim_msg(); +extern bool_t xdr___db_re_delim_reply(); +extern bool_t xdr___db_re_len_msg(); +extern bool_t xdr___db_re_len_reply(); +extern bool_t xdr___db_re_pad_msg(); +extern bool_t xdr___db_re_pad_reply(); +extern bool_t xdr___db_remove_msg(); +extern bool_t xdr___db_remove_reply(); +extern bool_t xdr___db_rename_msg(); +extern bool_t xdr___db_rename_reply(); +extern bool_t xdr___db_stat_msg(); +extern bool_t xdr___db_stat_reply(); +extern bool_t xdr___db_sync_msg(); +extern bool_t xdr___db_sync_reply(); +extern bool_t xdr___db_truncate_msg(); +extern bool_t xdr___db_truncate_reply(); +extern bool_t xdr___db_cursor_msg(); +extern bool_t xdr___db_cursor_reply(); +extern bool_t xdr___db_join_msg(); +extern bool_t xdr___db_join_reply(); +extern bool_t xdr___dbc_close_msg(); +extern bool_t xdr___dbc_close_reply(); +extern bool_t xdr___dbc_count_msg(); +extern bool_t xdr___dbc_count_reply(); +extern bool_t xdr___dbc_del_msg(); +extern bool_t xdr___dbc_del_reply(); +extern bool_t xdr___dbc_dup_msg(); +extern bool_t xdr___dbc_dup_reply(); +extern bool_t xdr___dbc_get_msg(); +extern bool_t xdr___dbc_get_reply(); +extern bool_t xdr___dbc_pget_msg(); +extern bool_t xdr___dbc_pget_reply(); +extern bool_t xdr___dbc_put_msg(); +extern bool_t xdr___dbc_put_reply(); + +#endif /* !_DB_SERVER_H_RPCGEN */ diff --git a/db/dbinc_auto/dbreg_auto.h b/db/dbinc_auto/dbreg_auto.h new file mode 100644 index 000000000..4d7d4a91b --- /dev/null +++ b/db/dbinc_auto/dbreg_auto.h @@ -0,0 +1,19 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __dbreg_AUTO_H +#define __dbreg_AUTO_H +#define DB___dbreg_register 2 +typedef struct ___dbreg_register_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + DBT name; + DBT uid; + int32_t fileid; + DBTYPE ftype; + db_pgno_t meta_pgno; + u_int32_t id; +} __dbreg_register_args; + +#endif diff --git a/db/dbinc_auto/dbreg_ext.h b/db/dbinc_auto/dbreg_ext.h new file mode 100644 index 000000000..41020a386 --- /dev/null +++ b/db/dbinc_auto/dbreg_ext.h @@ -0,0 +1,40 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _dbreg_ext_h_ +#define _dbreg_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __dbreg_setup __P((DB *, const char *, u_int32_t)); +int __dbreg_teardown __P((DB *)); +int __dbreg_new_id __P((DB *, DB_TXN *)); +int __dbreg_assign_id __P((DB *, int32_t)); +int __dbreg_revoke_id __P((DB *, int)); +int __dbreg_close_id __P((DB *, DB_TXN *)); +int __dbreg_register_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, const DBT *, const DBT *, int32_t, DBTYPE, db_pgno_t, u_int32_t)); +int __dbreg_register_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __dbreg_register_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __dbreg_register_read __P((DB_ENV *, void *, __dbreg_register_args **)); +int __dbreg_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __dbreg_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __dbreg_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __dbreg_register_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __dbreg_add_dbentry __P((DB_ENV *, DB_LOG *, DB *, int32_t)); +void __dbreg_rem_dbentry __P((DB_LOG *, int32_t)); +int __dbreg_open_files __P((DB_ENV *)); +int __dbreg_close_files __P((DB_ENV *)); +int __dbreg_id_to_db __P((DB_ENV *, DB_TXN *, DB **, int32_t, int)); +int __dbreg_id_to_fname __P((DB_LOG *, int32_t, int, FNAME **)); +int __dbreg_fid_to_fname __P((DB_LOG *, u_int8_t *, int, FNAME **)); +int __dbreg_get_name __P((DB_ENV *, u_int8_t *, char **)); +int __dbreg_do_open __P((DB_ENV *, DB_TXN *, DB_LOG *, u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t, void *, u_int32_t)); +int __dbreg_lazy_id __P((DB *)); +int __dbreg_push_id __P((DB_ENV *, int32_t)); +int __dbreg_pop_id __P((DB_ENV *, int32_t *)); +int __dbreg_pluck_id __P((DB_ENV *, int32_t)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_dbreg_ext_h_ */ diff --git a/db/dbinc_auto/env_ext.h b/db/dbinc_auto/env_ext.h new file mode 100644 index 000000000..4bd0eee4a --- /dev/null +++ b/db/dbinc_auto/env_ext.h @@ -0,0 +1,39 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _env_ext_h_ +#define _env_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +void __db_shalloc_init __P((void *, size_t)); +int __db_shalloc_size __P((size_t, size_t)); +int __db_shalloc __P((void *, size_t, size_t, void *)); +void __db_shalloc_free __P((void *, void *)); +size_t __db_shsizeof __P((void *)); +void __db_shalloc_dump __P((void *, FILE *)); +int __db_tablesize __P((u_int32_t)); +void __db_hashinit __P((void *, u_int32_t)); +int __db_fileinit __P((DB_ENV *, DB_FH *, size_t, int)); +int __db_overwrite __P((DB_ENV *, const char *)); +int __db_mi_env __P((DB_ENV *, const char *)); +int __db_mi_open __P((DB_ENV *, const char *, int)); +int __db_env_config __P((DB_ENV *, char *, u_int32_t)); +int __dbenv_open __P((DB_ENV *, const char *, u_int32_t, int)); +int __dbenv_remove __P((DB_ENV *, const char *, u_int32_t)); +int __dbenv_close __P((DB_ENV *, u_int32_t)); +int __db_appname __P((DB_ENV *, APPNAME, const char *, u_int32_t, DB_FH *, char **)); +int __db_home __P((DB_ENV *, const char *, u_int32_t)); +int __db_apprec __P((DB_ENV *, DB_LSN *, u_int32_t)); +int __env_openfiles __P((DB_ENV *, DB_LOGC *, void *, DBT *, DB_LSN *, DB_LSN *, double, int)); +int __db_e_attach __P((DB_ENV *, u_int32_t *)); +int __db_e_detach __P((DB_ENV *, int)); +int __db_e_remove __P((DB_ENV *, u_int32_t)); +int __db_e_stat __P((DB_ENV *, REGENV *, REGION *, int *, u_int32_t)); +int __db_r_attach __P((DB_ENV *, REGINFO *, size_t)); +int __db_r_detach __P((DB_ENV *, REGINFO *, int)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_env_ext_h_ */ diff --git a/db/dbinc_auto/ext_185_def.in b/db/dbinc_auto/ext_185_def.in new file mode 100644 index 000000000..8da68a8df --- /dev/null +++ b/db/dbinc_auto/ext_185_def.in @@ -0,0 +1,12 @@ + +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _DB_EXT_185_DEF_IN_ +#define _DB_EXT_185_DEF_IN_ + +#ifdef _DB185_INT_H_ +#define __db185_open __db185_open@DB_VERSION_UNIQUE_NAME@ +#else +#define __db185_open __db185_open@DB_VERSION_UNIQUE_NAME@ +#endif + +#endif /* !_DB_EXT_185_DEF_IN_ */ diff --git a/db/dbinc_auto/ext_185_prot.in b/db/dbinc_auto/ext_185_prot.in new file mode 100644 index 000000000..dfd8d3d47 --- /dev/null +++ b/db/dbinc_auto/ext_185_prot.in @@ -0,0 +1,19 @@ + +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _DB_EXT_185_PROT_IN_ +#define _DB_EXT_185_PROT_IN_ + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifdef _DB185_INT_H_ +DB185 *__db185_open __P((const char *, int, int, DBTYPE, const void *)); +#else +DB *__db185_open __P((const char *, int, int, DBTYPE, const void *)); +#endif + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_EXT_185_PROT_IN_ */ diff --git a/db/dbinc_auto/ext_def.in b/db/dbinc_auto/ext_def.in new file mode 100644 index 000000000..f4a48371e --- /dev/null +++ b/db/dbinc_auto/ext_def.in @@ -0,0 +1,63 @@ + +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _DB_EXT_DEF_IN_ +#define _DB_EXT_DEF_IN_ + +#define db_create db_create@DB_VERSION_UNIQUE_NAME@ +#define db_strerror db_strerror@DB_VERSION_UNIQUE_NAME@ +#define db_env_create db_env_create@DB_VERSION_UNIQUE_NAME@ +#define db_version db_version@DB_VERSION_UNIQUE_NAME@ +#define log_compare log_compare@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_close db_env_set_func_close@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_dirfree db_env_set_func_dirfree@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_dirlist db_env_set_func_dirlist@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_exists db_env_set_func_exists@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_free db_env_set_func_free@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_fsync db_env_set_func_fsync@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_ioinfo db_env_set_func_ioinfo@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_malloc db_env_set_func_malloc@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_map db_env_set_func_map@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_open db_env_set_func_open@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_read db_env_set_func_read@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_realloc db_env_set_func_realloc@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_rename db_env_set_func_rename@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_seek db_env_set_func_seek@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_sleep db_env_set_func_sleep@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_unlink db_env_set_func_unlink@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_unmap db_env_set_func_unmap@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_write db_env_set_func_write@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_func_yield db_env_set_func_yield@DB_VERSION_UNIQUE_NAME@ +#define db_env_xa_attach db_env_xa_attach@DB_VERSION_UNIQUE_NAME@ +#define db_env_set_thread_func db_env_set_thread_func@DB_VERSION_UNIQUE_NAME@ +#if DB_DBM_HSEARCH != 0 +#define __db_ndbm_clearerr __db_ndbm_clearerr@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_close __db_ndbm_close@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_delete __db_ndbm_delete@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_dirfno __db_ndbm_dirfno@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_error __db_ndbm_error@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_fetch __db_ndbm_fetch@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_firstkey __db_ndbm_firstkey@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_nextkey __db_ndbm_nextkey@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_open __db_ndbm_open@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_pagfno __db_ndbm_pagfno@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_rdonly __db_ndbm_rdonly@DB_VERSION_UNIQUE_NAME@ +#define __db_ndbm_store __db_ndbm_store@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_close __db_dbm_close@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_dbrdonly __db_dbm_dbrdonly@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_delete __db_dbm_delete@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_dirf __db_dbm_dirf@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_fetch __db_dbm_fetch@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_firstkey __db_dbm_firstkey@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_init __db_dbm_init@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_nextkey __db_dbm_nextkey@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_pagf __db_dbm_pagf@DB_VERSION_UNIQUE_NAME@ +#define __db_dbm_store __db_dbm_store@DB_VERSION_UNIQUE_NAME@ +#endif +#if DB_DBM_HSEARCH != 0 +#define __db_hcreate __db_hcreate@DB_VERSION_UNIQUE_NAME@ +#define __db_hsearch __db_hsearch@DB_VERSION_UNIQUE_NAME@ +#define __db_hdestroy __db_hdestroy@DB_VERSION_UNIQUE_NAME@ +#endif +#define db_xa_switch db_xa_switch@DB_VERSION_UNIQUE_NAME@ + +#endif /* !_DB_EXT_DEF_IN_ */ diff --git a/db/dbinc_auto/ext_prot.in b/db/dbinc_auto/ext_prot.in new file mode 100644 index 000000000..b7ede6d22 --- /dev/null +++ b/db/dbinc_auto/ext_prot.in @@ -0,0 +1,72 @@ + +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _DB_EXT_PROT_IN_ +#define _DB_EXT_PROT_IN_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int db_create __P((DB **, DB_ENV *, u_int32_t)); +char *db_strerror __P((int)); +int db_env_create __P((DB_ENV **, u_int32_t)); +char *db_version __P((int *, int *, int *)); +int log_compare __P((const DB_LSN *, const DB_LSN *)); +int db_env_set_func_close __P((int (*)(int))); +int db_env_set_func_dirfree __P((void (*)(char **, int))); +int db_env_set_func_dirlist __P((int (*)(const char *, char ***, int *))); +int db_env_set_func_exists __P((int (*)(const char *, int *))); +int db_env_set_func_free __P((void (*)(void *))); +int db_env_set_func_fsync __P((int (*)(int))); +int db_env_set_func_ioinfo __P((int (*)(const char *, int, u_int32_t *, u_int32_t *, u_int32_t *))); +int db_env_set_func_malloc __P((void *(*)(size_t))); +int db_env_set_func_map __P((int (*)(char *, size_t, int, int, void **))); +int db_env_set_func_open __P((int (*)(const char *, int, ...))); +int db_env_set_func_read __P((ssize_t (*)(int, void *, size_t))); +int db_env_set_func_realloc __P((void *(*)(void *, size_t))); +int db_env_set_func_rename __P((int (*)(const char *, const char *))); +int db_env_set_func_seek __P((int (*)(int, size_t, db_pgno_t, u_int32_t, int, int))); +int db_env_set_func_sleep __P((int (*)(u_long, u_long))); +int db_env_set_func_unlink __P((int (*)(const char *))); +int db_env_set_func_unmap __P((int (*)(void *, size_t))); +int db_env_set_func_write __P((ssize_t (*)(int, const void *, size_t))); +int db_env_set_func_yield __P((int (*)(void))); +int txn_abort __P((DB_TXN *)); +int txn_begin __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)); +int txn_commit __P((DB_TXN *, u_int32_t)); +int db_env_xa_attach __P((int *, void *, DB_ENV **, DB_TXN **)); +int db_env_set_thread_func __P((int (*)(void **), int (*)(void *, void *), int (*)(void *), size_t)); +#if DB_DBM_HSEARCH != 0 +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)); +int __db_dbm_close __P((void)); +int __db_dbm_dbrdonly __P((void)); +int __db_dbm_delete __P((datum)); +int __db_dbm_dirf __P((void)); +datum __db_dbm_fetch __P((datum)); +datum __db_dbm_firstkey __P((void)); +int __db_dbm_init __P((char *)); +datum __db_dbm_nextkey __P((datum)); +int __db_dbm_pagf __P((void)); +int __db_dbm_store __P((datum, datum)); +#endif +#if DB_DBM_HSEARCH != 0 +int __db_hcreate __P((size_t)); +ENTRY *__db_hsearch __P((ENTRY, ACTION)); +void __db_hdestroy __P((void)); +#endif + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_EXT_PROT_IN_ */ diff --git a/db/dbinc_auto/fileops_auto.h b/db/dbinc_auto/fileops_auto.h new file mode 100644 index 000000000..ee1f58616 --- /dev/null +++ b/db/dbinc_auto/fileops_auto.h @@ -0,0 +1,60 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __fop_AUTO_H +#define __fop_AUTO_H +#define DB___fop_create 143 +typedef struct ___fop_create_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT name; + u_int32_t appname; + u_int32_t mode; +} __fop_create_args; + +#define DB___fop_remove 144 +typedef struct ___fop_remove_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT name; + DBT fid; + u_int32_t appname; +} __fop_remove_args; + +#define DB___fop_write 145 +typedef struct ___fop_write_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT name; + u_int32_t appname; + u_int32_t offset; + DBT page; + u_int32_t flag; +} __fop_write_args; + +#define DB___fop_rename 146 +typedef struct ___fop_rename_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT oldname; + DBT newname; + DBT fileid; + u_int32_t appname; +} __fop_rename_args; + +#define DB___fop_file_remove 141 +typedef struct ___fop_file_remove_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT real_fid; + DBT tmp_fid; + DBT name; + u_int32_t appname; + u_int32_t child; +} __fop_file_remove_args; + +#endif diff --git a/db/dbinc_auto/fileops_ext.h b/db/dbinc_auto/fileops_ext.h new file mode 100644 index 000000000..66d80e60a --- /dev/null +++ b/db/dbinc_auto/fileops_ext.h @@ -0,0 +1,52 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _fileops_ext_h_ +#define _fileops_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __fop_create_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *, u_int32_t, u_int32_t)); +int __fop_create_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_create_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_create_read __P((DB_ENV *, void *, __fop_create_args **)); +int __fop_remove_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *, const DBT *, u_int32_t)); +int __fop_remove_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_remove_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_remove_read __P((DB_ENV *, void *, __fop_remove_args **)); +int __fop_write_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *, u_int32_t, u_int32_t, const DBT *, u_int32_t)); +int __fop_write_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_write_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_write_read __P((DB_ENV *, void *, __fop_write_args **)); +int __fop_rename_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *, const DBT *, const DBT *, u_int32_t)); +int __fop_rename_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_rename_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_rename_read __P((DB_ENV *, void *, __fop_rename_args **)); +int __fop_file_remove_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *, const DBT *, const DBT *, u_int32_t, u_int32_t)); +int __fop_file_remove_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_file_remove_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_file_remove_read __P((DB_ENV *, void *, __fop_file_remove_args **)); +int __fop_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __fop_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __fop_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __fop_create __P((DB_ENV *, DB_TXN *, DB_FH *, const char *, APPNAME, int)); +int __fop_remove __P((DB_ENV *, DB_TXN *, u_int8_t *, const char *, APPNAME)); +int __fop_write __P((DB_ENV *, DB_TXN *, const char *, APPNAME, DB_FH *, u_int32_t, u_int8_t *, u_int32_t, u_int32_t)); +int __fop_rename __P((DB_ENV *, DB_TXN *, const char *, const char *, u_int8_t *, APPNAME)); +int __fop_create_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_remove_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_write_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_rename_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_file_remove_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __fop_lock_handle __P((DB_ENV *, DB *, u_int32_t, db_lockmode_t, DB_LOCK *, u_int32_t)); +int __fop_file_setup __P((DB *, DB_TXN *, const char *, int, u_int32_t, u_int32_t *)); +int __fop_subdb_setup __P((DB *, DB_TXN *, const char *, const char *, int, u_int32_t)); +int __fop_remove_setup __P((DB *, DB_TXN *, const char *, u_int32_t)); +int __fop_read_meta __P((DB_ENV *, const char *, u_int8_t *, size_t, DB_FH *, int, u_int32_t)); +int __fop_dummy __P((DB *, DB_TXN *, const char *, const char *, u_int32_t)); +int __fop_dbrename __P((DB *, const char *, const char *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_fileops_ext_h_ */ diff --git a/db/dbinc_auto/hash_auto.h b/db/dbinc_auto/hash_auto.h new file mode 100644 index 000000000..7ec3fb7ef --- /dev/null +++ b/db/dbinc_auto/hash_auto.h @@ -0,0 +1,132 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __ham_AUTO_H +#define __ham_AUTO_H +#define DB___ham_insdel 21 +typedef struct ___ham_insdel_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t fileid; + db_pgno_t pgno; + u_int32_t ndx; + DB_LSN pagelsn; + DBT key; + DBT data; +} __ham_insdel_args; + +#define DB___ham_newpage 22 +typedef struct ___ham_newpage_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t fileid; + db_pgno_t prev_pgno; + DB_LSN prevlsn; + db_pgno_t new_pgno; + DB_LSN pagelsn; + db_pgno_t next_pgno; + DB_LSN nextlsn; +} __ham_newpage_args; + +#define DB___ham_splitdata 24 +typedef struct ___ham_splitdata_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + u_int32_t opcode; + db_pgno_t pgno; + DBT pageimage; + DB_LSN pagelsn; +} __ham_splitdata_args; + +#define DB___ham_replace 25 +typedef struct ___ham_replace_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + u_int32_t ndx; + DB_LSN pagelsn; + int32_t off; + DBT olditem; + DBT newitem; + u_int32_t makedup; +} __ham_replace_args; + +#define DB___ham_copypage 28 +typedef struct ___ham_copypage_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + 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; + +#define DB___ham_metagroup 29 +typedef struct ___ham_metagroup_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + u_int32_t bucket; + db_pgno_t mmpgno; + DB_LSN mmetalsn; + db_pgno_t mpgno; + DB_LSN metalsn; + db_pgno_t pgno; + DB_LSN pagelsn; + u_int32_t newalloc; +} __ham_metagroup_args; + +#define DB___ham_groupalloc 32 +typedef struct ___ham_groupalloc_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + DB_LSN meta_lsn; + db_pgno_t start_pgno; + u_int32_t num; + db_pgno_t free; +} __ham_groupalloc_args; + +#define DB___ham_curadj 33 +typedef struct ___ham_curadj_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_pgno_t pgno; + u_int32_t indx; + u_int32_t len; + u_int32_t dup_off; + int add; + int is_dup; + u_int32_t order; +} __ham_curadj_args; + +#define DB___ham_chgpg 34 +typedef struct ___ham_chgpg_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_ham_mode mode; + db_pgno_t old_pgno; + db_pgno_t new_pgno; + u_int32_t old_indx; + u_int32_t new_indx; +} __ham_chgpg_args; + +#endif diff --git a/db/dbinc_auto/hash_ext.h b/db/dbinc_auto/hash_ext.h new file mode 100644 index 000000000..1ee239870 --- /dev/null +++ b/db/dbinc_auto/hash_ext.h @@ -0,0 +1,125 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _hash_ext_h_ +#define _hash_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __ham_quick_delete __P((DBC *)); +int __ham_c_init __P((DBC *)); +int __ham_c_count __P((DBC *, db_recno_t *)); +int __ham_c_dup __P((DBC *, DBC *)); +u_int32_t __ham_call_hash __P((DBC *, u_int8_t *, int32_t)); +int __ham_init_dbt __P((DB_ENV *, DBT *, u_int32_t, void **, u_int32_t *)); +int __ham_c_update __P((DBC *, u_int32_t, int, int)); +int __ham_get_clist __P((DB *, db_pgno_t, u_int32_t, DBC ***)); +int __ham_insdel_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, const DBT *, const DBT *)); +int __ham_insdel_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_insdel_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_insdel_read __P((DB_ENV *, void *, __ham_insdel_args **)); +int __ham_newpage_log __P((DB *, 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 *)); +int __ham_newpage_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_newpage_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_newpage_read __P((DB_ENV *, void *, __ham_newpage_args **)); +int __ham_splitdata_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, db_pgno_t, const DBT *, DB_LSN *)); +int __ham_splitdata_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_splitdata_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_splitdata_read __P((DB_ENV *, void *, __ham_splitdata_args **)); +int __ham_replace_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, int32_t, const DBT *, const DBT *, u_int32_t)); +int __ham_replace_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_replace_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_replace_read __P((DB_ENV *, void *, __ham_replace_args **)); +int __ham_copypage_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, const DBT *)); +int __ham_copypage_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_copypage_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_copypage_read __P((DB_ENV *, void *, __ham_copypage_args **)); +int __ham_metagroup_log __P((DB *, 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 *, u_int32_t)); +int __ham_metagroup_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_metagroup_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_metagroup_read __P((DB_ENV *, void *, __ham_metagroup_args **)); +int __ham_groupalloc_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_pgno_t)); +int __ham_groupalloc_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_groupalloc_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_groupalloc_read __P((DB_ENV *, void *, __ham_groupalloc_args **)); +int __ham_curadj_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_pgno_t, u_int32_t, u_int32_t, u_int32_t, int, int, u_int32_t)); +int __ham_curadj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_curadj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_curadj_read __P((DB_ENV *, void *, __ham_curadj_args **)); +int __ham_chgpg_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_ham_mode, db_pgno_t, db_pgno_t, u_int32_t, u_int32_t)); +int __ham_chgpg_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_chgpg_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_chgpg_read __P((DB_ENV *, void *, __ham_chgpg_args **)); +int __ham_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __ham_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __ham_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __ham_pgin __P((DB_ENV *, DB *, db_pgno_t, void *, DBT *)); +int __ham_pgout __P((DB_ENV *, DB *, db_pgno_t, void *, DBT *)); +int __ham_mswap __P((void *)); +int __ham_add_dup __P((DBC *, DBT *, u_int32_t, db_pgno_t *)); +int __ham_dup_convert __P((DBC *)); +int __ham_make_dup __P((DB_ENV *, const DBT *, DBT *d, void **, u_int32_t *)); +void __ham_dsearch __P((DBC *, DBT *, u_int32_t *, int *, u_int32_t)); +void __ham_cprint __P((DBC *)); +u_int32_t __ham_func2 __P((DB *, const void *, u_int32_t)); +u_int32_t __ham_func3 __P((DB *, const void *, u_int32_t)); +u_int32_t __ham_func4 __P((DB *, const void *, u_int32_t)); +u_int32_t __ham_func5 __P((DB *, const void *, u_int32_t)); +u_int32_t __ham_test __P((DB *, const void *, u_int32_t)); +int __ham_get_meta __P((DBC *)); +int __ham_release_meta __P((DBC *)); +int __ham_dirty_meta __P((DBC *)); +int __ham_db_create __P((DB *)); +int __ham_db_close __P((DB *)); +int __ham_open __P((DB *, DB_TXN *, const char * name, db_pgno_t, u_int32_t)); +int __ham_metachk __P((DB *, const char *, HMETA *)); +int __ham_new_file __P((DB *, DB_TXN *, DB_FH *, const char *)); +int __ham_new_subdb __P((DB *, DB *, DB_TXN *)); +int __ham_item __P((DBC *, db_lockmode_t, db_pgno_t *)); +int __ham_item_reset __P((DBC *)); +void __ham_item_init __P((DBC *)); +int __ham_item_last __P((DBC *, db_lockmode_t, db_pgno_t *)); +int __ham_item_first __P((DBC *, db_lockmode_t, db_pgno_t *)); +int __ham_item_prev __P((DBC *, db_lockmode_t, db_pgno_t *)); +int __ham_item_next __P((DBC *, db_lockmode_t, db_pgno_t *)); +void __ham_putitem __P((DB *, PAGE *p, const DBT *, int)); +void __ham_reputpair __P((DB *, PAGE *, u_int32_t, const DBT *, const DBT *)); +int __ham_del_pair __P((DBC *, int)); +int __ham_replpair __P((DBC *, DBT *, u_int32_t)); +void __ham_onpage_replace __P((DB *, PAGE *, u_int32_t, int32_t, int32_t, DBT *)); +int __ham_split_page __P((DBC *, u_int32_t, u_int32_t)); +int __ham_add_el __P((DBC *, const DBT *, const DBT *, int)); +void __ham_copy_item __P((DB *, PAGE *, u_int32_t, PAGE *)); +int __ham_add_ovflpage __P((DBC *, PAGE *, int, PAGE **)); +int __ham_get_cpage __P((DBC *, db_lockmode_t)); +int __ham_next_cpage __P((DBC *, db_pgno_t, int)); +int __ham_lock_bucket __P((DBC *, db_lockmode_t)); +void __ham_dpair __P((DB *, PAGE *, u_int32_t)); +int __ham_insdel_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_newpage_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_replace_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_splitdata_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_copypage_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_metagroup_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_groupalloc_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_curadj_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_chgpg_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __ham_reclaim __P((DB *, DB_TXN *txn)); +int __ham_truncate __P((DB *, DB_TXN *txn, u_int32_t *)); +int __ham_stat __P((DB *, void *, u_int32_t)); +int __ham_traverse __P((DBC *, db_lockmode_t, int (*)(DB *, PAGE *, void *, int *), void *, int)); +int __ham_30_hashmeta __P((DB *, char *, u_int8_t *)); +int __ham_30_sizefix __P((DB *, DB_FH *, char *, u_int8_t *)); +int __ham_31_hashmeta __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *)); +int __ham_31_hash __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *)); +int __ham_vrfy_meta __P((DB *, VRFY_DBINFO *, HMETA *, db_pgno_t, u_int32_t)); +int __ham_vrfy __P((DB *, VRFY_DBINFO *, PAGE *, db_pgno_t, u_int32_t)); +int __ham_vrfy_structure __P((DB *, VRFY_DBINFO *, db_pgno_t, u_int32_t)); +int __ham_vrfy_hashing __P((DB *, u_int32_t, HMETA *, u_int32_t, db_pgno_t, u_int32_t, u_int32_t (*) __P((DB *, const void *, u_int32_t)))); +int __ham_salvage __P((DB *, VRFY_DBINFO *, db_pgno_t, PAGE *, void *, int (*)(void *, const void *), u_int32_t)); +int __ham_meta2pgset __P((DB *, VRFY_DBINFO *, HMETA *, u_int32_t, DB *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_hash_ext_h_ */ diff --git a/db/dbinc_auto/hmac_ext.h b/db/dbinc_auto/hmac_ext.h new file mode 100644 index 000000000..d161a7291 --- /dev/null +++ b/db/dbinc_auto/hmac_ext.h @@ -0,0 +1,20 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _hmac_ext_h_ +#define _hmac_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +void __db_chksum __P((u_int8_t *, size_t, u_int8_t *, u_int8_t *)); +void __db_derive_mac __P((u_int8_t *, size_t, u_int8_t *)); +int __db_check_chksum __P((DB_ENV *, DB_CIPHER *, u_int8_t *, void *, size_t, int)); +void __db_SHA1Transform __P((u_int32_t *, unsigned char *)); +void __db_SHA1Init __P((SHA1_CTX *)); +void __db_SHA1Update __P((SHA1_CTX *, unsigned char *, size_t)); +void __db_SHA1Final __P((unsigned char *, SHA1_CTX *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_hmac_ext_h_ */ diff --git a/db/dbinc_auto/int_def.in b/db/dbinc_auto/int_def.in new file mode 100644 index 000000000..3b4b5c656 --- /dev/null +++ b/db/dbinc_auto/int_def.in @@ -0,0 +1,1336 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _DB_INT_DEF_IN_ +#define _DB_INT_DEF_IN_ + +#define __crdel_metasub_log __crdel_metasub_log@DB_VERSION_UNIQUE_NAME@ +#define __crdel_metasub_getpgnos __crdel_metasub_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __crdel_metasub_print __crdel_metasub_print@DB_VERSION_UNIQUE_NAME@ +#define __crdel_metasub_read __crdel_metasub_read@DB_VERSION_UNIQUE_NAME@ +#define __crdel_init_print __crdel_init_print@DB_VERSION_UNIQUE_NAME@ +#define __crdel_init_getpgnos __crdel_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __crdel_init_recover __crdel_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __crdel_metasub_recover __crdel_metasub_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_master_open __db_master_open@DB_VERSION_UNIQUE_NAME@ +#define __db_master_update __db_master_update@DB_VERSION_UNIQUE_NAME@ +#define __db_dbenv_setup __db_dbenv_setup@DB_VERSION_UNIQUE_NAME@ +#define __db_close __db_close@DB_VERSION_UNIQUE_NAME@ +#define __db_close_i __db_close_i@DB_VERSION_UNIQUE_NAME@ +#define __db_refresh __db_refresh@DB_VERSION_UNIQUE_NAME@ +#define __db_log_page __db_log_page@DB_VERSION_UNIQUE_NAME@ +#define __db_backup_name __db_backup_name@DB_VERSION_UNIQUE_NAME@ +#define __dblist_get __dblist_get@DB_VERSION_UNIQUE_NAME@ +#if CONFIG_TEST +#define __db_testcopy __db_testcopy@DB_VERSION_UNIQUE_NAME@ +#endif +#define __db_cursor __db_cursor@DB_VERSION_UNIQUE_NAME@ +#define __db_icursor __db_icursor@DB_VERSION_UNIQUE_NAME@ +#define __db_cprint __db_cprint@DB_VERSION_UNIQUE_NAME@ +#define __db_fd __db_fd@DB_VERSION_UNIQUE_NAME@ +#define __db_get __db_get@DB_VERSION_UNIQUE_NAME@ +#define __db_put __db_put@DB_VERSION_UNIQUE_NAME@ +#define __db_delete __db_delete@DB_VERSION_UNIQUE_NAME@ +#define __db_sync __db_sync@DB_VERSION_UNIQUE_NAME@ +#define __db_associate __db_associate@DB_VERSION_UNIQUE_NAME@ +#define __db_pget __db_pget@DB_VERSION_UNIQUE_NAME@ +#define __db_addrem_log __db_addrem_log@DB_VERSION_UNIQUE_NAME@ +#define __db_addrem_getpgnos __db_addrem_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_addrem_print __db_addrem_print@DB_VERSION_UNIQUE_NAME@ +#define __db_addrem_read __db_addrem_read@DB_VERSION_UNIQUE_NAME@ +#define __db_big_log __db_big_log@DB_VERSION_UNIQUE_NAME@ +#define __db_big_getpgnos __db_big_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_big_print __db_big_print@DB_VERSION_UNIQUE_NAME@ +#define __db_big_read __db_big_read@DB_VERSION_UNIQUE_NAME@ +#define __db_ovref_log __db_ovref_log@DB_VERSION_UNIQUE_NAME@ +#define __db_ovref_getpgnos __db_ovref_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_ovref_print __db_ovref_print@DB_VERSION_UNIQUE_NAME@ +#define __db_ovref_read __db_ovref_read@DB_VERSION_UNIQUE_NAME@ +#define __db_relink_log __db_relink_log@DB_VERSION_UNIQUE_NAME@ +#define __db_relink_getpgnos __db_relink_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_relink_print __db_relink_print@DB_VERSION_UNIQUE_NAME@ +#define __db_relink_read __db_relink_read@DB_VERSION_UNIQUE_NAME@ +#define __db_debug_log __db_debug_log@DB_VERSION_UNIQUE_NAME@ +#define __db_debug_getpgnos __db_debug_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_debug_print __db_debug_print@DB_VERSION_UNIQUE_NAME@ +#define __db_debug_read __db_debug_read@DB_VERSION_UNIQUE_NAME@ +#define __db_noop_log __db_noop_log@DB_VERSION_UNIQUE_NAME@ +#define __db_noop_getpgnos __db_noop_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_noop_print __db_noop_print@DB_VERSION_UNIQUE_NAME@ +#define __db_noop_read __db_noop_read@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_alloc_log __db_pg_alloc_log@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_alloc_getpgnos __db_pg_alloc_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_alloc_print __db_pg_alloc_print@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_alloc_read __db_pg_alloc_read@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_free_log __db_pg_free_log@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_free_getpgnos __db_pg_free_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_free_print __db_pg_free_print@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_free_read __db_pg_free_read@DB_VERSION_UNIQUE_NAME@ +#define __db_cksum_log __db_cksum_log@DB_VERSION_UNIQUE_NAME@ +#define __db_cksum_getpgnos __db_cksum_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_cksum_print __db_cksum_print@DB_VERSION_UNIQUE_NAME@ +#define __db_cksum_read __db_cksum_read@DB_VERSION_UNIQUE_NAME@ +#define __db_init_print __db_init_print@DB_VERSION_UNIQUE_NAME@ +#define __db_init_getpgnos __db_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __db_init_recover __db_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_c_close __db_c_close@DB_VERSION_UNIQUE_NAME@ +#define __db_c_destroy __db_c_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_c_count __db_c_count@DB_VERSION_UNIQUE_NAME@ +#define __db_c_del __db_c_del@DB_VERSION_UNIQUE_NAME@ +#define __db_c_dup __db_c_dup@DB_VERSION_UNIQUE_NAME@ +#define __db_c_idup __db_c_idup@DB_VERSION_UNIQUE_NAME@ +#define __db_c_newopd __db_c_newopd@DB_VERSION_UNIQUE_NAME@ +#define __db_c_get __db_c_get@DB_VERSION_UNIQUE_NAME@ +#define __db_c_put __db_c_put@DB_VERSION_UNIQUE_NAME@ +#define __db_duperr __db_duperr@DB_VERSION_UNIQUE_NAME@ +#define __db_c_secondary_get __db_c_secondary_get@DB_VERSION_UNIQUE_NAME@ +#define __db_c_pget __db_c_pget@DB_VERSION_UNIQUE_NAME@ +#define __db_c_del_primary __db_c_del_primary@DB_VERSION_UNIQUE_NAME@ +#define __db_s_first __db_s_first@DB_VERSION_UNIQUE_NAME@ +#define __db_s_next __db_s_next@DB_VERSION_UNIQUE_NAME@ +#define __db_s_done __db_s_done@DB_VERSION_UNIQUE_NAME@ +#define __db_partsize __db_partsize@DB_VERSION_UNIQUE_NAME@ +#define __db_pgin __db_pgin@DB_VERSION_UNIQUE_NAME@ +#define __db_pgout __db_pgout@DB_VERSION_UNIQUE_NAME@ +#define __db_metaswap __db_metaswap@DB_VERSION_UNIQUE_NAME@ +#define __db_byteswap __db_byteswap@DB_VERSION_UNIQUE_NAME@ +#define __db_dispatch __db_dispatch@DB_VERSION_UNIQUE_NAME@ +#define __db_add_recovery __db_add_recovery@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_init __db_txnlist_init@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_add __db_txnlist_add@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_remove __db_txnlist_remove@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_ckp __db_txnlist_ckp@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_end __db_txnlist_end@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_find __db_txnlist_find@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_update __db_txnlist_update@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_gen __db_txnlist_gen@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_lsnadd __db_txnlist_lsnadd@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_lsninit __db_txnlist_lsninit@DB_VERSION_UNIQUE_NAME@ +#define __db_add_limbo __db_add_limbo@DB_VERSION_UNIQUE_NAME@ +#define __db_do_the_limbo __db_do_the_limbo@DB_VERSION_UNIQUE_NAME@ +#define __db_txnlist_print __db_txnlist_print@DB_VERSION_UNIQUE_NAME@ +#define __db_ditem __db_ditem@DB_VERSION_UNIQUE_NAME@ +#define __db_pitem __db_pitem@DB_VERSION_UNIQUE_NAME@ +#define __db_relink __db_relink@DB_VERSION_UNIQUE_NAME@ +#define __db_cursorchk __db_cursorchk@DB_VERSION_UNIQUE_NAME@ +#define __db_ccountchk __db_ccountchk@DB_VERSION_UNIQUE_NAME@ +#define __db_cdelchk __db_cdelchk@DB_VERSION_UNIQUE_NAME@ +#define __db_cgetchk __db_cgetchk@DB_VERSION_UNIQUE_NAME@ +#define __db_cputchk __db_cputchk@DB_VERSION_UNIQUE_NAME@ +#define __db_pgetchk __db_pgetchk@DB_VERSION_UNIQUE_NAME@ +#define __db_cpgetchk __db_cpgetchk@DB_VERSION_UNIQUE_NAME@ +#define __db_delchk __db_delchk@DB_VERSION_UNIQUE_NAME@ +#define __db_getchk __db_getchk@DB_VERSION_UNIQUE_NAME@ +#define __db_joinchk __db_joinchk@DB_VERSION_UNIQUE_NAME@ +#define __db_joingetchk __db_joingetchk@DB_VERSION_UNIQUE_NAME@ +#define __db_putchk __db_putchk@DB_VERSION_UNIQUE_NAME@ +#define __db_statchk __db_statchk@DB_VERSION_UNIQUE_NAME@ +#define __db_syncchk __db_syncchk@DB_VERSION_UNIQUE_NAME@ +#define __db_secondary_corrupt __db_secondary_corrupt@DB_VERSION_UNIQUE_NAME@ +#define __db_associatechk __db_associatechk@DB_VERSION_UNIQUE_NAME@ +#define __db_txn_auto __db_txn_auto@DB_VERSION_UNIQUE_NAME@ +#define __db_join __db_join@DB_VERSION_UNIQUE_NAME@ +#define __db_new __db_new@DB_VERSION_UNIQUE_NAME@ +#define __db_free __db_free@DB_VERSION_UNIQUE_NAME@ +#define __db_lprint __db_lprint@DB_VERSION_UNIQUE_NAME@ +#define __db_lget __db_lget@DB_VERSION_UNIQUE_NAME@ +#define __db_lput __db_lput@DB_VERSION_UNIQUE_NAME@ +#define __dbh_am_chk __dbh_am_chk@DB_VERSION_UNIQUE_NAME@ +#define __db_set_lorder __db_set_lorder@DB_VERSION_UNIQUE_NAME@ +#define __db_open __db_open@DB_VERSION_UNIQUE_NAME@ +#define __db_dbopen __db_dbopen@DB_VERSION_UNIQUE_NAME@ +#define __db_new_file __db_new_file@DB_VERSION_UNIQUE_NAME@ +#define __db_init_subdb __db_init_subdb@DB_VERSION_UNIQUE_NAME@ +#define __db_chk_meta __db_chk_meta@DB_VERSION_UNIQUE_NAME@ +#define __db_meta_setup __db_meta_setup@DB_VERSION_UNIQUE_NAME@ +#define __db_goff __db_goff@DB_VERSION_UNIQUE_NAME@ +#define __db_poff __db_poff@DB_VERSION_UNIQUE_NAME@ +#define __db_ovref __db_ovref@DB_VERSION_UNIQUE_NAME@ +#define __db_doff __db_doff@DB_VERSION_UNIQUE_NAME@ +#define __db_moff __db_moff@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_overflow __db_vrfy_overflow@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_ovfl_structure __db_vrfy_ovfl_structure@DB_VERSION_UNIQUE_NAME@ +#define __db_safe_goff __db_safe_goff@DB_VERSION_UNIQUE_NAME@ +#define __db_loadme __db_loadme@DB_VERSION_UNIQUE_NAME@ +#define __db_dump __db_dump@DB_VERSION_UNIQUE_NAME@ +#define __db_inmemdbflags __db_inmemdbflags@DB_VERSION_UNIQUE_NAME@ +#define __db_prnpage __db_prnpage@DB_VERSION_UNIQUE_NAME@ +#define __db_prpage __db_prpage@DB_VERSION_UNIQUE_NAME@ +#define __db_pr __db_pr@DB_VERSION_UNIQUE_NAME@ +#define __db_prdbt __db_prdbt@DB_VERSION_UNIQUE_NAME@ +#define __db_prflags __db_prflags@DB_VERSION_UNIQUE_NAME@ +#define __db_prheader __db_prheader@DB_VERSION_UNIQUE_NAME@ +#define __db_prfooter __db_prfooter@DB_VERSION_UNIQUE_NAME@ +#define __db_addrem_recover __db_addrem_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_big_recover __db_big_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_ovref_recover __db_ovref_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_relink_recover __db_relink_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_debug_recover __db_debug_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_noop_recover __db_noop_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_alloc_recover __db_pg_alloc_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_pg_free_recover __db_pg_free_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_cksum_recover __db_cksum_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_traverse_big __db_traverse_big@DB_VERSION_UNIQUE_NAME@ +#define __db_reclaim_callback __db_reclaim_callback@DB_VERSION_UNIQUE_NAME@ +#define __db_truncate_callback __db_truncate_callback@DB_VERSION_UNIQUE_NAME@ +#define __dbenv_dbremove __dbenv_dbremove@DB_VERSION_UNIQUE_NAME@ +#define __db_remove __db_remove@DB_VERSION_UNIQUE_NAME@ +#define __db_remove_i __db_remove_i@DB_VERSION_UNIQUE_NAME@ +#define __dbenv_dbrename __dbenv_dbrename@DB_VERSION_UNIQUE_NAME@ +#define __db_rename __db_rename@DB_VERSION_UNIQUE_NAME@ +#define __db_rename_i __db_rename_i@DB_VERSION_UNIQUE_NAME@ +#define __db_ret __db_ret@DB_VERSION_UNIQUE_NAME@ +#define __db_retcopy __db_retcopy@DB_VERSION_UNIQUE_NAME@ +#define __db_truncate __db_truncate@DB_VERSION_UNIQUE_NAME@ +#define __db_upgrade __db_upgrade@DB_VERSION_UNIQUE_NAME@ +#define __db_lastpgno __db_lastpgno@DB_VERSION_UNIQUE_NAME@ +#define __db_31_offdup __db_31_offdup@DB_VERSION_UNIQUE_NAME@ +#define __db_verify __db_verify@DB_VERSION_UNIQUE_NAME@ +#define __db_verify_callback __db_verify_callback@DB_VERSION_UNIQUE_NAME@ +#define __db_verify_internal __db_verify_internal@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_datapage __db_vrfy_datapage@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_meta __db_vrfy_meta@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_struct_feedback __db_vrfy_struct_feedback@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_inpitem __db_vrfy_inpitem@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_duptype __db_vrfy_duptype@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_duptree __db_salvage_duptree@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_dbinfo_create __db_vrfy_dbinfo_create@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_dbinfo_destroy __db_vrfy_dbinfo_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_getpageinfo __db_vrfy_getpageinfo@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_putpageinfo __db_vrfy_putpageinfo@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_pgset __db_vrfy_pgset@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_pgset_get __db_vrfy_pgset_get@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_pgset_inc __db_vrfy_pgset_inc@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_pgset_dec __db_vrfy_pgset_dec@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_pgset_next __db_vrfy_pgset_next@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_childcursor __db_vrfy_childcursor@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_childput __db_vrfy_childput@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_ccset __db_vrfy_ccset@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_ccnext __db_vrfy_ccnext@DB_VERSION_UNIQUE_NAME@ +#define __db_vrfy_ccclose __db_vrfy_ccclose@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_init __db_salvage_init@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_destroy __db_salvage_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_getnext __db_salvage_getnext@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_isdone __db_salvage_isdone@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_markdone __db_salvage_markdone@DB_VERSION_UNIQUE_NAME@ +#define __db_salvage_markneeded __db_salvage_markneeded@DB_VERSION_UNIQUE_NAME@ +#define __bam_cmp __bam_cmp@DB_VERSION_UNIQUE_NAME@ +#define __bam_defcmp __bam_defcmp@DB_VERSION_UNIQUE_NAME@ +#define __bam_defpfx __bam_defpfx@DB_VERSION_UNIQUE_NAME@ +#define __bam_pgin __bam_pgin@DB_VERSION_UNIQUE_NAME@ +#define __bam_pgout __bam_pgout@DB_VERSION_UNIQUE_NAME@ +#define __bam_mswap __bam_mswap@DB_VERSION_UNIQUE_NAME@ +#define __bam_cprint __bam_cprint@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_delete __bam_ca_delete@DB_VERSION_UNIQUE_NAME@ +#define __ram_ca_delete __ram_ca_delete@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_di __bam_ca_di@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_dup __bam_ca_dup@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_undodup __bam_ca_undodup@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_rsplit __bam_ca_rsplit@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_split __bam_ca_split@DB_VERSION_UNIQUE_NAME@ +#define __bam_ca_undosplit __bam_ca_undosplit@DB_VERSION_UNIQUE_NAME@ +#define __bam_c_init __bam_c_init@DB_VERSION_UNIQUE_NAME@ +#define __bam_c_refresh __bam_c_refresh@DB_VERSION_UNIQUE_NAME@ +#define __bam_c_count __bam_c_count@DB_VERSION_UNIQUE_NAME@ +#define __bam_c_dup __bam_c_dup@DB_VERSION_UNIQUE_NAME@ +#define __bam_bulk_overflow __bam_bulk_overflow@DB_VERSION_UNIQUE_NAME@ +#define __bam_bulk_duplicates __bam_bulk_duplicates@DB_VERSION_UNIQUE_NAME@ +#define __bam_c_rget __bam_c_rget@DB_VERSION_UNIQUE_NAME@ +#define __bam_ditem __bam_ditem@DB_VERSION_UNIQUE_NAME@ +#define __bam_adjindx __bam_adjindx@DB_VERSION_UNIQUE_NAME@ +#define __bam_dpages __bam_dpages@DB_VERSION_UNIQUE_NAME@ +#define __bam_db_create __bam_db_create@DB_VERSION_UNIQUE_NAME@ +#define __bam_db_close __bam_db_close@DB_VERSION_UNIQUE_NAME@ +#define __bam_set_flags __bam_set_flags@DB_VERSION_UNIQUE_NAME@ +#define __ram_set_flags __ram_set_flags@DB_VERSION_UNIQUE_NAME@ +#define __bam_open __bam_open@DB_VERSION_UNIQUE_NAME@ +#define __bam_metachk __bam_metachk@DB_VERSION_UNIQUE_NAME@ +#define __bam_read_root __bam_read_root@DB_VERSION_UNIQUE_NAME@ +#define __bam_new_file __bam_new_file@DB_VERSION_UNIQUE_NAME@ +#define __bam_new_subdb __bam_new_subdb@DB_VERSION_UNIQUE_NAME@ +#define __bam_iitem __bam_iitem@DB_VERSION_UNIQUE_NAME@ +#define __bam_ritem __bam_ritem@DB_VERSION_UNIQUE_NAME@ +#define __bam_split_recover __bam_split_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_rsplit_recover __bam_rsplit_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_adj_recover __bam_adj_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_cadjust_recover __bam_cadjust_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_cdel_recover __bam_cdel_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_repl_recover __bam_repl_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_root_recover __bam_root_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_curadj_recover __bam_curadj_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_rcuradj_recover __bam_rcuradj_recover@DB_VERSION_UNIQUE_NAME@ +#define __bam_reclaim __bam_reclaim@DB_VERSION_UNIQUE_NAME@ +#define __bam_truncate __bam_truncate@DB_VERSION_UNIQUE_NAME@ +#define __ram_open __ram_open@DB_VERSION_UNIQUE_NAME@ +#define __ram_append __ram_append@DB_VERSION_UNIQUE_NAME@ +#define __ram_c_del __ram_c_del@DB_VERSION_UNIQUE_NAME@ +#define __ram_c_get __ram_c_get@DB_VERSION_UNIQUE_NAME@ +#define __ram_c_put __ram_c_put@DB_VERSION_UNIQUE_NAME@ +#define __ram_ca __ram_ca@DB_VERSION_UNIQUE_NAME@ +#define __ram_getno __ram_getno@DB_VERSION_UNIQUE_NAME@ +#define __ram_writeback __ram_writeback@DB_VERSION_UNIQUE_NAME@ +#define __bam_rsearch __bam_rsearch@DB_VERSION_UNIQUE_NAME@ +#define __bam_adjust __bam_adjust@DB_VERSION_UNIQUE_NAME@ +#define __bam_nrecs __bam_nrecs@DB_VERSION_UNIQUE_NAME@ +#define __bam_total __bam_total@DB_VERSION_UNIQUE_NAME@ +#define __bam_search __bam_search@DB_VERSION_UNIQUE_NAME@ +#define __bam_stkrel __bam_stkrel@DB_VERSION_UNIQUE_NAME@ +#define __bam_stkgrow __bam_stkgrow@DB_VERSION_UNIQUE_NAME@ +#define __bam_split __bam_split@DB_VERSION_UNIQUE_NAME@ +#define __bam_copy __bam_copy@DB_VERSION_UNIQUE_NAME@ +#define __bam_stat __bam_stat@DB_VERSION_UNIQUE_NAME@ +#define __bam_traverse __bam_traverse@DB_VERSION_UNIQUE_NAME@ +#define __bam_stat_callback __bam_stat_callback@DB_VERSION_UNIQUE_NAME@ +#define __bam_key_range __bam_key_range@DB_VERSION_UNIQUE_NAME@ +#define __bam_30_btreemeta __bam_30_btreemeta@DB_VERSION_UNIQUE_NAME@ +#define __bam_31_btreemeta __bam_31_btreemeta@DB_VERSION_UNIQUE_NAME@ +#define __bam_31_lbtree __bam_31_lbtree@DB_VERSION_UNIQUE_NAME@ +#define __bam_vrfy_meta __bam_vrfy_meta@DB_VERSION_UNIQUE_NAME@ +#define __ram_vrfy_leaf __ram_vrfy_leaf@DB_VERSION_UNIQUE_NAME@ +#define __bam_vrfy __bam_vrfy@DB_VERSION_UNIQUE_NAME@ +#define __bam_vrfy_itemorder __bam_vrfy_itemorder@DB_VERSION_UNIQUE_NAME@ +#define __bam_vrfy_structure __bam_vrfy_structure@DB_VERSION_UNIQUE_NAME@ +#define __bam_vrfy_subtree __bam_vrfy_subtree@DB_VERSION_UNIQUE_NAME@ +#define __bam_salvage __bam_salvage@DB_VERSION_UNIQUE_NAME@ +#define __bam_salvage_walkdupint __bam_salvage_walkdupint@DB_VERSION_UNIQUE_NAME@ +#define __bam_meta2pgset __bam_meta2pgset@DB_VERSION_UNIQUE_NAME@ +#define __bam_split_log __bam_split_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_split_getpgnos __bam_split_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_split_print __bam_split_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_split_read __bam_split_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_rsplit_log __bam_rsplit_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_rsplit_getpgnos __bam_rsplit_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_rsplit_print __bam_rsplit_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_rsplit_read __bam_rsplit_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_adj_log __bam_adj_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_adj_getpgnos __bam_adj_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_adj_print __bam_adj_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_adj_read __bam_adj_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_cadjust_log __bam_cadjust_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_cadjust_getpgnos __bam_cadjust_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_cadjust_print __bam_cadjust_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_cadjust_read __bam_cadjust_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_cdel_log __bam_cdel_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_cdel_getpgnos __bam_cdel_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_cdel_print __bam_cdel_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_cdel_read __bam_cdel_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_repl_log __bam_repl_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_repl_getpgnos __bam_repl_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_repl_print __bam_repl_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_repl_read __bam_repl_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_root_log __bam_root_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_root_getpgnos __bam_root_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_root_print __bam_root_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_root_read __bam_root_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_curadj_log __bam_curadj_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_curadj_getpgnos __bam_curadj_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_curadj_print __bam_curadj_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_curadj_read __bam_curadj_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_rcuradj_log __bam_rcuradj_log@DB_VERSION_UNIQUE_NAME@ +#define __bam_rcuradj_getpgnos __bam_rcuradj_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_rcuradj_print __bam_rcuradj_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_rcuradj_read __bam_rcuradj_read@DB_VERSION_UNIQUE_NAME@ +#define __bam_init_print __bam_init_print@DB_VERSION_UNIQUE_NAME@ +#define __bam_init_getpgnos __bam_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __bam_init_recover __bam_init_recover@DB_VERSION_UNIQUE_NAME@ +#ifndef HAVE_GETCWD +#define getcwd getcwd@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_GETOPT +#define getopt getopt@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_MEMCMP +#define memcmp memcmp@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_MEMCPY +#define memcpy memcpy@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_MEMMOVE +#define memmove memmove@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_RAISE +#define raise raise@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_SNPRINTF +#define snprintf snprintf@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_STRCASECMP +#define strcasecmp strcasecmp@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_STRCASECMP +#define strncasecmp strncasecmp@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_STRDUP +#define strdup strdup@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_STRERROR +#define strerror strerror@DB_VERSION_UNIQUE_NAME@ +#endif +#ifndef HAVE_VSNPRINTF +#define vsnprintf vsnprintf@DB_VERSION_UNIQUE_NAME@ +#endif +#define __db_isbigendian __db_isbigendian@DB_VERSION_UNIQUE_NAME@ +#define __db_byteorder __db_byteorder@DB_VERSION_UNIQUE_NAME@ +#define __db_fchk __db_fchk@DB_VERSION_UNIQUE_NAME@ +#define __db_fcchk __db_fcchk@DB_VERSION_UNIQUE_NAME@ +#define __db_ferr __db_ferr@DB_VERSION_UNIQUE_NAME@ +#define __db_pgerr __db_pgerr@DB_VERSION_UNIQUE_NAME@ +#define __db_pgfmt __db_pgfmt@DB_VERSION_UNIQUE_NAME@ +#define __db_eopnotsup __db_eopnotsup@DB_VERSION_UNIQUE_NAME@ +#ifdef DIAGNOSTIC +#define __db_assert __db_assert@DB_VERSION_UNIQUE_NAME@ +#endif +#define __db_panic_msg __db_panic_msg@DB_VERSION_UNIQUE_NAME@ +#define __db_panic __db_panic@DB_VERSION_UNIQUE_NAME@ +#define __db_err __db_err@DB_VERSION_UNIQUE_NAME@ +#define __db_errcall __db_errcall@DB_VERSION_UNIQUE_NAME@ +#define __db_errfile __db_errfile@DB_VERSION_UNIQUE_NAME@ +#define __db_logmsg __db_logmsg@DB_VERSION_UNIQUE_NAME@ +#define __db_unknown_flag __db_unknown_flag@DB_VERSION_UNIQUE_NAME@ +#define __db_unknown_type __db_unknown_type@DB_VERSION_UNIQUE_NAME@ +#define __db_check_txn __db_check_txn@DB_VERSION_UNIQUE_NAME@ +#define __db_not_txn_env __db_not_txn_env@DB_VERSION_UNIQUE_NAME@ +#define __db_getlong __db_getlong@DB_VERSION_UNIQUE_NAME@ +#define __db_getulong __db_getulong@DB_VERSION_UNIQUE_NAME@ +#define __db_idspace __db_idspace@DB_VERSION_UNIQUE_NAME@ +#define __db_log2 __db_log2@DB_VERSION_UNIQUE_NAME@ +#define __db_util_arg __db_util_arg@DB_VERSION_UNIQUE_NAME@ +#define __db_util_cache __db_util_cache@DB_VERSION_UNIQUE_NAME@ +#define __db_util_logset __db_util_logset@DB_VERSION_UNIQUE_NAME@ +#define __db_util_siginit __db_util_siginit@DB_VERSION_UNIQUE_NAME@ +#define __db_util_interrupted __db_util_interrupted@DB_VERSION_UNIQUE_NAME@ +#define __db_util_sigresend __db_util_sigresend@DB_VERSION_UNIQUE_NAME@ +#define __aes_setup __aes_setup@DB_VERSION_UNIQUE_NAME@ +#define __aes_adj_size __aes_adj_size@DB_VERSION_UNIQUE_NAME@ +#define __aes_close __aes_close@DB_VERSION_UNIQUE_NAME@ +#define __aes_decrypt __aes_decrypt@DB_VERSION_UNIQUE_NAME@ +#define __aes_encrypt __aes_encrypt@DB_VERSION_UNIQUE_NAME@ +#define __aes_init __aes_init@DB_VERSION_UNIQUE_NAME@ +#define __crypto_region_init __crypto_region_init@DB_VERSION_UNIQUE_NAME@ +#define __crypto_dbenv_close __crypto_dbenv_close@DB_VERSION_UNIQUE_NAME@ +#define __crypto_algsetup __crypto_algsetup@DB_VERSION_UNIQUE_NAME@ +#define __crypto_decrypt_meta __crypto_decrypt_meta@DB_VERSION_UNIQUE_NAME@ +#define __db_generate_iv __db_generate_iv@DB_VERSION_UNIQUE_NAME@ +#define __db_rijndaelKeySetupEnc __db_rijndaelKeySetupEnc@DB_VERSION_UNIQUE_NAME@ +#define __db_rijndaelKeySetupDec __db_rijndaelKeySetupDec@DB_VERSION_UNIQUE_NAME@ +#define __db_rijndaelEncrypt __db_rijndaelEncrypt@DB_VERSION_UNIQUE_NAME@ +#define __db_rijndaelDecrypt __db_rijndaelDecrypt@DB_VERSION_UNIQUE_NAME@ +#define __db_rijndaelEncryptRound __db_rijndaelEncryptRound@DB_VERSION_UNIQUE_NAME@ +#define __db_rijndaelDecryptRound __db_rijndaelDecryptRound@DB_VERSION_UNIQUE_NAME@ +#define __db_makeKey __db_makeKey@DB_VERSION_UNIQUE_NAME@ +#define __db_cipherInit __db_cipherInit@DB_VERSION_UNIQUE_NAME@ +#define __db_blockEncrypt __db_blockEncrypt@DB_VERSION_UNIQUE_NAME@ +#define __db_padEncrypt __db_padEncrypt@DB_VERSION_UNIQUE_NAME@ +#define __db_blockDecrypt __db_blockDecrypt@DB_VERSION_UNIQUE_NAME@ +#define __db_padDecrypt __db_padDecrypt@DB_VERSION_UNIQUE_NAME@ +#define __db_cipherUpdateRounds __db_cipherUpdateRounds@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_setup __dbreg_setup@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_teardown __dbreg_teardown@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_new_id __dbreg_new_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_assign_id __dbreg_assign_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_revoke_id __dbreg_revoke_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_close_id __dbreg_close_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_register_log __dbreg_register_log@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_register_getpgnos __dbreg_register_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_register_print __dbreg_register_print@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_register_read __dbreg_register_read@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_init_print __dbreg_init_print@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_init_getpgnos __dbreg_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_init_recover __dbreg_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_register_recover __dbreg_register_recover@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_add_dbentry __dbreg_add_dbentry@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_rem_dbentry __dbreg_rem_dbentry@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_open_files __dbreg_open_files@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_close_files __dbreg_close_files@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_id_to_db __dbreg_id_to_db@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_id_to_fname __dbreg_id_to_fname@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_fid_to_fname __dbreg_fid_to_fname@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_get_name __dbreg_get_name@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_do_open __dbreg_do_open@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_lazy_id __dbreg_lazy_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_push_id __dbreg_push_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_pop_id __dbreg_pop_id@DB_VERSION_UNIQUE_NAME@ +#define __dbreg_pluck_id __dbreg_pluck_id@DB_VERSION_UNIQUE_NAME@ +#define __db_shalloc_init __db_shalloc_init@DB_VERSION_UNIQUE_NAME@ +#define __db_shalloc_size __db_shalloc_size@DB_VERSION_UNIQUE_NAME@ +#define __db_shalloc __db_shalloc@DB_VERSION_UNIQUE_NAME@ +#define __db_shalloc_free __db_shalloc_free@DB_VERSION_UNIQUE_NAME@ +#define __db_shsizeof __db_shsizeof@DB_VERSION_UNIQUE_NAME@ +#define __db_shalloc_dump __db_shalloc_dump@DB_VERSION_UNIQUE_NAME@ +#define __db_tablesize __db_tablesize@DB_VERSION_UNIQUE_NAME@ +#define __db_hashinit __db_hashinit@DB_VERSION_UNIQUE_NAME@ +#define __db_fileinit __db_fileinit@DB_VERSION_UNIQUE_NAME@ +#define __db_overwrite __db_overwrite@DB_VERSION_UNIQUE_NAME@ +#define __db_mi_env __db_mi_env@DB_VERSION_UNIQUE_NAME@ +#define __db_mi_open __db_mi_open@DB_VERSION_UNIQUE_NAME@ +#define __db_env_config __db_env_config@DB_VERSION_UNIQUE_NAME@ +#define __dbenv_open __dbenv_open@DB_VERSION_UNIQUE_NAME@ +#define __dbenv_remove __dbenv_remove@DB_VERSION_UNIQUE_NAME@ +#define __dbenv_close __dbenv_close@DB_VERSION_UNIQUE_NAME@ +#define __db_appname __db_appname@DB_VERSION_UNIQUE_NAME@ +#define __db_home __db_home@DB_VERSION_UNIQUE_NAME@ +#define __db_apprec __db_apprec@DB_VERSION_UNIQUE_NAME@ +#define __env_openfiles __env_openfiles@DB_VERSION_UNIQUE_NAME@ +#define __db_e_attach __db_e_attach@DB_VERSION_UNIQUE_NAME@ +#define __db_e_detach __db_e_detach@DB_VERSION_UNIQUE_NAME@ +#define __db_e_remove __db_e_remove@DB_VERSION_UNIQUE_NAME@ +#define __db_e_stat __db_e_stat@DB_VERSION_UNIQUE_NAME@ +#define __db_r_attach __db_r_attach@DB_VERSION_UNIQUE_NAME@ +#define __db_r_detach __db_r_detach@DB_VERSION_UNIQUE_NAME@ +#define __fop_create_log __fop_create_log@DB_VERSION_UNIQUE_NAME@ +#define __fop_create_getpgnos __fop_create_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __fop_create_print __fop_create_print@DB_VERSION_UNIQUE_NAME@ +#define __fop_create_read __fop_create_read@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove_log __fop_remove_log@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove_getpgnos __fop_remove_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove_print __fop_remove_print@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove_read __fop_remove_read@DB_VERSION_UNIQUE_NAME@ +#define __fop_write_log __fop_write_log@DB_VERSION_UNIQUE_NAME@ +#define __fop_write_getpgnos __fop_write_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __fop_write_print __fop_write_print@DB_VERSION_UNIQUE_NAME@ +#define __fop_write_read __fop_write_read@DB_VERSION_UNIQUE_NAME@ +#define __fop_rename_log __fop_rename_log@DB_VERSION_UNIQUE_NAME@ +#define __fop_rename_getpgnos __fop_rename_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __fop_rename_print __fop_rename_print@DB_VERSION_UNIQUE_NAME@ +#define __fop_rename_read __fop_rename_read@DB_VERSION_UNIQUE_NAME@ +#define __fop_file_remove_log __fop_file_remove_log@DB_VERSION_UNIQUE_NAME@ +#define __fop_file_remove_getpgnos __fop_file_remove_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __fop_file_remove_print __fop_file_remove_print@DB_VERSION_UNIQUE_NAME@ +#define __fop_file_remove_read __fop_file_remove_read@DB_VERSION_UNIQUE_NAME@ +#define __fop_init_print __fop_init_print@DB_VERSION_UNIQUE_NAME@ +#define __fop_init_getpgnos __fop_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __fop_init_recover __fop_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __fop_create __fop_create@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove __fop_remove@DB_VERSION_UNIQUE_NAME@ +#define __fop_write __fop_write@DB_VERSION_UNIQUE_NAME@ +#define __fop_rename __fop_rename@DB_VERSION_UNIQUE_NAME@ +#define __fop_create_recover __fop_create_recover@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove_recover __fop_remove_recover@DB_VERSION_UNIQUE_NAME@ +#define __fop_write_recover __fop_write_recover@DB_VERSION_UNIQUE_NAME@ +#define __fop_rename_recover __fop_rename_recover@DB_VERSION_UNIQUE_NAME@ +#define __fop_file_remove_recover __fop_file_remove_recover@DB_VERSION_UNIQUE_NAME@ +#define __fop_lock_handle __fop_lock_handle@DB_VERSION_UNIQUE_NAME@ +#define __fop_file_setup __fop_file_setup@DB_VERSION_UNIQUE_NAME@ +#define __fop_subdb_setup __fop_subdb_setup@DB_VERSION_UNIQUE_NAME@ +#define __fop_remove_setup __fop_remove_setup@DB_VERSION_UNIQUE_NAME@ +#define __fop_read_meta __fop_read_meta@DB_VERSION_UNIQUE_NAME@ +#define __fop_dummy __fop_dummy@DB_VERSION_UNIQUE_NAME@ +#define __fop_dbrename __fop_dbrename@DB_VERSION_UNIQUE_NAME@ +#define __ham_quick_delete __ham_quick_delete@DB_VERSION_UNIQUE_NAME@ +#define __ham_c_init __ham_c_init@DB_VERSION_UNIQUE_NAME@ +#define __ham_c_count __ham_c_count@DB_VERSION_UNIQUE_NAME@ +#define __ham_c_dup __ham_c_dup@DB_VERSION_UNIQUE_NAME@ +#define __ham_call_hash __ham_call_hash@DB_VERSION_UNIQUE_NAME@ +#define __ham_init_dbt __ham_init_dbt@DB_VERSION_UNIQUE_NAME@ +#define __ham_c_update __ham_c_update@DB_VERSION_UNIQUE_NAME@ +#define __ham_get_clist __ham_get_clist@DB_VERSION_UNIQUE_NAME@ +#define __ham_insdel_log __ham_insdel_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_insdel_getpgnos __ham_insdel_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_insdel_print __ham_insdel_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_insdel_read __ham_insdel_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_newpage_log __ham_newpage_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_newpage_getpgnos __ham_newpage_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_newpage_print __ham_newpage_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_newpage_read __ham_newpage_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_splitdata_log __ham_splitdata_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_splitdata_getpgnos __ham_splitdata_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_splitdata_print __ham_splitdata_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_splitdata_read __ham_splitdata_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_replace_log __ham_replace_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_replace_getpgnos __ham_replace_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_replace_print __ham_replace_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_replace_read __ham_replace_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_copypage_log __ham_copypage_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_copypage_getpgnos __ham_copypage_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_copypage_print __ham_copypage_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_copypage_read __ham_copypage_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_metagroup_log __ham_metagroup_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_metagroup_getpgnos __ham_metagroup_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_metagroup_print __ham_metagroup_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_metagroup_read __ham_metagroup_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_groupalloc_log __ham_groupalloc_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_groupalloc_getpgnos __ham_groupalloc_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_groupalloc_print __ham_groupalloc_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_groupalloc_read __ham_groupalloc_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_curadj_log __ham_curadj_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_curadj_getpgnos __ham_curadj_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_curadj_print __ham_curadj_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_curadj_read __ham_curadj_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_chgpg_log __ham_chgpg_log@DB_VERSION_UNIQUE_NAME@ +#define __ham_chgpg_getpgnos __ham_chgpg_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_chgpg_print __ham_chgpg_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_chgpg_read __ham_chgpg_read@DB_VERSION_UNIQUE_NAME@ +#define __ham_init_print __ham_init_print@DB_VERSION_UNIQUE_NAME@ +#define __ham_init_getpgnos __ham_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __ham_init_recover __ham_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_pgin __ham_pgin@DB_VERSION_UNIQUE_NAME@ +#define __ham_pgout __ham_pgout@DB_VERSION_UNIQUE_NAME@ +#define __ham_mswap __ham_mswap@DB_VERSION_UNIQUE_NAME@ +#define __ham_add_dup __ham_add_dup@DB_VERSION_UNIQUE_NAME@ +#define __ham_dup_convert __ham_dup_convert@DB_VERSION_UNIQUE_NAME@ +#define __ham_make_dup __ham_make_dup@DB_VERSION_UNIQUE_NAME@ +#define __ham_dsearch __ham_dsearch@DB_VERSION_UNIQUE_NAME@ +#define __ham_cprint __ham_cprint@DB_VERSION_UNIQUE_NAME@ +#define __ham_func2 __ham_func2@DB_VERSION_UNIQUE_NAME@ +#define __ham_func3 __ham_func3@DB_VERSION_UNIQUE_NAME@ +#define __ham_func4 __ham_func4@DB_VERSION_UNIQUE_NAME@ +#define __ham_func5 __ham_func5@DB_VERSION_UNIQUE_NAME@ +#define __ham_test __ham_test@DB_VERSION_UNIQUE_NAME@ +#define __ham_get_meta __ham_get_meta@DB_VERSION_UNIQUE_NAME@ +#define __ham_release_meta __ham_release_meta@DB_VERSION_UNIQUE_NAME@ +#define __ham_dirty_meta __ham_dirty_meta@DB_VERSION_UNIQUE_NAME@ +#define __ham_db_create __ham_db_create@DB_VERSION_UNIQUE_NAME@ +#define __ham_db_close __ham_db_close@DB_VERSION_UNIQUE_NAME@ +#define __ham_open __ham_open@DB_VERSION_UNIQUE_NAME@ +#define __ham_metachk __ham_metachk@DB_VERSION_UNIQUE_NAME@ +#define __ham_new_file __ham_new_file@DB_VERSION_UNIQUE_NAME@ +#define __ham_new_subdb __ham_new_subdb@DB_VERSION_UNIQUE_NAME@ +#define __ham_item __ham_item@DB_VERSION_UNIQUE_NAME@ +#define __ham_item_reset __ham_item_reset@DB_VERSION_UNIQUE_NAME@ +#define __ham_item_init __ham_item_init@DB_VERSION_UNIQUE_NAME@ +#define __ham_item_last __ham_item_last@DB_VERSION_UNIQUE_NAME@ +#define __ham_item_first __ham_item_first@DB_VERSION_UNIQUE_NAME@ +#define __ham_item_prev __ham_item_prev@DB_VERSION_UNIQUE_NAME@ +#define __ham_item_next __ham_item_next@DB_VERSION_UNIQUE_NAME@ +#define __ham_putitem __ham_putitem@DB_VERSION_UNIQUE_NAME@ +#define __ham_reputpair __ham_reputpair@DB_VERSION_UNIQUE_NAME@ +#define __ham_del_pair __ham_del_pair@DB_VERSION_UNIQUE_NAME@ +#define __ham_replpair __ham_replpair@DB_VERSION_UNIQUE_NAME@ +#define __ham_onpage_replace __ham_onpage_replace@DB_VERSION_UNIQUE_NAME@ +#define __ham_split_page __ham_split_page@DB_VERSION_UNIQUE_NAME@ +#define __ham_add_el __ham_add_el@DB_VERSION_UNIQUE_NAME@ +#define __ham_copy_item __ham_copy_item@DB_VERSION_UNIQUE_NAME@ +#define __ham_add_ovflpage __ham_add_ovflpage@DB_VERSION_UNIQUE_NAME@ +#define __ham_get_cpage __ham_get_cpage@DB_VERSION_UNIQUE_NAME@ +#define __ham_next_cpage __ham_next_cpage@DB_VERSION_UNIQUE_NAME@ +#define __ham_lock_bucket __ham_lock_bucket@DB_VERSION_UNIQUE_NAME@ +#define __ham_dpair __ham_dpair@DB_VERSION_UNIQUE_NAME@ +#define __ham_insdel_recover __ham_insdel_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_newpage_recover __ham_newpage_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_replace_recover __ham_replace_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_splitdata_recover __ham_splitdata_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_copypage_recover __ham_copypage_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_metagroup_recover __ham_metagroup_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_groupalloc_recover __ham_groupalloc_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_curadj_recover __ham_curadj_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_chgpg_recover __ham_chgpg_recover@DB_VERSION_UNIQUE_NAME@ +#define __ham_reclaim __ham_reclaim@DB_VERSION_UNIQUE_NAME@ +#define __ham_truncate __ham_truncate@DB_VERSION_UNIQUE_NAME@ +#define __ham_stat __ham_stat@DB_VERSION_UNIQUE_NAME@ +#define __ham_traverse __ham_traverse@DB_VERSION_UNIQUE_NAME@ +#define __ham_30_hashmeta __ham_30_hashmeta@DB_VERSION_UNIQUE_NAME@ +#define __ham_30_sizefix __ham_30_sizefix@DB_VERSION_UNIQUE_NAME@ +#define __ham_31_hashmeta __ham_31_hashmeta@DB_VERSION_UNIQUE_NAME@ +#define __ham_31_hash __ham_31_hash@DB_VERSION_UNIQUE_NAME@ +#define __ham_vrfy_meta __ham_vrfy_meta@DB_VERSION_UNIQUE_NAME@ +#define __ham_vrfy __ham_vrfy@DB_VERSION_UNIQUE_NAME@ +#define __ham_vrfy_structure __ham_vrfy_structure@DB_VERSION_UNIQUE_NAME@ +#define __ham_vrfy_hashing __ham_vrfy_hashing@DB_VERSION_UNIQUE_NAME@ +#define __ham_salvage __ham_salvage@DB_VERSION_UNIQUE_NAME@ +#define __ham_meta2pgset __ham_meta2pgset@DB_VERSION_UNIQUE_NAME@ +#define __db_chksum __db_chksum@DB_VERSION_UNIQUE_NAME@ +#define __db_derive_mac __db_derive_mac@DB_VERSION_UNIQUE_NAME@ +#define __db_check_chksum __db_check_chksum@DB_VERSION_UNIQUE_NAME@ +#define __db_SHA1Transform __db_SHA1Transform@DB_VERSION_UNIQUE_NAME@ +#define __db_SHA1Init __db_SHA1Init@DB_VERSION_UNIQUE_NAME@ +#define __db_SHA1Update __db_SHA1Update@DB_VERSION_UNIQUE_NAME@ +#define __db_SHA1Final __db_SHA1Final@DB_VERSION_UNIQUE_NAME@ +#define __lock_id __lock_id@DB_VERSION_UNIQUE_NAME@ +#define __lock_id_free __lock_id_free@DB_VERSION_UNIQUE_NAME@ +#define __lock_vec __lock_vec@DB_VERSION_UNIQUE_NAME@ +#define __lock_get __lock_get@DB_VERSION_UNIQUE_NAME@ +#define __lock_put __lock_put@DB_VERSION_UNIQUE_NAME@ +#define __lock_downgrade __lock_downgrade@DB_VERSION_UNIQUE_NAME@ +#define __lock_addfamilylocker __lock_addfamilylocker@DB_VERSION_UNIQUE_NAME@ +#define __lock_freefamilylocker __lock_freefamilylocker@DB_VERSION_UNIQUE_NAME@ +#define __lock_set_timeout __lock_set_timeout@DB_VERSION_UNIQUE_NAME@ +#define __lock_inherit_timeout __lock_inherit_timeout@DB_VERSION_UNIQUE_NAME@ +#define __lock_getlocker __lock_getlocker@DB_VERSION_UNIQUE_NAME@ +#define __lock_promote __lock_promote@DB_VERSION_UNIQUE_NAME@ +#define __lock_expired __lock_expired@DB_VERSION_UNIQUE_NAME@ +#define __lock_detect __lock_detect@DB_VERSION_UNIQUE_NAME@ +#define __lock_dbenv_create __lock_dbenv_create@DB_VERSION_UNIQUE_NAME@ +#define __lock_dbenv_close __lock_dbenv_close@DB_VERSION_UNIQUE_NAME@ +#define __lock_open __lock_open@DB_VERSION_UNIQUE_NAME@ +#define __lock_dbenv_refresh __lock_dbenv_refresh@DB_VERSION_UNIQUE_NAME@ +#define __lock_region_destroy __lock_region_destroy@DB_VERSION_UNIQUE_NAME@ +#define __lock_id_set __lock_id_set@DB_VERSION_UNIQUE_NAME@ +#define __lock_stat __lock_stat@DB_VERSION_UNIQUE_NAME@ +#define __lock_dump_region __lock_dump_region@DB_VERSION_UNIQUE_NAME@ +#define __lock_printlock __lock_printlock@DB_VERSION_UNIQUE_NAME@ +#define __lock_cmp __lock_cmp@DB_VERSION_UNIQUE_NAME@ +#define __lock_locker_cmp __lock_locker_cmp@DB_VERSION_UNIQUE_NAME@ +#define __lock_ohash __lock_ohash@DB_VERSION_UNIQUE_NAME@ +#define __lock_lhash __lock_lhash@DB_VERSION_UNIQUE_NAME@ +#define __lock_locker_hash __lock_locker_hash@DB_VERSION_UNIQUE_NAME@ +#define __log_open __log_open@DB_VERSION_UNIQUE_NAME@ +#define __log_find __log_find@DB_VERSION_UNIQUE_NAME@ +#define __log_valid __log_valid@DB_VERSION_UNIQUE_NAME@ +#define __log_dbenv_refresh __log_dbenv_refresh@DB_VERSION_UNIQUE_NAME@ +#define __log_stat __log_stat@DB_VERSION_UNIQUE_NAME@ +#define __log_get_cached_ckp_lsn __log_get_cached_ckp_lsn@DB_VERSION_UNIQUE_NAME@ +#define __log_region_destroy __log_region_destroy@DB_VERSION_UNIQUE_NAME@ +#define __log_vtruncate __log_vtruncate@DB_VERSION_UNIQUE_NAME@ +#define __log_is_outdated __log_is_outdated@DB_VERSION_UNIQUE_NAME@ +#define __log_archive __log_archive@DB_VERSION_UNIQUE_NAME@ +#define __log_cursor __log_cursor@DB_VERSION_UNIQUE_NAME@ +#define __log_dbenv_create __log_dbenv_create@DB_VERSION_UNIQUE_NAME@ +#define __log_put __log_put@DB_VERSION_UNIQUE_NAME@ +#define __log_txn_lsn __log_txn_lsn@DB_VERSION_UNIQUE_NAME@ +#define __log_newfile __log_newfile@DB_VERSION_UNIQUE_NAME@ +#define __log_flush __log_flush@DB_VERSION_UNIQUE_NAME@ +#define __log_file __log_file@DB_VERSION_UNIQUE_NAME@ +#define __log_name __log_name@DB_VERSION_UNIQUE_NAME@ +#define __log_rep_put __log_rep_put@DB_VERSION_UNIQUE_NAME@ +#define __memp_alloc __memp_alloc@DB_VERSION_UNIQUE_NAME@ +#ifdef DIAGNOSTIC +#define __memp_check_order __memp_check_order@DB_VERSION_UNIQUE_NAME@ +#endif +#define __memp_bhwrite __memp_bhwrite@DB_VERSION_UNIQUE_NAME@ +#define __memp_pgread __memp_pgread@DB_VERSION_UNIQUE_NAME@ +#define __memp_pg __memp_pg@DB_VERSION_UNIQUE_NAME@ +#define __memp_bhfree __memp_bhfree@DB_VERSION_UNIQUE_NAME@ +#define __memp_fget __memp_fget@DB_VERSION_UNIQUE_NAME@ +#define __memp_fcreate __memp_fcreate@DB_VERSION_UNIQUE_NAME@ +#define __memp_fopen_int __memp_fopen_int@DB_VERSION_UNIQUE_NAME@ +#define __memp_fclose_int __memp_fclose_int@DB_VERSION_UNIQUE_NAME@ +#define __memp_mf_discard __memp_mf_discard@DB_VERSION_UNIQUE_NAME@ +#define __memp_fn __memp_fn@DB_VERSION_UNIQUE_NAME@ +#define __memp_fns __memp_fns@DB_VERSION_UNIQUE_NAME@ +#define __memp_fput __memp_fput@DB_VERSION_UNIQUE_NAME@ +#define __memp_fset __memp_fset@DB_VERSION_UNIQUE_NAME@ +#define __memp_dbenv_create __memp_dbenv_create@DB_VERSION_UNIQUE_NAME@ +#define __memp_open __memp_open@DB_VERSION_UNIQUE_NAME@ +#define __memp_dbenv_refresh __memp_dbenv_refresh@DB_VERSION_UNIQUE_NAME@ +#define __mpool_region_destroy __mpool_region_destroy@DB_VERSION_UNIQUE_NAME@ +#define __memp_nameop __memp_nameop@DB_VERSION_UNIQUE_NAME@ +#define __memp_register __memp_register@DB_VERSION_UNIQUE_NAME@ +#define __memp_stat __memp_stat@DB_VERSION_UNIQUE_NAME@ +#define __memp_dump_region __memp_dump_region@DB_VERSION_UNIQUE_NAME@ +#define __memp_stat_hash __memp_stat_hash@DB_VERSION_UNIQUE_NAME@ +#define __memp_sync __memp_sync@DB_VERSION_UNIQUE_NAME@ +#define __memp_fsync __memp_fsync@DB_VERSION_UNIQUE_NAME@ +#define __mp_xxx_fh __mp_xxx_fh@DB_VERSION_UNIQUE_NAME@ +#define __memp_sync_int __memp_sync_int@DB_VERSION_UNIQUE_NAME@ +#define __memp_trickle __memp_trickle@DB_VERSION_UNIQUE_NAME@ +#define __db_fcntl_mutex_init __db_fcntl_mutex_init@DB_VERSION_UNIQUE_NAME@ +#define __db_fcntl_mutex_lock __db_fcntl_mutex_lock@DB_VERSION_UNIQUE_NAME@ +#define __db_fcntl_mutex_unlock __db_fcntl_mutex_unlock@DB_VERSION_UNIQUE_NAME@ +#define __db_fcntl_mutex_destroy __db_fcntl_mutex_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_pthread_mutex_init __db_pthread_mutex_init@DB_VERSION_UNIQUE_NAME@ +#define __db_pthread_mutex_lock __db_pthread_mutex_lock@DB_VERSION_UNIQUE_NAME@ +#define __db_pthread_mutex_unlock __db_pthread_mutex_unlock@DB_VERSION_UNIQUE_NAME@ +#define __db_pthread_mutex_destroy __db_pthread_mutex_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_tas_mutex_init __db_tas_mutex_init@DB_VERSION_UNIQUE_NAME@ +#define __db_tas_mutex_lock __db_tas_mutex_lock@DB_VERSION_UNIQUE_NAME@ +#define __db_tas_mutex_unlock __db_tas_mutex_unlock@DB_VERSION_UNIQUE_NAME@ +#define __db_tas_mutex_destroy __db_tas_mutex_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_win32_mutex_init __db_win32_mutex_init@DB_VERSION_UNIQUE_NAME@ +#define __db_win32_mutex_lock __db_win32_mutex_lock@DB_VERSION_UNIQUE_NAME@ +#define __db_win32_mutex_unlock __db_win32_mutex_unlock@DB_VERSION_UNIQUE_NAME@ +#define __db_win32_mutex_destroy __db_win32_mutex_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_mutex_setup __db_mutex_setup@DB_VERSION_UNIQUE_NAME@ +#define __db_mutex_free __db_mutex_free@DB_VERSION_UNIQUE_NAME@ +#define __db_shreg_locks_clear __db_shreg_locks_clear@DB_VERSION_UNIQUE_NAME@ +#define __db_shreg_locks_destroy __db_shreg_locks_destroy@DB_VERSION_UNIQUE_NAME@ +#define __db_shreg_mutex_init __db_shreg_mutex_init@DB_VERSION_UNIQUE_NAME@ +#define __db_shreg_maintinit __db_shreg_maintinit@DB_VERSION_UNIQUE_NAME@ +#define __os_abspath __os_abspath@DB_VERSION_UNIQUE_NAME@ +#define __os_umalloc __os_umalloc@DB_VERSION_UNIQUE_NAME@ +#define __os_urealloc __os_urealloc@DB_VERSION_UNIQUE_NAME@ +#define __os_ufree __os_ufree@DB_VERSION_UNIQUE_NAME@ +#define __os_strdup __os_strdup@DB_VERSION_UNIQUE_NAME@ +#define __os_calloc __os_calloc@DB_VERSION_UNIQUE_NAME@ +#define __os_malloc __os_malloc@DB_VERSION_UNIQUE_NAME@ +#define __os_realloc __os_realloc@DB_VERSION_UNIQUE_NAME@ +#define __os_free __os_free@DB_VERSION_UNIQUE_NAME@ +#define __ua_memcpy __ua_memcpy@DB_VERSION_UNIQUE_NAME@ +#define __os_clock __os_clock@DB_VERSION_UNIQUE_NAME@ +#define __os_fs_notzero __os_fs_notzero@DB_VERSION_UNIQUE_NAME@ +#define __os_dirlist __os_dirlist@DB_VERSION_UNIQUE_NAME@ +#define __os_dirfree __os_dirfree@DB_VERSION_UNIQUE_NAME@ +#define __os_get_errno_ret_zero __os_get_errno_ret_zero@DB_VERSION_UNIQUE_NAME@ +#define __os_get_errno __os_get_errno@DB_VERSION_UNIQUE_NAME@ +#define __os_set_errno __os_set_errno@DB_VERSION_UNIQUE_NAME@ +#define __os_fileid __os_fileid@DB_VERSION_UNIQUE_NAME@ +#define __os_fsync __os_fsync@DB_VERSION_UNIQUE_NAME@ +#define __os_openhandle __os_openhandle@DB_VERSION_UNIQUE_NAME@ +#define __os_closehandle __os_closehandle@DB_VERSION_UNIQUE_NAME@ +#define __os_id __os_id@DB_VERSION_UNIQUE_NAME@ +#define __os_r_sysattach __os_r_sysattach@DB_VERSION_UNIQUE_NAME@ +#define __os_r_sysdetach __os_r_sysdetach@DB_VERSION_UNIQUE_NAME@ +#define __os_mapfile __os_mapfile@DB_VERSION_UNIQUE_NAME@ +#define __os_unmapfile __os_unmapfile@DB_VERSION_UNIQUE_NAME@ +#define __db_oflags __db_oflags@DB_VERSION_UNIQUE_NAME@ +#define __db_omode __db_omode@DB_VERSION_UNIQUE_NAME@ +#define __os_open __os_open@DB_VERSION_UNIQUE_NAME@ +#ifdef HAVE_QNX +#define __os_shmname __os_shmname@DB_VERSION_UNIQUE_NAME@ +#endif +#define __os_r_attach __os_r_attach@DB_VERSION_UNIQUE_NAME@ +#define __os_r_detach __os_r_detach@DB_VERSION_UNIQUE_NAME@ +#define __os_rename __os_rename@DB_VERSION_UNIQUE_NAME@ +#define __os_isroot __os_isroot@DB_VERSION_UNIQUE_NAME@ +#define __db_rpath __db_rpath@DB_VERSION_UNIQUE_NAME@ +#define __os_io __os_io@DB_VERSION_UNIQUE_NAME@ +#define __os_read __os_read@DB_VERSION_UNIQUE_NAME@ +#define __os_write __os_write@DB_VERSION_UNIQUE_NAME@ +#define __os_seek __os_seek@DB_VERSION_UNIQUE_NAME@ +#define __os_sleep __os_sleep@DB_VERSION_UNIQUE_NAME@ +#define __os_spin __os_spin@DB_VERSION_UNIQUE_NAME@ +#define __os_yield __os_yield@DB_VERSION_UNIQUE_NAME@ +#define __os_exists __os_exists@DB_VERSION_UNIQUE_NAME@ +#define __os_ioinfo __os_ioinfo@DB_VERSION_UNIQUE_NAME@ +#define __os_tmpdir __os_tmpdir@DB_VERSION_UNIQUE_NAME@ +#define __os_region_unlink __os_region_unlink@DB_VERSION_UNIQUE_NAME@ +#define __os_unlink __os_unlink@DB_VERSION_UNIQUE_NAME@ +#if defined(DB_WIN32) +#define __os_win32_errno __os_win32_errno@DB_VERSION_UNIQUE_NAME@ +#endif +#define __os_fsync __os_fsync@DB_VERSION_UNIQUE_NAME@ +#define __os_openhandle __os_openhandle@DB_VERSION_UNIQUE_NAME@ +#define __os_closehandle __os_closehandle@DB_VERSION_UNIQUE_NAME@ +#define __os_io __os_io@DB_VERSION_UNIQUE_NAME@ +#define __os_read __os_read@DB_VERSION_UNIQUE_NAME@ +#define __os_write __os_write@DB_VERSION_UNIQUE_NAME@ +#define __os_exists __os_exists@DB_VERSION_UNIQUE_NAME@ +#define __os_ioinfo __os_ioinfo@DB_VERSION_UNIQUE_NAME@ +#define __os_is_winnt __os_is_winnt@DB_VERSION_UNIQUE_NAME@ +#define __qam_position __qam_position@DB_VERSION_UNIQUE_NAME@ +#define __qam_pitem __qam_pitem@DB_VERSION_UNIQUE_NAME@ +#define __qam_append __qam_append@DB_VERSION_UNIQUE_NAME@ +#define __qam_c_dup __qam_c_dup@DB_VERSION_UNIQUE_NAME@ +#define __qam_c_init __qam_c_init@DB_VERSION_UNIQUE_NAME@ +#define __qam_truncate __qam_truncate@DB_VERSION_UNIQUE_NAME@ +#define __qam_incfirst_log __qam_incfirst_log@DB_VERSION_UNIQUE_NAME@ +#define __qam_incfirst_getpgnos __qam_incfirst_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __qam_incfirst_print __qam_incfirst_print@DB_VERSION_UNIQUE_NAME@ +#define __qam_incfirst_read __qam_incfirst_read@DB_VERSION_UNIQUE_NAME@ +#define __qam_mvptr_log __qam_mvptr_log@DB_VERSION_UNIQUE_NAME@ +#define __qam_mvptr_getpgnos __qam_mvptr_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __qam_mvptr_print __qam_mvptr_print@DB_VERSION_UNIQUE_NAME@ +#define __qam_mvptr_read __qam_mvptr_read@DB_VERSION_UNIQUE_NAME@ +#define __qam_del_log __qam_del_log@DB_VERSION_UNIQUE_NAME@ +#define __qam_del_getpgnos __qam_del_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __qam_del_print __qam_del_print@DB_VERSION_UNIQUE_NAME@ +#define __qam_del_read __qam_del_read@DB_VERSION_UNIQUE_NAME@ +#define __qam_add_log __qam_add_log@DB_VERSION_UNIQUE_NAME@ +#define __qam_add_getpgnos __qam_add_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __qam_add_print __qam_add_print@DB_VERSION_UNIQUE_NAME@ +#define __qam_add_read __qam_add_read@DB_VERSION_UNIQUE_NAME@ +#define __qam_delext_log __qam_delext_log@DB_VERSION_UNIQUE_NAME@ +#define __qam_delext_getpgnos __qam_delext_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __qam_delext_print __qam_delext_print@DB_VERSION_UNIQUE_NAME@ +#define __qam_delext_read __qam_delext_read@DB_VERSION_UNIQUE_NAME@ +#define __qam_init_print __qam_init_print@DB_VERSION_UNIQUE_NAME@ +#define __qam_init_getpgnos __qam_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __qam_init_recover __qam_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __qam_mswap __qam_mswap@DB_VERSION_UNIQUE_NAME@ +#define __qam_pgin_out __qam_pgin_out@DB_VERSION_UNIQUE_NAME@ +#define __qam_fprobe __qam_fprobe@DB_VERSION_UNIQUE_NAME@ +#define __qam_fclose __qam_fclose@DB_VERSION_UNIQUE_NAME@ +#define __qam_fremove __qam_fremove@DB_VERSION_UNIQUE_NAME@ +#define __qam_sync __qam_sync@DB_VERSION_UNIQUE_NAME@ +#define __qam_gen_filelist __qam_gen_filelist@DB_VERSION_UNIQUE_NAME@ +#define __qam_extent_names __qam_extent_names@DB_VERSION_UNIQUE_NAME@ +#define __qam_db_create __qam_db_create@DB_VERSION_UNIQUE_NAME@ +#define __qam_db_close __qam_db_close@DB_VERSION_UNIQUE_NAME@ +#define __db_prqueue __db_prqueue@DB_VERSION_UNIQUE_NAME@ +#define __qam_remove __qam_remove@DB_VERSION_UNIQUE_NAME@ +#define __qam_rename __qam_rename@DB_VERSION_UNIQUE_NAME@ +#define __qam_open __qam_open@DB_VERSION_UNIQUE_NAME@ +#define __qam_metachk __qam_metachk@DB_VERSION_UNIQUE_NAME@ +#define __qam_new_file __qam_new_file@DB_VERSION_UNIQUE_NAME@ +#define __qam_incfirst_recover __qam_incfirst_recover@DB_VERSION_UNIQUE_NAME@ +#define __qam_mvptr_recover __qam_mvptr_recover@DB_VERSION_UNIQUE_NAME@ +#define __qam_del_recover __qam_del_recover@DB_VERSION_UNIQUE_NAME@ +#define __qam_delext_recover __qam_delext_recover@DB_VERSION_UNIQUE_NAME@ +#define __qam_add_recover __qam_add_recover@DB_VERSION_UNIQUE_NAME@ +#define __qam_stat __qam_stat@DB_VERSION_UNIQUE_NAME@ +#define __qam_31_qammeta __qam_31_qammeta@DB_VERSION_UNIQUE_NAME@ +#define __qam_32_qammeta __qam_32_qammeta@DB_VERSION_UNIQUE_NAME@ +#define __qam_vrfy_meta __qam_vrfy_meta@DB_VERSION_UNIQUE_NAME@ +#define __qam_vrfy_data __qam_vrfy_data@DB_VERSION_UNIQUE_NAME@ +#define __qam_vrfy_structure __qam_vrfy_structure@DB_VERSION_UNIQUE_NAME@ +#define __rep_dbenv_create __rep_dbenv_create@DB_VERSION_UNIQUE_NAME@ +#define __rep_process_message __rep_process_message@DB_VERSION_UNIQUE_NAME@ +#define __rep_process_txn __rep_process_txn@DB_VERSION_UNIQUE_NAME@ +#define __rep_region_init __rep_region_init@DB_VERSION_UNIQUE_NAME@ +#define __rep_region_destroy __rep_region_destroy@DB_VERSION_UNIQUE_NAME@ +#define __rep_dbenv_close __rep_dbenv_close@DB_VERSION_UNIQUE_NAME@ +#define __rep_preclose __rep_preclose@DB_VERSION_UNIQUE_NAME@ +#define __rep_check_alloc __rep_check_alloc@DB_VERSION_UNIQUE_NAME@ +#define __rep_send_message __rep_send_message@DB_VERSION_UNIQUE_NAME@ +#define __rep_new_master __rep_new_master@DB_VERSION_UNIQUE_NAME@ +#define __rep_lockpgno_init __rep_lockpgno_init@DB_VERSION_UNIQUE_NAME@ +#define __rep_unlockpages __rep_unlockpages@DB_VERSION_UNIQUE_NAME@ +#define __rep_lockpages __rep_lockpages@DB_VERSION_UNIQUE_NAME@ +#define __rep_is_client __rep_is_client@DB_VERSION_UNIQUE_NAME@ +#define __rep_send_vote __rep_send_vote@DB_VERSION_UNIQUE_NAME@ +#define __rep_grow_sites __rep_grow_sites@DB_VERSION_UNIQUE_NAME@ +#define __rep_print_message __rep_print_message@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_envrpcserver __dbcl_envrpcserver@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_open_wrap __dbcl_env_open_wrap@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_open_wrap __dbcl_db_open_wrap@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_refresh __dbcl_refresh@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_retcopy __dbcl_retcopy@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_end __dbcl_txn_end@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_setup __dbcl_txn_setup@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_c_refresh __dbcl_c_refresh@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_c_setup __dbcl_c_setup@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbclose_common __dbcl_dbclose_common@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_alloc __dbcl_env_alloc@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_app_dispatch __dbcl_set_app_dispatch@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_cachesize __dbcl_env_cachesize@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_close __dbcl_env_close@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_create __dbcl_env_create@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_data_dir __dbcl_set_data_dir@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_dbremove __dbcl_env_dbremove@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_dbrename __dbcl_env_dbrename@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_encrypt __dbcl_env_encrypt@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_set_feedback __dbcl_env_set_feedback@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_flags __dbcl_env_flags@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lg_bsize __dbcl_set_lg_bsize@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lg_dir __dbcl_set_lg_dir@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lg_max __dbcl_set_lg_max@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lg_regionmax __dbcl_set_lg_regionmax@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lk_conflict __dbcl_set_lk_conflict@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lk_detect __dbcl_set_lk_detect@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lk_max __dbcl_set_lk_max@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lk_max_locks __dbcl_set_lk_max_locks@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lk_max_lockers __dbcl_set_lk_max_lockers@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_lk_max_objects __dbcl_set_lk_max_objects@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_mp_mmapsize __dbcl_set_mp_mmapsize@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_open __dbcl_env_open@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_paniccall __dbcl_env_paniccall@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_remove __dbcl_env_remove@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_shm_key __dbcl_set_shm_key@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_tas_spins __dbcl_set_tas_spins@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_timeout __dbcl_set_timeout@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_tmp_dir __dbcl_set_tmp_dir@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_tx_max __dbcl_set_tx_max@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_tx_timestamp __dbcl_set_tx_timestamp@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_set_verbose __dbcl_set_verbose@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_abort __dbcl_txn_abort@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_begin __dbcl_txn_begin@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_checkpoint __dbcl_txn_checkpoint@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_commit __dbcl_txn_commit@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_discard __dbcl_txn_discard@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_prepare __dbcl_txn_prepare@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_recover __dbcl_txn_recover@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_stat __dbcl_txn_stat@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_timeout __dbcl_txn_timeout@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_elect __dbcl_rep_elect@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_flush __dbcl_rep_flush@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_process_message __dbcl_rep_process_message@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_set_limit __dbcl_rep_set_limit@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_set_request __dbcl_rep_set_request@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_set_rep_transport __dbcl_rep_set_rep_transport@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_start __dbcl_rep_start@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_rep_stat __dbcl_rep_stat@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_alloc __dbcl_db_alloc@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_associate __dbcl_db_associate@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_bt_compare __dbcl_db_bt_compare@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_bt_maxkey __dbcl_db_bt_maxkey@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_bt_minkey __dbcl_db_bt_minkey@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_bt_prefix __dbcl_db_bt_prefix@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_set_append_recno __dbcl_db_set_append_recno@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_cache_priority __dbcl_db_cache_priority@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_cachesize __dbcl_db_cachesize@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_close __dbcl_db_close@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_create __dbcl_db_create@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_del __dbcl_db_del@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_dup_compare __dbcl_db_dup_compare@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_encrypt __dbcl_db_encrypt@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_extentsize __dbcl_db_extentsize@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_fd __dbcl_db_fd@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_feedback __dbcl_db_feedback@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_flags __dbcl_db_flags@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_get __dbcl_db_get@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_h_ffactor __dbcl_db_h_ffactor@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_h_hash __dbcl_db_h_hash@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_h_nelem __dbcl_db_h_nelem@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_key_range __dbcl_db_key_range@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_lorder __dbcl_db_lorder@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_open __dbcl_db_open@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_pagesize __dbcl_db_pagesize@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_panic __dbcl_db_panic@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_pget __dbcl_db_pget@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_put __dbcl_db_put@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_re_delim __dbcl_db_re_delim@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_re_len __dbcl_db_re_len@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_re_pad __dbcl_db_re_pad@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_re_source __dbcl_db_re_source@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_remove __dbcl_db_remove@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_rename __dbcl_db_rename@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_stat __dbcl_db_stat@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_sync __dbcl_db_sync@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_truncate __dbcl_db_truncate@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_upgrade __dbcl_db_upgrade@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_verify __dbcl_db_verify@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_cursor __dbcl_db_cursor@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_join __dbcl_db_join@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_close __dbcl_dbc_close@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_count __dbcl_dbc_count@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_del __dbcl_dbc_del@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_dup __dbcl_dbc_dup@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_get __dbcl_dbc_get@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_pget __dbcl_dbc_pget@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_put __dbcl_dbc_put@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_detect __dbcl_lock_detect@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_get __dbcl_lock_get@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_id __dbcl_lock_id@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_id_free __dbcl_lock_id_free@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_put __dbcl_lock_put@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_stat __dbcl_lock_stat@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_lock_vec __dbcl_lock_vec@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_log_archive __dbcl_log_archive@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_log_cursor __dbcl_log_cursor@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_log_file __dbcl_log_file@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_log_flush __dbcl_log_flush@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_log_put __dbcl_log_put@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_log_stat __dbcl_log_stat@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_memp_fcreate __dbcl_memp_fcreate@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_memp_register __dbcl_memp_register@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_memp_stat __dbcl_memp_stat@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_memp_sync __dbcl_memp_sync@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_memp_trickle __dbcl_memp_trickle@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_close_ret __dbcl_env_close_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_create_ret __dbcl_env_create_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_open_ret __dbcl_env_open_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_env_remove_ret __dbcl_env_remove_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_abort_ret __dbcl_txn_abort_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_begin_ret __dbcl_txn_begin_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_commit_ret __dbcl_txn_commit_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_discard_ret __dbcl_txn_discard_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_txn_recover_ret __dbcl_txn_recover_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_close_ret __dbcl_db_close_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_create_ret __dbcl_db_create_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_get_ret __dbcl_db_get_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_key_range_ret __dbcl_db_key_range_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_open_ret __dbcl_db_open_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_pget_ret __dbcl_db_pget_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_put_ret __dbcl_db_put_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_remove_ret __dbcl_db_remove_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_rename_ret __dbcl_db_rename_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_stat_ret __dbcl_db_stat_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_truncate_ret __dbcl_db_truncate_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_cursor_ret __dbcl_db_cursor_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_db_join_ret __dbcl_db_join_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_close_ret __dbcl_dbc_close_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_count_ret __dbcl_dbc_count_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_dup_ret __dbcl_dbc_dup_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_get_ret __dbcl_dbc_get_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_pget_ret __dbcl_dbc_pget_ret@DB_VERSION_UNIQUE_NAME@ +#define __dbcl_dbc_put_ret __dbcl_dbc_put_ret@DB_VERSION_UNIQUE_NAME@ +#define __env_cachesize_proc __env_cachesize_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_close_proc __env_close_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_create_proc __env_create_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_dbremove_proc __env_dbremove_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_dbrename_proc __env_dbrename_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_encrypt_proc __env_encrypt_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_flags_proc __env_flags_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_open_proc __env_open_proc@DB_VERSION_UNIQUE_NAME@ +#define __env_remove_proc __env_remove_proc@DB_VERSION_UNIQUE_NAME@ +#define __txn_abort_proc __txn_abort_proc@DB_VERSION_UNIQUE_NAME@ +#define __txn_begin_proc __txn_begin_proc@DB_VERSION_UNIQUE_NAME@ +#define __txn_commit_proc __txn_commit_proc@DB_VERSION_UNIQUE_NAME@ +#define __txn_discard_proc __txn_discard_proc@DB_VERSION_UNIQUE_NAME@ +#define __txn_prepare_proc __txn_prepare_proc@DB_VERSION_UNIQUE_NAME@ +#define __txn_recover_proc __txn_recover_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_bt_maxkey_proc __db_bt_maxkey_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_associate_proc __db_associate_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_bt_minkey_proc __db_bt_minkey_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_close_proc __db_close_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_create_proc __db_create_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_del_proc __db_del_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_encrypt_proc __db_encrypt_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_extentsize_proc __db_extentsize_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_flags_proc __db_flags_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_get_proc __db_get_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_h_ffactor_proc __db_h_ffactor_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_h_nelem_proc __db_h_nelem_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_key_range_proc __db_key_range_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_lorder_proc __db_lorder_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_open_proc __db_open_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_pagesize_proc __db_pagesize_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_pget_proc __db_pget_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_put_proc __db_put_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_re_delim_proc __db_re_delim_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_re_len_proc __db_re_len_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_re_pad_proc __db_re_pad_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_remove_proc __db_remove_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_rename_proc __db_rename_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_stat_proc __db_stat_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_sync_proc __db_sync_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_truncate_proc __db_truncate_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_cursor_proc __db_cursor_proc@DB_VERSION_UNIQUE_NAME@ +#define __db_join_proc __db_join_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_close_proc __dbc_close_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_count_proc __dbc_count_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_del_proc __dbc_del_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_dup_proc __dbc_dup_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_get_proc __dbc_get_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_pget_proc __dbc_pget_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbc_put_proc __dbc_put_proc@DB_VERSION_UNIQUE_NAME@ +#define __dbsrv_settimeout __dbsrv_settimeout@DB_VERSION_UNIQUE_NAME@ +#define __dbsrv_timeout __dbsrv_timeout@DB_VERSION_UNIQUE_NAME@ +#define __dbclear_ctp __dbclear_ctp@DB_VERSION_UNIQUE_NAME@ +#define __dbdel_ctp __dbdel_ctp@DB_VERSION_UNIQUE_NAME@ +#define new_ct_ent new_ct_ent@DB_VERSION_UNIQUE_NAME@ +#define get_tableent get_tableent@DB_VERSION_UNIQUE_NAME@ +#define __dbsrv_sharedb __dbsrv_sharedb@DB_VERSION_UNIQUE_NAME@ +#define __dbsrv_shareenv __dbsrv_shareenv@DB_VERSION_UNIQUE_NAME@ +#define __dbsrv_active __dbsrv_active@DB_VERSION_UNIQUE_NAME@ +#define __db_close_int __db_close_int@DB_VERSION_UNIQUE_NAME@ +#define __dbc_close_int __dbc_close_int@DB_VERSION_UNIQUE_NAME@ +#define __dbenv_close_int __dbenv_close_int@DB_VERSION_UNIQUE_NAME@ +#define get_home get_home@DB_VERSION_UNIQUE_NAME@ +#define bdb_HCommand bdb_HCommand@DB_VERSION_UNIQUE_NAME@ +#if DB_DBM_HSEARCH != 0 +#define bdb_NdbmOpen bdb_NdbmOpen@DB_VERSION_UNIQUE_NAME@ +#endif +#if DB_DBM_HSEARCH != 0 +#define bdb_DbmCommand bdb_DbmCommand@DB_VERSION_UNIQUE_NAME@ +#endif +#define ndbm_Cmd ndbm_Cmd@DB_VERSION_UNIQUE_NAME@ +#define _DbInfoDelete _DbInfoDelete@DB_VERSION_UNIQUE_NAME@ +#define db_Cmd db_Cmd@DB_VERSION_UNIQUE_NAME@ +#define dbc_Cmd dbc_Cmd@DB_VERSION_UNIQUE_NAME@ +#define env_Cmd env_Cmd@DB_VERSION_UNIQUE_NAME@ +#define tcl_EnvRemove tcl_EnvRemove@DB_VERSION_UNIQUE_NAME@ +#define tcl_EnvVerbose tcl_EnvVerbose@DB_VERSION_UNIQUE_NAME@ +#define tcl_EnvAttr tcl_EnvAttr@DB_VERSION_UNIQUE_NAME@ +#define tcl_EnvTest tcl_EnvTest@DB_VERSION_UNIQUE_NAME@ +#define _NewInfo _NewInfo@DB_VERSION_UNIQUE_NAME@ +#define _NameToPtr _NameToPtr@DB_VERSION_UNIQUE_NAME@ +#define _PtrToInfo _PtrToInfo@DB_VERSION_UNIQUE_NAME@ +#define _NameToInfo _NameToInfo@DB_VERSION_UNIQUE_NAME@ +#define _SetInfoData _SetInfoData@DB_VERSION_UNIQUE_NAME@ +#define _DeleteInfo _DeleteInfo@DB_VERSION_UNIQUE_NAME@ +#define _SetListElem _SetListElem@DB_VERSION_UNIQUE_NAME@ +#define _SetListElemInt _SetListElemInt@DB_VERSION_UNIQUE_NAME@ +#define _SetListRecnoElem _SetListRecnoElem@DB_VERSION_UNIQUE_NAME@ +#define _Set3DBTList _Set3DBTList@DB_VERSION_UNIQUE_NAME@ +#define _SetMultiList _SetMultiList@DB_VERSION_UNIQUE_NAME@ +#define _GetGlobPrefix _GetGlobPrefix@DB_VERSION_UNIQUE_NAME@ +#define _ReturnSetup _ReturnSetup@DB_VERSION_UNIQUE_NAME@ +#define _ErrorSetup _ErrorSetup@DB_VERSION_UNIQUE_NAME@ +#define _ErrorFunc _ErrorFunc@DB_VERSION_UNIQUE_NAME@ +#define _GetLsn _GetLsn@DB_VERSION_UNIQUE_NAME@ +#define _GetUInt32 _GetUInt32@DB_VERSION_UNIQUE_NAME@ +#define _GetFlagsList _GetFlagsList@DB_VERSION_UNIQUE_NAME@ +#define _debug_check _debug_check@DB_VERSION_UNIQUE_NAME@ +#define _CopyObjBytes _CopyObjBytes@DB_VERSION_UNIQUE_NAME@ +#define tcl_LockDetect tcl_LockDetect@DB_VERSION_UNIQUE_NAME@ +#define tcl_LockGet tcl_LockGet@DB_VERSION_UNIQUE_NAME@ +#define tcl_LockStat tcl_LockStat@DB_VERSION_UNIQUE_NAME@ +#define tcl_LockTimeout tcl_LockTimeout@DB_VERSION_UNIQUE_NAME@ +#define tcl_LockVec tcl_LockVec@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogArchive tcl_LogArchive@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogCompare tcl_LogCompare@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogFile tcl_LogFile@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogFlush tcl_LogFlush@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogGet tcl_LogGet@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogPut tcl_LogPut@DB_VERSION_UNIQUE_NAME@ +#define tcl_LogStat tcl_LogStat@DB_VERSION_UNIQUE_NAME@ +#define logc_Cmd logc_Cmd@DB_VERSION_UNIQUE_NAME@ +#define _MpInfoDelete _MpInfoDelete@DB_VERSION_UNIQUE_NAME@ +#define tcl_MpSync tcl_MpSync@DB_VERSION_UNIQUE_NAME@ +#define tcl_MpTrickle tcl_MpTrickle@DB_VERSION_UNIQUE_NAME@ +#define tcl_Mp tcl_Mp@DB_VERSION_UNIQUE_NAME@ +#define tcl_MpStat tcl_MpStat@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepElect tcl_RepElect@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepFlush tcl_RepFlush@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepLimit tcl_RepLimit@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepRequest tcl_RepRequest@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepStart tcl_RepStart@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepProcessMessage tcl_RepProcessMessage@DB_VERSION_UNIQUE_NAME@ +#define tcl_RepStat tcl_RepStat@DB_VERSION_UNIQUE_NAME@ +#define _TxnInfoDelete _TxnInfoDelete@DB_VERSION_UNIQUE_NAME@ +#define tcl_TxnCheckpoint tcl_TxnCheckpoint@DB_VERSION_UNIQUE_NAME@ +#define tcl_Txn tcl_Txn@DB_VERSION_UNIQUE_NAME@ +#define tcl_TxnStat tcl_TxnStat@DB_VERSION_UNIQUE_NAME@ +#define tcl_TxnTimeout tcl_TxnTimeout@DB_VERSION_UNIQUE_NAME@ +#define tcl_TxnRecover tcl_TxnRecover@DB_VERSION_UNIQUE_NAME@ +#define bdb_RandCommand bdb_RandCommand@DB_VERSION_UNIQUE_NAME@ +#define tcl_Mutex tcl_Mutex@DB_VERSION_UNIQUE_NAME@ +#define __txn_begin __txn_begin@DB_VERSION_UNIQUE_NAME@ +#define __txn_xa_begin __txn_xa_begin@DB_VERSION_UNIQUE_NAME@ +#define __txn_compensate_begin __txn_compensate_begin@DB_VERSION_UNIQUE_NAME@ +#define __txn_commit __txn_commit@DB_VERSION_UNIQUE_NAME@ +#define __txn_abort __txn_abort@DB_VERSION_UNIQUE_NAME@ +#define __txn_discard __txn_discard@DB_VERSION_UNIQUE_NAME@ +#define __txn_prepare __txn_prepare@DB_VERSION_UNIQUE_NAME@ +#define __txn_id __txn_id@DB_VERSION_UNIQUE_NAME@ +#define __txn_free __txn_free@DB_VERSION_UNIQUE_NAME@ +#define __txn_checkpoint __txn_checkpoint@DB_VERSION_UNIQUE_NAME@ +#define __txn_getckp __txn_getckp@DB_VERSION_UNIQUE_NAME@ +#define __txn_activekids __txn_activekids@DB_VERSION_UNIQUE_NAME@ +#define __txn_force_abort __txn_force_abort@DB_VERSION_UNIQUE_NAME@ +#define __txn_preclose __txn_preclose@DB_VERSION_UNIQUE_NAME@ +#define __txn_reset __txn_reset@DB_VERSION_UNIQUE_NAME@ +#define __txn_regop_log __txn_regop_log@DB_VERSION_UNIQUE_NAME@ +#define __txn_regop_getpgnos __txn_regop_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __txn_regop_print __txn_regop_print@DB_VERSION_UNIQUE_NAME@ +#define __txn_regop_read __txn_regop_read@DB_VERSION_UNIQUE_NAME@ +#define __txn_ckp_log __txn_ckp_log@DB_VERSION_UNIQUE_NAME@ +#define __txn_ckp_getpgnos __txn_ckp_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __txn_ckp_print __txn_ckp_print@DB_VERSION_UNIQUE_NAME@ +#define __txn_ckp_read __txn_ckp_read@DB_VERSION_UNIQUE_NAME@ +#define __txn_child_log __txn_child_log@DB_VERSION_UNIQUE_NAME@ +#define __txn_child_getpgnos __txn_child_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __txn_child_print __txn_child_print@DB_VERSION_UNIQUE_NAME@ +#define __txn_child_read __txn_child_read@DB_VERSION_UNIQUE_NAME@ +#define __txn_xa_regop_log __txn_xa_regop_log@DB_VERSION_UNIQUE_NAME@ +#define __txn_xa_regop_getpgnos __txn_xa_regop_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __txn_xa_regop_print __txn_xa_regop_print@DB_VERSION_UNIQUE_NAME@ +#define __txn_xa_regop_read __txn_xa_regop_read@DB_VERSION_UNIQUE_NAME@ +#define __txn_recycle_log __txn_recycle_log@DB_VERSION_UNIQUE_NAME@ +#define __txn_recycle_getpgnos __txn_recycle_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __txn_recycle_print __txn_recycle_print@DB_VERSION_UNIQUE_NAME@ +#define __txn_recycle_read __txn_recycle_read@DB_VERSION_UNIQUE_NAME@ +#define __txn_init_print __txn_init_print@DB_VERSION_UNIQUE_NAME@ +#define __txn_init_getpgnos __txn_init_getpgnos@DB_VERSION_UNIQUE_NAME@ +#define __txn_init_recover __txn_init_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_dbenv_create __txn_dbenv_create@DB_VERSION_UNIQUE_NAME@ +#define __txn_regop_recover __txn_regop_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_xa_regop_recover __txn_xa_regop_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_ckp_recover __txn_ckp_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_child_recover __txn_child_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_restore_txn __txn_restore_txn@DB_VERSION_UNIQUE_NAME@ +#define __txn_recycle_recover __txn_recycle_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_continue __txn_continue@DB_VERSION_UNIQUE_NAME@ +#define __txn_map_gid __txn_map_gid@DB_VERSION_UNIQUE_NAME@ +#define __txn_recover __txn_recover@DB_VERSION_UNIQUE_NAME@ +#define __txn_get_prepared __txn_get_prepared@DB_VERSION_UNIQUE_NAME@ +#define __txn_open __txn_open@DB_VERSION_UNIQUE_NAME@ +#define __txn_dbenv_refresh __txn_dbenv_refresh@DB_VERSION_UNIQUE_NAME@ +#define __txn_region_destroy __txn_region_destroy@DB_VERSION_UNIQUE_NAME@ +#define __txn_id_set __txn_id_set@DB_VERSION_UNIQUE_NAME@ +#define __txn_stat __txn_stat@DB_VERSION_UNIQUE_NAME@ +#define __txn_remevent __txn_remevent@DB_VERSION_UNIQUE_NAME@ +#define __txn_lockevent __txn_lockevent@DB_VERSION_UNIQUE_NAME@ +#define __txn_remlock __txn_remlock@DB_VERSION_UNIQUE_NAME@ +#define __txn_doevents __txn_doevents@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_open __db_xa_open@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_close __db_xa_close@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_start __db_xa_start@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_end __db_xa_end@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_prepare __db_xa_prepare@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_commit __db_xa_commit@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_recover __db_xa_recover@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_rollback __db_xa_rollback@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_forget __db_xa_forget@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_complete __db_xa_complete@DB_VERSION_UNIQUE_NAME@ +#define __db_xa_create __db_xa_create@DB_VERSION_UNIQUE_NAME@ +#define __db_rmid_to_env __db_rmid_to_env@DB_VERSION_UNIQUE_NAME@ +#define __db_xid_to_txn __db_xid_to_txn@DB_VERSION_UNIQUE_NAME@ +#define __db_map_rmid __db_map_rmid@DB_VERSION_UNIQUE_NAME@ +#define __db_unmap_rmid __db_unmap_rmid@DB_VERSION_UNIQUE_NAME@ +#define __db_map_xid __db_map_xid@DB_VERSION_UNIQUE_NAME@ +#define __db_unmap_xid __db_unmap_xid@DB_VERSION_UNIQUE_NAME@ +#define __db_get_xa_txn __db_get_xa_txn@DB_VERSION_UNIQUE_NAME@ +#define __db_get_current_thread __db_get_current_thread@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_cachesize_msg xdr___env_cachesize_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_cachesize_reply xdr___env_cachesize_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_close_msg xdr___env_close_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_close_reply xdr___env_close_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_create_msg xdr___env_create_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_create_reply xdr___env_create_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_dbremove_msg xdr___env_dbremove_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_dbremove_reply xdr___env_dbremove_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_dbrename_msg xdr___env_dbrename_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_dbrename_reply xdr___env_dbrename_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_encrypt_msg xdr___env_encrypt_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_encrypt_reply xdr___env_encrypt_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_flags_msg xdr___env_flags_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_flags_reply xdr___env_flags_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_open_msg xdr___env_open_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_open_reply xdr___env_open_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_remove_msg xdr___env_remove_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___env_remove_reply xdr___env_remove_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_abort_msg xdr___txn_abort_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_abort_reply xdr___txn_abort_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_begin_msg xdr___txn_begin_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_begin_reply xdr___txn_begin_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_commit_msg xdr___txn_commit_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_commit_reply xdr___txn_commit_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_discard_msg xdr___txn_discard_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_discard_reply xdr___txn_discard_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_prepare_msg xdr___txn_prepare_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_prepare_reply xdr___txn_prepare_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_recover_msg xdr___txn_recover_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___txn_recover_reply xdr___txn_recover_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_associate_msg xdr___db_associate_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_associate_reply xdr___db_associate_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_bt_maxkey_msg xdr___db_bt_maxkey_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_bt_maxkey_reply xdr___db_bt_maxkey_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_bt_minkey_msg xdr___db_bt_minkey_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_bt_minkey_reply xdr___db_bt_minkey_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_close_msg xdr___db_close_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_close_reply xdr___db_close_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_create_msg xdr___db_create_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_create_reply xdr___db_create_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_del_msg xdr___db_del_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_del_reply xdr___db_del_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_encrypt_msg xdr___db_encrypt_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_encrypt_reply xdr___db_encrypt_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_extentsize_msg xdr___db_extentsize_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_extentsize_reply xdr___db_extentsize_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_flags_msg xdr___db_flags_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_flags_reply xdr___db_flags_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_get_msg xdr___db_get_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_get_reply xdr___db_get_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_h_ffactor_msg xdr___db_h_ffactor_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_h_ffactor_reply xdr___db_h_ffactor_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_h_nelem_msg xdr___db_h_nelem_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_h_nelem_reply xdr___db_h_nelem_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_key_range_msg xdr___db_key_range_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_key_range_reply xdr___db_key_range_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_lorder_msg xdr___db_lorder_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_lorder_reply xdr___db_lorder_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_open_msg xdr___db_open_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_open_reply xdr___db_open_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_pagesize_msg xdr___db_pagesize_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_pagesize_reply xdr___db_pagesize_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_pget_msg xdr___db_pget_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_pget_reply xdr___db_pget_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_put_msg xdr___db_put_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_put_reply xdr___db_put_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_re_delim_msg xdr___db_re_delim_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_re_delim_reply xdr___db_re_delim_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_re_len_msg xdr___db_re_len_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_re_len_reply xdr___db_re_len_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_re_pad_msg xdr___db_re_pad_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_re_pad_reply xdr___db_re_pad_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_remove_msg xdr___db_remove_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_remove_reply xdr___db_remove_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_rename_msg xdr___db_rename_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_rename_reply xdr___db_rename_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_stat_msg xdr___db_stat_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_stat_reply xdr___db_stat_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_sync_msg xdr___db_sync_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_sync_reply xdr___db_sync_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_truncate_msg xdr___db_truncate_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_truncate_reply xdr___db_truncate_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_cursor_msg xdr___db_cursor_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_cursor_reply xdr___db_cursor_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_join_msg xdr___db_join_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___db_join_reply xdr___db_join_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_close_msg xdr___dbc_close_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_close_reply xdr___dbc_close_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_count_msg xdr___dbc_count_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_count_reply xdr___dbc_count_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_del_msg xdr___dbc_del_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_del_reply xdr___dbc_del_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_dup_msg xdr___dbc_dup_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_dup_reply xdr___dbc_dup_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_get_msg xdr___dbc_get_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_get_reply xdr___dbc_get_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_pget_msg xdr___dbc_pget_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_pget_reply xdr___dbc_pget_reply@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_put_msg xdr___dbc_put_msg@DB_VERSION_UNIQUE_NAME@ +#define xdr___dbc_put_reply xdr___dbc_put_reply@DB_VERSION_UNIQUE_NAME@ +#define __db_global_values __db_global_values@DB_VERSION_UNIQUE_NAME@ +#define __db_jump __db_jump@DB_VERSION_UNIQUE_NAME@ + +#endif /* !_DB_INT_DEF_IN_ */ diff --git a/db/dbinc_auto/lock_ext.h b/db/dbinc_auto/lock_ext.h new file mode 100644 index 000000000..be6b1d06d --- /dev/null +++ b/db/dbinc_auto/lock_ext.h @@ -0,0 +1,41 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _lock_ext_h_ +#define _lock_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __lock_id __P((DB_ENV *, u_int32_t *)); +int __lock_id_free __P((DB_ENV *, u_int32_t)); +int __lock_vec __P((DB_ENV *, u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); +int __lock_get __P((DB_ENV *, u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); +int __lock_put __P((DB_ENV *, DB_LOCK *)); +int __lock_downgrade __P((DB_ENV *, DB_LOCK *, db_lockmode_t, u_int32_t)); +int __lock_addfamilylocker __P((DB_ENV *, u_int32_t, u_int32_t)); +int __lock_freefamilylocker __P((DB_LOCKTAB *, u_int32_t)); +int __lock_set_timeout __P(( DB_ENV *, u_int32_t, db_timeout_t, u_int32_t)); +int __lock_inherit_timeout __P(( DB_ENV *, u_int32_t, u_int32_t)); +int __lock_getlocker __P((DB_LOCKTAB *, u_int32_t, u_int32_t, int, DB_LOCKER **)); +int __lock_promote __P((DB_LOCKTAB *, DB_LOCKOBJ *, u_int32_t)); +int __lock_expired __P((DB_ENV *, db_timeval_t *, db_timeval_t *)); +int __lock_detect __P((DB_ENV *, u_int32_t, u_int32_t, int *)); +void __lock_dbenv_create __P((DB_ENV *)); +void __lock_dbenv_close __P((DB_ENV *)); +int __lock_open __P((DB_ENV *)); +int __lock_dbenv_refresh __P((DB_ENV *)); +void __lock_region_destroy __P((DB_ENV *, REGINFO *)); +int __lock_id_set __P((DB_ENV *, u_int32_t, u_int32_t)); +int __lock_stat __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t)); +int __lock_dump_region __P((DB_ENV *, char *, FILE *)); +void __lock_printlock __P((DB_LOCKTAB *, struct __db_lock *, int)); +int __lock_cmp __P((const DBT *, DB_LOCKOBJ *)); +int __lock_locker_cmp __P((u_int32_t, DB_LOCKER *)); +u_int32_t __lock_ohash __P((const DBT *)); +u_int32_t __lock_lhash __P((DB_LOCKOBJ *)); +u_int32_t __lock_locker_hash __P((u_int32_t)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_lock_ext_h_ */ diff --git a/db/dbinc_auto/log_ext.h b/db/dbinc_auto/log_ext.h new file mode 100644 index 000000000..6fc69afd2 --- /dev/null +++ b/db/dbinc_auto/log_ext.h @@ -0,0 +1,32 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _log_ext_h_ +#define _log_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __log_open __P((DB_ENV *)); +int __log_find __P((DB_LOG *, int, u_int32_t *, logfile_validity *)); +int __log_valid __P((DB_LOG *, u_int32_t, int, logfile_validity *)); +int __log_dbenv_refresh __P((DB_ENV *)); +int __log_stat __P((DB_ENV *, DB_LOG_STAT **, u_int32_t)); +void __log_get_cached_ckp_lsn __P((DB_ENV *, DB_LSN *)); +void __log_region_destroy __P((DB_ENV *, REGINFO *)); +int __log_vtruncate __P((DB_ENV *, DB_LSN *, DB_LSN *)); +int __log_is_outdated __P((DB_ENV *dbenv, u_int32_t fnum, int *outdatedp)); +int __log_archive __P((DB_ENV *, char **[], u_int32_t)); +int __log_cursor __P((DB_ENV *, DB_LOGC **, u_int32_t)); +void __log_dbenv_create __P((DB_ENV *)); +int __log_put __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t)); +void __log_txn_lsn __P((DB_ENV *, DB_LSN *, u_int32_t *, u_int32_t *)); +int __log_newfile __P((DB_LOG *, DB_LSN *)); +int __log_flush __P((DB_ENV *, const DB_LSN *)); +int __log_file __P((DB_ENV *, const DB_LSN *, char *, size_t)); +int __log_name __P((DB_LOG *, u_int32_t, char **, DB_FH *, u_int32_t)); +int __log_rep_put __P((DB_ENV *, DB_LSN *, const DBT *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_log_ext_h_ */ diff --git a/db/dbinc_auto/mp_ext.h b/db/dbinc_auto/mp_ext.h new file mode 100644 index 000000000..ceadb3d9a --- /dev/null +++ b/db/dbinc_auto/mp_ext.h @@ -0,0 +1,44 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _mp_ext_h_ +#define _mp_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __memp_alloc __P((DB_MPOOL *, REGINFO *, MPOOLFILE *, size_t, roff_t *, void *)); +#ifdef DIAGNOSTIC +void __memp_check_order __P((DB_MPOOL_HASH *)); +#endif +int __memp_bhwrite __P((DB_MPOOL *, DB_MPOOL_HASH *, MPOOLFILE *, BH *, int)); +int __memp_pgread __P((DB_MPOOLFILE *, DB_MUTEX *, BH *, int)); +int __memp_pg __P((DB_MPOOLFILE *, BH *, int)); +void __memp_bhfree __P((DB_MPOOL *, DB_MPOOL_HASH *, BH *, int)); +int __memp_fget __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *)); +int __memp_fcreate __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t)); +int __memp_fopen_int __P((DB_MPOOLFILE *, MPOOLFILE *, const char *, u_int32_t, int, size_t)); +int __memp_fclose_int __P((DB_MPOOLFILE *, u_int32_t)); +int __memp_mf_discard __P((DB_MPOOL *, MPOOLFILE *)); +char * __memp_fn __P((DB_MPOOLFILE *)); +char * __memp_fns __P((DB_MPOOL *, MPOOLFILE *)); +int __memp_fput __P((DB_MPOOLFILE *, void *, u_int32_t)); +int __memp_fset __P((DB_MPOOLFILE *, void *, u_int32_t)); +void __memp_dbenv_create __P((DB_ENV *)); +int __memp_open __P((DB_ENV *)); +int __memp_dbenv_refresh __P((DB_ENV *)); +void __mpool_region_destroy __P((DB_ENV *, REGINFO *)); +int __memp_nameop __P((DB_ENV *, u_int8_t *, const char *, const char *, const char *)); +int __memp_register __P((DB_ENV *, int, int (*)(DB_ENV *, db_pgno_t, void *, DBT *), int (*)(DB_ENV *, db_pgno_t, void *, DBT *))); +int __memp_stat __P((DB_ENV *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t)); +int __memp_dump_region __P((DB_ENV *, char *, FILE *)); +void __memp_stat_hash __P((REGINFO *, MPOOL *, u_int32_t *)); +int __memp_sync __P((DB_ENV *, DB_LSN *)); +int __memp_fsync __P((DB_MPOOLFILE *)); +int __mp_xxx_fh __P((DB_MPOOLFILE *, DB_FH **)); +int __memp_sync_int __P((DB_ENV *, DB_MPOOLFILE *, int, db_sync_op, int *)); +int __memp_trickle __P((DB_ENV *, int, int *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_mp_ext_h_ */ diff --git a/db/dbinc_auto/mutex_ext.h b/db/dbinc_auto/mutex_ext.h new file mode 100644 index 000000000..a40f04d55 --- /dev/null +++ b/db/dbinc_auto/mutex_ext.h @@ -0,0 +1,35 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _mutex_ext_h_ +#define _mutex_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __db_fcntl_mutex_init __P((DB_ENV *, DB_MUTEX *, u_int32_t)); +int __db_fcntl_mutex_lock __P((DB_ENV *, DB_MUTEX *)); +int __db_fcntl_mutex_unlock __P((DB_ENV *, DB_MUTEX *)); +int __db_fcntl_mutex_destroy __P((DB_MUTEX *)); +int __db_pthread_mutex_init __P((DB_ENV *, DB_MUTEX *, u_int32_t)); +int __db_pthread_mutex_lock __P((DB_ENV *, DB_MUTEX *)); +int __db_pthread_mutex_unlock __P((DB_ENV *, DB_MUTEX *)); +int __db_pthread_mutex_destroy __P((DB_MUTEX *)); +int __db_tas_mutex_init __P((DB_ENV *, DB_MUTEX *, u_int32_t)); +int __db_tas_mutex_lock __P((DB_ENV *, DB_MUTEX *)); +int __db_tas_mutex_unlock __P((DB_ENV *, DB_MUTEX *)); +int __db_tas_mutex_destroy __P((DB_MUTEX *)); +int __db_win32_mutex_init __P((DB_ENV *, DB_MUTEX *, u_int32_t)); +int __db_win32_mutex_lock __P((DB_ENV *, DB_MUTEX *)); +int __db_win32_mutex_unlock __P((DB_ENV *, DB_MUTEX *)); +int __db_win32_mutex_destroy __P((DB_MUTEX *)); +int __db_mutex_setup __P((DB_ENV *, REGINFO *, void *, u_int32_t)); +void __db_mutex_free __P((DB_ENV *, REGINFO *, DB_MUTEX *)); +void __db_shreg_locks_clear __P((DB_MUTEX *, REGINFO *, REGMAINT *)); +void __db_shreg_locks_destroy __P((REGINFO *, REGMAINT *)); +int __db_shreg_mutex_init __P((DB_ENV *, DB_MUTEX *, u_int32_t, u_int32_t, REGINFO *, REGMAINT *)); +void __db_shreg_maintinit __P((REGINFO *, void *addr, size_t)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_mutex_ext_h_ */ diff --git a/db/dbinc_auto/os_ext.h b/db/dbinc_auto/os_ext.h new file mode 100644 index 000000000..0a2e5ab20 --- /dev/null +++ b/db/dbinc_auto/os_ext.h @@ -0,0 +1,74 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _os_ext_h_ +#define _os_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __os_abspath __P((const char *)); +int __os_umalloc __P((DB_ENV *, size_t, void *)); +int __os_urealloc __P((DB_ENV *, size_t, void *)); +int __os_ufree __P((DB_ENV *, void *)); +int __os_strdup __P((DB_ENV *, const char *, void *)); +int __os_calloc __P((DB_ENV *, size_t, size_t, void *)); +int __os_malloc __P((DB_ENV *, size_t, void *)); +int __os_realloc __P((DB_ENV *, size_t, void *)); +void __os_free __P((DB_ENV *, void *)); +void *__ua_memcpy __P((void *, const void *, size_t)); +int __os_clock __P((DB_ENV *, u_int32_t *, u_int32_t *)); +int __os_fs_notzero __P((void)); +int __os_dirlist __P((DB_ENV *, const char *, char ***, int *)); +void __os_dirfree __P((DB_ENV *, char **, int)); +int __os_get_errno_ret_zero __P((void)); +int __os_get_errno __P((void)); +void __os_set_errno __P((int)); +int __os_fileid __P((DB_ENV *, const char *, int, u_int8_t *)); +int __os_fsync __P((DB_ENV *, DB_FH *)); +int __os_openhandle __P((DB_ENV *, const char *, int, int, DB_FH *)); +int __os_closehandle __P((DB_ENV *, DB_FH *)); +void __os_id __P((u_int32_t *)); +int __os_r_sysattach __P((DB_ENV *, REGINFO *, REGION *)); +int __os_r_sysdetach __P((DB_ENV *, REGINFO *, int)); +int __os_mapfile __P((DB_ENV *, char *, DB_FH *, size_t, int, void **)); +int __os_unmapfile __P((DB_ENV *, void *, size_t)); +u_int32_t __db_oflags __P((int)); +int __db_omode __P((const char *)); +int __os_open __P((DB_ENV *, const char *, u_int32_t, int, DB_FH *)); +#ifdef HAVE_QNX +int __os_shmname __P((DB_ENV *, const char *, char **)); +#endif +int __os_r_attach __P((DB_ENV *, REGINFO *, REGION *)); +int __os_r_detach __P((DB_ENV *, REGINFO *, int)); +int __os_rename __P((DB_ENV *, const char *, const char *, u_int32_t)); +int __os_isroot __P((void)); +char *__db_rpath __P((const char *)); +int __os_io __P((DB_ENV *, DB_IO *, int, size_t *)); +int __os_read __P((DB_ENV *, DB_FH *, void *, size_t, size_t *)); +int __os_write __P((DB_ENV *, DB_FH *, void *, size_t, size_t *)); +int __os_seek __P((DB_ENV *, DB_FH *, size_t, db_pgno_t, u_int32_t, int, DB_OS_SEEK)); +int __os_sleep __P((DB_ENV *, u_long, u_long)); +int __os_spin __P((DB_ENV *)); +void __os_yield __P((DB_ENV*, u_long)); +int __os_exists __P((const char *, int *)); +int __os_ioinfo __P((DB_ENV *, const char *, DB_FH *, u_int32_t *, u_int32_t *, u_int32_t *)); +int __os_tmpdir __P((DB_ENV *, u_int32_t)); +int __os_region_unlink __P((DB_ENV *, const char *)); +int __os_unlink __P((DB_ENV *, const char *)); +#if defined(DB_WIN32) +int __os_win32_errno __P((void)); +#endif +int __os_fsync __P((DB_ENV *, DB_FH *)); +int __os_openhandle __P((DB_ENV *, const char *, int, int, DB_FH *)); +int __os_closehandle __P((DB_ENV *, DB_FH *)); +int __os_io __P((DB_ENV *, DB_IO *, int, size_t *)); +int __os_read __P((DB_ENV *, DB_FH *, void *, size_t, size_t *)); +int __os_write __P((DB_ENV *, DB_FH *, void *, size_t, size_t *)); +int __os_exists __P((const char *, int *)); +int __os_ioinfo __P((DB_ENV *, const char *, DB_FH *, u_int32_t *, u_int32_t *, u_int32_t *)); +int __os_is_winnt __P((void)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_os_ext_h_ */ diff --git a/db/dbinc_auto/qam_auto.h b/db/dbinc_auto/qam_auto.h new file mode 100644 index 000000000..655c6d028 --- /dev/null +++ b/db/dbinc_auto/qam_auto.h @@ -0,0 +1,70 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __qam_AUTO_H +#define __qam_AUTO_H +#define DB___qam_incfirst 84 +typedef struct ___qam_incfirst_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + db_recno_t recno; + db_pgno_t meta_pgno; +} __qam_incfirst_args; + +#define DB___qam_mvptr 85 +typedef struct ___qam_mvptr_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t fileid; + db_recno_t old_first; + db_recno_t new_first; + db_recno_t old_cur; + db_recno_t new_cur; + DB_LSN metalsn; + db_pgno_t meta_pgno; +} __qam_mvptr_args; + +#define DB___qam_del 79 +typedef struct ___qam_del_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + DB_LSN lsn; + db_pgno_t pgno; + u_int32_t indx; + db_recno_t recno; +} __qam_del_args; + +#define DB___qam_add 80 +typedef struct ___qam_add_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + DB_LSN lsn; + db_pgno_t pgno; + u_int32_t indx; + db_recno_t recno; + DBT data; + u_int32_t vflag; + DBT olddata; +} __qam_add_args; + +#define DB___qam_delext 83 +typedef struct ___qam_delext_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + int32_t fileid; + DB_LSN lsn; + db_pgno_t pgno; + u_int32_t indx; + db_recno_t recno; + DBT data; +} __qam_delext_args; + +#endif diff --git a/db/dbinc_auto/qam_ext.h b/db/dbinc_auto/qam_ext.h new file mode 100644 index 000000000..74efd5d0e --- /dev/null +++ b/db/dbinc_auto/qam_ext.h @@ -0,0 +1,69 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _qam_ext_h_ +#define _qam_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __qam_position __P((DBC *, db_recno_t *, qam_position_mode, int *)); +int __qam_pitem __P((DBC *, QPAGE *, u_int32_t, db_recno_t, DBT *)); +int __qam_append __P((DBC *, DBT *, DBT *)); +int __qam_c_dup __P((DBC *, DBC *)); +int __qam_c_init __P((DBC *)); +int __qam_truncate __P((DB *, DB_TXN *, u_int32_t *)); +int __qam_incfirst_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, db_recno_t, db_pgno_t)); +int __qam_incfirst_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_incfirst_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_incfirst_read __P((DB_ENV *, void *, __qam_incfirst_args **)); +int __qam_mvptr_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, db_recno_t, db_recno_t, db_recno_t, db_recno_t, DB_LSN *, db_pgno_t)); +int __qam_mvptr_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_mvptr_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_mvptr_read __P((DB_ENV *, void *, __qam_mvptr_args **)); +int __qam_del_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_recno_t)); +int __qam_del_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_del_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_del_read __P((DB_ENV *, void *, __qam_del_args **)); +int __qam_add_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_recno_t, const DBT *, u_int32_t, const DBT *)); +int __qam_add_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_add_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_add_read __P((DB_ENV *, void *, __qam_add_args **)); +int __qam_delext_log __P((DB *, DB_TXN *, DB_LSN *, u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_recno_t, const DBT *)); +int __qam_delext_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_delext_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_delext_read __P((DB_ENV *, void *, __qam_delext_args **)); +int __qam_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __qam_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __qam_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __qam_mswap __P((PAGE *)); +int __qam_pgin_out __P((DB_ENV *, db_pgno_t, void *, DBT *)); +int __qam_fprobe __P((DB *, db_pgno_t, void *, qam_probe_mode, u_int32_t)); +int __qam_fclose __P((DB *, db_pgno_t)); +int __qam_fremove __P((DB *, db_pgno_t)); +int __qam_sync __P((DB *, u_int32_t)); +int __qam_gen_filelist __P(( DB *, QUEUE_FILELIST **)); +int __qam_extent_names __P((DB_ENV *, char *, char ***)); +int __qam_db_create __P((DB *)); +int __qam_db_close __P((DB *)); +int __db_prqueue __P((DB *, FILE *, u_int32_t)); +int __qam_remove __P((DB *, DB_TXN *, const char *, const char *, DB_LSN *)); +int __qam_rename __P((DB *, DB_TXN *, const char *, const char *, const char *)); +int __qam_open __P((DB *, DB_TXN *, const char *, db_pgno_t, int, u_int32_t)); +int __qam_metachk __P((DB *, const char *, QMETA *)); +int __qam_new_file __P((DB *, DB_TXN *, DB_FH *, const char *)); +int __qam_incfirst_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_mvptr_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_del_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_delext_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_add_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __qam_stat __P((DB *, void *, u_int32_t)); +int __qam_31_qammeta __P((DB *, char *, u_int8_t *)); +int __qam_32_qammeta __P((DB *, char *, u_int8_t *)); +int __qam_vrfy_meta __P((DB *, VRFY_DBINFO *, QMETA *, db_pgno_t, u_int32_t)); +int __qam_vrfy_data __P((DB *, VRFY_DBINFO *, QPAGE *, db_pgno_t, u_int32_t)); +int __qam_vrfy_structure __P((DB *, VRFY_DBINFO *, u_int32_t)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_qam_ext_h_ */ diff --git a/db/dbinc_auto/rep_ext.h b/db/dbinc_auto/rep_ext.h new file mode 100644 index 000000000..aba997734 --- /dev/null +++ b/db/dbinc_auto/rep_ext.h @@ -0,0 +1,30 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _rep_ext_h_ +#define _rep_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __rep_dbenv_create __P((DB_ENV *)); +int __rep_process_message __P((DB_ENV *, DBT *, DBT *, int *)); +int __rep_process_txn __P((DB_ENV *, DBT *)); +int __rep_region_init __P((DB_ENV *)); +int __rep_region_destroy __P((DB_ENV *)); +int __rep_dbenv_close __P((DB_ENV *)); +int __rep_preclose __P((DB_ENV *, int)); +int __rep_check_alloc __P((DB_ENV *, TXN_RECS *, int)); +int __rep_send_message __P((DB_ENV *, int, u_int32_t, DB_LSN *, const DBT *, u_int32_t)); +int __rep_new_master __P((DB_ENV *, REP_CONTROL *, int)); +int __rep_lockpgno_init __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __rep_unlockpages __P((DB_ENV *, u_int32_t)); +int __rep_lockpages __P((DB_ENV *, int (**)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t, DB_LSN *, DB_LSN *, TXN_RECS *, u_int32_t)); +int __rep_is_client __P((DB_ENV *)); +int __rep_send_vote __P((DB_ENV *, DB_LSN *, int, int, int)); +int __rep_grow_sites __P((DB_ENV *dbenv, int nsites)); +void __rep_print_message __P((int, REP_CONTROL *, char *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_rep_ext_h_ */ diff --git a/db/dbinc_auto/rpc_client_ext.h b/db/dbinc_auto/rpc_client_ext.h new file mode 100644 index 000000000..9634b34ab --- /dev/null +++ b/db/dbinc_auto/rpc_client_ext.h @@ -0,0 +1,167 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _rpc_client_ext_h_ +#define _rpc_client_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __dbcl_envrpcserver __P((DB_ENV *, void *, const char *, long, long, u_int32_t)); +int __dbcl_env_open_wrap __P((DB_ENV *, const char *, u_int32_t, int)); +int __dbcl_db_open_wrap __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int)); +int __dbcl_refresh __P((DB_ENV *)); +int __dbcl_retcopy __P((DB_ENV *, DBT *, void *, u_int32_t, void **, u_int32_t *)); +void __dbcl_txn_end __P((DB_TXN *)); +void __dbcl_txn_setup __P((DB_ENV *, DB_TXN *, DB_TXN *, u_int32_t)); +void __dbcl_c_refresh __P((DBC *)); +int __dbcl_c_setup __P((long, DB *, DBC **)); +int __dbcl_dbclose_common __P((DB *)); +int __dbcl_env_alloc __P((DB_ENV *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); +int __dbcl_set_app_dispatch __P((DB_ENV *, int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops))); +int __dbcl_env_cachesize __P((DB_ENV *, u_int32_t, u_int32_t, int)); +int __dbcl_env_close __P((DB_ENV *, u_int32_t)); +int __dbcl_env_create __P((DB_ENV *, long)); +int __dbcl_set_data_dir __P((DB_ENV *, const char *)); +int __dbcl_env_dbremove __P((DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)); +int __dbcl_env_dbrename __P((DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)); +int __dbcl_env_encrypt __P((DB_ENV *, const char *, u_int32_t)); +int __dbcl_env_set_feedback __P((DB_ENV *, void (*)(DB_ENV *, int, int))); +int __dbcl_env_flags __P((DB_ENV *, u_int32_t, int)); +int __dbcl_set_lg_bsize __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lg_dir __P((DB_ENV *, const char *)); +int __dbcl_set_lg_max __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lg_regionmax __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lk_conflict __P((DB_ENV *, u_int8_t *, int)); +int __dbcl_set_lk_detect __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lk_max __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lk_max_locks __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lk_max_lockers __P((DB_ENV *, u_int32_t)); +int __dbcl_set_lk_max_objects __P((DB_ENV *, u_int32_t)); +int __dbcl_set_mp_mmapsize __P((DB_ENV *, size_t)); +int __dbcl_env_open __P((DB_ENV *, const char *, u_int32_t, int)); +int __dbcl_env_paniccall __P((DB_ENV *, void (*)(DB_ENV *, int))); +int __dbcl_env_remove __P((DB_ENV *, const char *, u_int32_t)); +int __dbcl_set_shm_key __P((DB_ENV *, long)); +int __dbcl_set_tas_spins __P((DB_ENV *, u_int32_t)); +int __dbcl_set_timeout __P((DB_ENV *, u_int32_t, u_int32_t)); +int __dbcl_set_tmp_dir __P((DB_ENV *, const char *)); +int __dbcl_set_tx_max __P((DB_ENV *, u_int32_t)); +int __dbcl_set_tx_timestamp __P((DB_ENV *, time_t *)); +int __dbcl_set_verbose __P((DB_ENV *, u_int32_t, int)); +int __dbcl_txn_abort __P((DB_TXN *)); +int __dbcl_txn_begin __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)); +int __dbcl_txn_checkpoint __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); +int __dbcl_txn_commit __P((DB_TXN *, u_int32_t)); +int __dbcl_txn_discard __P((DB_TXN *, u_int32_t)); +int __dbcl_txn_prepare __P((DB_TXN *, u_int8_t *)); +int __dbcl_txn_recover __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t)); +int __dbcl_txn_stat __P((DB_ENV *, DB_TXN_STAT **, u_int32_t)); +int __dbcl_txn_timeout __P((DB_TXN *, u_int32_t, u_int32_t)); +int __dbcl_rep_elect __P((DB_ENV *, int, int, u_int32_t, int *)); +int __dbcl_rep_flush __P((DB_ENV *)); +int __dbcl_rep_process_message __P((DB_ENV *, DBT *, DBT *, int *)); +int __dbcl_rep_set_limit __P((DB_ENV *, u_int32_t, u_int32_t)); +int __dbcl_rep_set_request __P((DB_ENV *, u_int32_t, u_int32_t)); +int __dbcl_rep_set_rep_transport __P((DB_ENV *, int, int (*)(DB_ENV *, const DBT *, const DBT *, int, u_int32_t))); +int __dbcl_rep_start __P((DB_ENV *, DBT *, u_int32_t)); +int __dbcl_rep_stat __P((DB_ENV *, DB_REP_STAT **, u_int32_t)); +int __dbcl_db_alloc __P((DB *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); +int __dbcl_db_associate __P((DB *, DB_TXN *, DB *, int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t)); +int __dbcl_db_bt_compare __P((DB *, int (*)(DB *, const DBT *, const DBT *))); +int __dbcl_db_bt_maxkey __P((DB *, u_int32_t)); +int __dbcl_db_bt_minkey __P((DB *, u_int32_t)); +int __dbcl_db_bt_prefix __P((DB *, size_t(*)(DB *, const DBT *, const DBT *))); +int __dbcl_db_set_append_recno __P((DB *, int (*)(DB *, DBT *, db_recno_t))); +int __dbcl_db_cache_priority __P((DB *, DB_CACHE_PRIORITY)); +int __dbcl_db_cachesize __P((DB *, u_int32_t, u_int32_t, int)); +int __dbcl_db_close __P((DB *, u_int32_t)); +int __dbcl_db_create __P((DB *, DB_ENV *, u_int32_t)); +int __dbcl_db_del __P((DB *, DB_TXN *, DBT *, u_int32_t)); +int __dbcl_db_dup_compare __P((DB *, int (*)(DB *, const DBT *, const DBT *))); +int __dbcl_db_encrypt __P((DB *, const char *, u_int32_t)); +int __dbcl_db_extentsize __P((DB *, u_int32_t)); +int __dbcl_db_fd __P((DB *, int *)); +int __dbcl_db_feedback __P((DB *, void (*)(DB *, int, int))); +int __dbcl_db_flags __P((DB *, u_int32_t)); +int __dbcl_db_get __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +int __dbcl_db_h_ffactor __P((DB *, u_int32_t)); +int __dbcl_db_h_hash __P((DB *, u_int32_t(*)(DB *, const void *, u_int32_t))); +int __dbcl_db_h_nelem __P((DB *, u_int32_t)); +int __dbcl_db_key_range __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t)); +int __dbcl_db_lorder __P((DB *, int)); +int __dbcl_db_open __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int)); +int __dbcl_db_pagesize __P((DB *, u_int32_t)); +int __dbcl_db_panic __P((DB *, void (*)(DB_ENV *, int))); +int __dbcl_db_pget __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t)); +int __dbcl_db_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +int __dbcl_db_re_delim __P((DB *, int)); +int __dbcl_db_re_len __P((DB *, u_int32_t)); +int __dbcl_db_re_pad __P((DB *, int)); +int __dbcl_db_re_source __P((DB *, const char *)); +int __dbcl_db_remove __P((DB *, const char *, const char *, u_int32_t)); +int __dbcl_db_rename __P((DB *, const char *, const char *, const char *, u_int32_t)); +int __dbcl_db_stat __P((DB *, void *, u_int32_t)); +int __dbcl_db_sync __P((DB *, u_int32_t)); +int __dbcl_db_truncate __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); +int __dbcl_db_upgrade __P((DB *, const char *, u_int32_t)); +int __dbcl_db_verify __P((DB *, const char *, const char *, FILE *, u_int32_t)); +int __dbcl_db_cursor __P((DB *, DB_TXN *, DBC **, u_int32_t)); +int __dbcl_db_join __P((DB *, DBC **, DBC **, u_int32_t)); +int __dbcl_dbc_close __P((DBC *)); +int __dbcl_dbc_count __P((DBC *, db_recno_t *, u_int32_t)); +int __dbcl_dbc_del __P((DBC *, u_int32_t)); +int __dbcl_dbc_dup __P((DBC *, DBC **, u_int32_t)); +int __dbcl_dbc_get __P((DBC *, DBT *, DBT *, u_int32_t)); +int __dbcl_dbc_pget __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); +int __dbcl_dbc_put __P((DBC *, DBT *, DBT *, u_int32_t)); +int __dbcl_lock_detect __P((DB_ENV *, u_int32_t, u_int32_t, int *)); +int __dbcl_lock_get __P((DB_ENV *, u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); +int __dbcl_lock_id __P((DB_ENV *, u_int32_t *)); +int __dbcl_lock_id_free __P((DB_ENV *, u_int32_t)); +int __dbcl_lock_put __P((DB_ENV *, DB_LOCK *)); +int __dbcl_lock_stat __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t)); +int __dbcl_lock_vec __P((DB_ENV *, u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); +int __dbcl_log_archive __P((DB_ENV *, char ***, u_int32_t)); +int __dbcl_log_cursor __P((DB_ENV *, DB_LOGC **, u_int32_t)); +int __dbcl_log_file __P((DB_ENV *, const DB_LSN *, char *, size_t)); +int __dbcl_log_flush __P((DB_ENV *, const DB_LSN *)); +int __dbcl_log_put __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t)); +int __dbcl_log_stat __P((DB_ENV *, DB_LOG_STAT **, u_int32_t)); +int __dbcl_memp_fcreate __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t)); +int __dbcl_memp_register __P((DB_ENV *, int, int (*)(DB_ENV *, db_pgno_t, void *, DBT *), int (*)(DB_ENV *, db_pgno_t, void *, DBT *))); +int __dbcl_memp_stat __P((DB_ENV *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t)); +int __dbcl_memp_sync __P((DB_ENV *, DB_LSN *)); +int __dbcl_memp_trickle __P((DB_ENV *, int, int *)); +int __dbcl_env_close_ret __P((DB_ENV *, u_int32_t, __env_close_reply *)); +int __dbcl_env_create_ret __P((DB_ENV *, long, __env_create_reply *)); +int __dbcl_env_open_ret __P((DB_ENV *, const char *, u_int32_t, int, __env_open_reply *)); +int __dbcl_env_remove_ret __P((DB_ENV *, const char *, u_int32_t, __env_remove_reply *)); +int __dbcl_txn_abort_ret __P((DB_TXN *, __txn_abort_reply *)); +int __dbcl_txn_begin_ret __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t, __txn_begin_reply *)); +int __dbcl_txn_commit_ret __P((DB_TXN *, u_int32_t, __txn_commit_reply *)); +int __dbcl_txn_discard_ret __P((DB_TXN *, u_int32_t, __txn_discard_reply *)); +int __dbcl_txn_recover_ret __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t, __txn_recover_reply *)); +int __dbcl_db_close_ret __P((DB *, u_int32_t, __db_close_reply *)); +int __dbcl_db_create_ret __P((DB *, DB_ENV *, u_int32_t, __db_create_reply *)); +int __dbcl_db_get_ret __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t, __db_get_reply *)); +int __dbcl_db_key_range_ret __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t, __db_key_range_reply *)); +int __dbcl_db_open_ret __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int, __db_open_reply *)); +int __dbcl_db_pget_ret __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t, __db_pget_reply *)); +int __dbcl_db_put_ret __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t, __db_put_reply *)); +int __dbcl_db_remove_ret __P((DB *, const char *, const char *, u_int32_t, __db_remove_reply *)); +int __dbcl_db_rename_ret __P((DB *, const char *, const char *, const char *, u_int32_t, __db_rename_reply *)); +int __dbcl_db_stat_ret __P((DB *, void *, u_int32_t, __db_stat_reply *)); +int __dbcl_db_truncate_ret __P((DB *, DB_TXN *, u_int32_t *, u_int32_t, __db_truncate_reply *)); +int __dbcl_db_cursor_ret __P((DB *, DB_TXN *, DBC **, u_int32_t, __db_cursor_reply *)); +int __dbcl_db_join_ret __P((DB *, DBC **, DBC **, u_int32_t, __db_join_reply *)); +int __dbcl_dbc_close_ret __P((DBC *, __dbc_close_reply *)); +int __dbcl_dbc_count_ret __P((DBC *, db_recno_t *, u_int32_t, __dbc_count_reply *)); +int __dbcl_dbc_dup_ret __P((DBC *, DBC **, u_int32_t, __dbc_dup_reply *)); +int __dbcl_dbc_get_ret __P((DBC *, DBT *, DBT *, u_int32_t, __dbc_get_reply *)); +int __dbcl_dbc_pget_ret __P((DBC *, DBT *, DBT *, DBT *, u_int32_t, __dbc_pget_reply *)); +int __dbcl_dbc_put_ret __P((DBC *, DBT *, DBT *, u_int32_t, __dbc_put_reply *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_rpc_client_ext_h_ */ diff --git a/db/dbinc_auto/rpc_defs.in b/db/dbinc_auto/rpc_defs.in new file mode 100644 index 000000000..cae76f560 --- /dev/null +++ b/db/dbinc_auto/rpc_defs.in @@ -0,0 +1,4 @@ + +/* DO NOT EDIT: automatically built by dist/s_rpc. */ +#define DB_RPC_SERVERPROG ((unsigned long)(351457)) +#define DB_RPC_SERVERVERS ((unsigned long)(4001)) diff --git a/db/dbinc_auto/rpc_server_ext.h b/db/dbinc_auto/rpc_server_ext.h new file mode 100644 index 000000000..c0c706881 --- /dev/null +++ b/db/dbinc_auto/rpc_server_ext.h @@ -0,0 +1,126 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _rpc_server_ext_h_ +#define _rpc_server_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +void __env_cachesize_proc __P((long, u_int32_t, u_int32_t, u_int32_t, __env_cachesize_reply *)); +void __env_close_proc __P((long, u_int32_t, __env_close_reply *)); +void __env_create_proc __P((u_int32_t, __env_create_reply *)); +void __env_dbremove_proc __P((long, long, char *, char *, u_int32_t, __env_dbremove_reply *)); +void __env_dbrename_proc __P((long, long, char *, char *, char *, u_int32_t, __env_dbrename_reply *)); +void __env_encrypt_proc __P((long, char *, u_int32_t, __env_encrypt_reply *)); +void __env_flags_proc __P((long, u_int32_t, u_int32_t, __env_flags_reply *)); +void __env_open_proc __P((long, char *, u_int32_t, u_int32_t, __env_open_reply *)); +void __env_remove_proc __P((long, char *, u_int32_t, __env_remove_reply *)); +void __txn_abort_proc __P((long, __txn_abort_reply *)); +void __txn_begin_proc __P((long, long, u_int32_t, __txn_begin_reply *)); +void __txn_commit_proc __P((long, u_int32_t, __txn_commit_reply *)); +void __txn_discard_proc __P((long, u_int32_t, __txn_discard_reply *)); +void __txn_prepare_proc __P((long, u_int8_t *, __txn_prepare_reply *)); +void __txn_recover_proc __P((long, u_int32_t, u_int32_t, __txn_recover_reply *, int *)); +void __db_bt_maxkey_proc __P((long, u_int32_t, __db_bt_maxkey_reply *)); +void __db_associate_proc __P((long, long, long, u_int32_t, __db_associate_reply *)); +void __db_bt_minkey_proc __P((long, u_int32_t, __db_bt_minkey_reply *)); +void __db_close_proc __P((long, u_int32_t, __db_close_reply *)); +void __db_create_proc __P((long, u_int32_t, __db_create_reply *)); +void __db_del_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_del_reply *)); +void __db_encrypt_proc __P((long, char *, u_int32_t, __db_encrypt_reply *)); +void __db_extentsize_proc __P((long, u_int32_t, __db_extentsize_reply *)); +void __db_flags_proc __P((long, u_int32_t, __db_flags_reply *)); +void __db_get_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_get_reply *, int *)); +void __db_h_ffactor_proc __P((long, u_int32_t, __db_h_ffactor_reply *)); +void __db_h_nelem_proc __P((long, u_int32_t, __db_h_nelem_reply *)); +void __db_key_range_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_key_range_reply *)); +void __db_lorder_proc __P((long, u_int32_t, __db_lorder_reply *)); +void __db_open_proc __P((long, long, char *, char *, u_int32_t, u_int32_t, u_int32_t, __db_open_reply *)); +void __db_pagesize_proc __P((long, u_int32_t, __db_pagesize_reply *)); +void __db_pget_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_pget_reply *, int *)); +void __db_put_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_put_reply *, int *)); +void __db_re_delim_proc __P((long, u_int32_t, __db_re_delim_reply *)); +void __db_re_len_proc __P((long, u_int32_t, __db_re_len_reply *)); +void __db_re_pad_proc __P((long, u_int32_t, __db_re_pad_reply *)); +void __db_remove_proc __P((long, char *, char *, u_int32_t, __db_remove_reply *)); +void __db_rename_proc __P((long, char *, char *, char *, u_int32_t, __db_rename_reply *)); +void __db_stat_proc __P((long, u_int32_t, __db_stat_reply *, int *)); +void __db_sync_proc __P((long, u_int32_t, __db_sync_reply *)); +void __db_truncate_proc __P((long, long, u_int32_t, __db_truncate_reply *)); +void __db_cursor_proc __P((long, long, u_int32_t, __db_cursor_reply *)); +void __db_join_proc __P((long, u_int32_t *, u_int32_t, u_int32_t, __db_join_reply *)); +void __dbc_close_proc __P((long, __dbc_close_reply *)); +void __dbc_count_proc __P((long, u_int32_t, __dbc_count_reply *)); +void __dbc_del_proc __P((long, u_int32_t, __dbc_del_reply *)); +void __dbc_dup_proc __P((long, u_int32_t, __dbc_dup_reply *)); +void __dbc_get_proc __P((long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __dbc_get_reply *, int *)); +void __dbc_pget_proc __P((long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __dbc_pget_reply *, int *)); +void __dbc_put_proc __P((long, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __dbc_put_reply *, int *)); +void __dbsrv_settimeout __P((ct_entry *, u_int32_t)); +void __dbsrv_timeout __P((int)); +void __dbclear_ctp __P((ct_entry *)); +void __dbdel_ctp __P((ct_entry *)); +ct_entry *new_ct_ent __P((int *)); +ct_entry *get_tableent __P((long)); +ct_entry *__dbsrv_sharedb __P((ct_entry *, const char *, const char *, DBTYPE, u_int32_t)); +ct_entry *__dbsrv_shareenv __P((ct_entry *, home_entry *, u_int32_t)); +void __dbsrv_active __P((ct_entry *)); +int __db_close_int __P((long, u_int32_t)); +int __dbc_close_int __P((ct_entry *)); +int __dbenv_close_int __P((long, u_int32_t, int)); +home_entry *get_home __P((char *)); +__env_cachesize_reply *__db_env_cachesize_4001 __P((__env_cachesize_msg *, struct svc_req *)); +__env_close_reply *__db_env_close_4001 __P((__env_close_msg *, struct svc_req *)); +__env_create_reply *__db_env_create_4001 __P((__env_create_msg *, struct svc_req *)); +__env_dbremove_reply *__db_env_dbremove_4001 __P((__env_dbremove_msg *, struct svc_req *)); +__env_dbrename_reply *__db_env_dbrename_4001 __P((__env_dbrename_msg *, struct svc_req *)); +__env_encrypt_reply *__db_env_encrypt_4001 __P((__env_encrypt_msg *, struct svc_req *)); +__env_flags_reply *__db_env_flags_4001 __P((__env_flags_msg *, struct svc_req *)); +__env_open_reply *__db_env_open_4001 __P((__env_open_msg *, struct svc_req *)); +__env_remove_reply *__db_env_remove_4001 __P((__env_remove_msg *, struct svc_req *)); +__txn_abort_reply *__db_txn_abort_4001 __P((__txn_abort_msg *, struct svc_req *)); +__txn_begin_reply *__db_txn_begin_4001 __P((__txn_begin_msg *, struct svc_req *)); +__txn_commit_reply *__db_txn_commit_4001 __P((__txn_commit_msg *, struct svc_req *)); +__txn_discard_reply *__db_txn_discard_4001 __P((__txn_discard_msg *, struct svc_req *)); +__txn_prepare_reply *__db_txn_prepare_4001 __P((__txn_prepare_msg *, struct svc_req *)); +__txn_recover_reply *__db_txn_recover_4001 __P((__txn_recover_msg *, struct svc_req *)); +__db_associate_reply *__db_db_associate_4001 __P((__db_associate_msg *, struct svc_req *)); +__db_bt_maxkey_reply *__db_db_bt_maxkey_4001 __P((__db_bt_maxkey_msg *, struct svc_req *)); +__db_bt_minkey_reply *__db_db_bt_minkey_4001 __P((__db_bt_minkey_msg *, struct svc_req *)); +__db_close_reply *__db_db_close_4001 __P((__db_close_msg *, struct svc_req *)); +__db_create_reply *__db_db_create_4001 __P((__db_create_msg *, struct svc_req *)); +__db_del_reply *__db_db_del_4001 __P((__db_del_msg *, struct svc_req *)); +__db_encrypt_reply *__db_db_encrypt_4001 __P((__db_encrypt_msg *, struct svc_req *)); +__db_extentsize_reply *__db_db_extentsize_4001 __P((__db_extentsize_msg *, struct svc_req *)); +__db_flags_reply *__db_db_flags_4001 __P((__db_flags_msg *, struct svc_req *)); +__db_get_reply *__db_db_get_4001 __P((__db_get_msg *, struct svc_req *)); +__db_h_ffactor_reply *__db_db_h_ffactor_4001 __P((__db_h_ffactor_msg *, struct svc_req *)); +__db_h_nelem_reply *__db_db_h_nelem_4001 __P((__db_h_nelem_msg *, struct svc_req *)); +__db_key_range_reply *__db_db_key_range_4001 __P((__db_key_range_msg *, struct svc_req *)); +__db_lorder_reply *__db_db_lorder_4001 __P((__db_lorder_msg *, struct svc_req *)); +__db_open_reply *__db_db_open_4001 __P((__db_open_msg *, struct svc_req *)); +__db_pagesize_reply *__db_db_pagesize_4001 __P((__db_pagesize_msg *, struct svc_req *)); +__db_pget_reply *__db_db_pget_4001 __P((__db_pget_msg *, struct svc_req *)); +__db_put_reply *__db_db_put_4001 __P((__db_put_msg *, struct svc_req *)); +__db_re_delim_reply *__db_db_re_delim_4001 __P((__db_re_delim_msg *, struct svc_req *)); +__db_re_len_reply *__db_db_re_len_4001 __P((__db_re_len_msg *, struct svc_req *)); +__db_re_pad_reply *__db_db_re_pad_4001 __P((__db_re_pad_msg *, struct svc_req *)); +__db_remove_reply *__db_db_remove_4001 __P((__db_remove_msg *, struct svc_req *)); +__db_rename_reply *__db_db_rename_4001 __P((__db_rename_msg *, struct svc_req *)); +__db_stat_reply *__db_db_stat_4001 __P((__db_stat_msg *, struct svc_req *)); +__db_sync_reply *__db_db_sync_4001 __P((__db_sync_msg *, struct svc_req *)); +__db_truncate_reply *__db_db_truncate_4001 __P((__db_truncate_msg *, struct svc_req *)); +__db_cursor_reply *__db_db_cursor_4001 __P((__db_cursor_msg *, struct svc_req *)); +__db_join_reply *__db_db_join_4001 __P((__db_join_msg *, struct svc_req *)); +__dbc_close_reply *__db_dbc_close_4001 __P((__dbc_close_msg *, struct svc_req *)); +__dbc_count_reply *__db_dbc_count_4001 __P((__dbc_count_msg *, struct svc_req *)); +__dbc_del_reply *__db_dbc_del_4001 __P((__dbc_del_msg *, struct svc_req *)); +__dbc_dup_reply *__db_dbc_dup_4001 __P((__dbc_dup_msg *, struct svc_req *)); +__dbc_get_reply *__db_dbc_get_4001 __P((__dbc_get_msg *, struct svc_req *)); +__dbc_pget_reply *__db_dbc_pget_4001 __P((__dbc_pget_msg *, struct svc_req *)); +__dbc_put_reply *__db_dbc_put_4001 __P((__dbc_put_msg *, struct svc_req *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_rpc_server_ext_h_ */ diff --git a/db/dbinc_auto/tcl_ext.h b/db/dbinc_auto/tcl_ext.h new file mode 100644 index 000000000..9622d9eb7 --- /dev/null +++ b/db/dbinc_auto/tcl_ext.h @@ -0,0 +1,82 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _tcl_ext_h_ +#define _tcl_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int bdb_HCommand __P((Tcl_Interp *, int, Tcl_Obj * CONST*)); +#if DB_DBM_HSEARCH != 0 +int bdb_NdbmOpen __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DBM **)); +#endif +#if DB_DBM_HSEARCH != 0 +int bdb_DbmCommand __P((Tcl_Interp *, int, Tcl_Obj * CONST*, int, DBM *)); +#endif +int ndbm_Cmd __P((ClientData, Tcl_Interp *, int, Tcl_Obj * CONST*)); +void _DbInfoDelete __P((Tcl_Interp *, DBTCL_INFO *)); +int db_Cmd __P((ClientData, Tcl_Interp *, int, Tcl_Obj * CONST*)); +int dbc_Cmd __P((ClientData, Tcl_Interp *, int, Tcl_Obj * CONST*)); +int env_Cmd __P((ClientData, Tcl_Interp *, int, Tcl_Obj * CONST*)); +int tcl_EnvRemove __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *, DBTCL_INFO *)); +int tcl_EnvVerbose __P((Tcl_Interp *, DB_ENV *, Tcl_Obj *, Tcl_Obj *)); +int tcl_EnvAttr __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_EnvTest __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +DBTCL_INFO *_NewInfo __P((Tcl_Interp *, void *, char *, enum INFOTYPE)); +void *_NameToPtr __P((CONST char *)); +DBTCL_INFO *_PtrToInfo __P((CONST void *)); +DBTCL_INFO *_NameToInfo __P((CONST char *)); +void _SetInfoData __P((DBTCL_INFO *, void *)); +void _DeleteInfo __P((DBTCL_INFO *)); +int _SetListElem __P((Tcl_Interp *, Tcl_Obj *, void *, int, void *, int)); +int _SetListElemInt __P((Tcl_Interp *, Tcl_Obj *, void *, int)); +int _SetListRecnoElem __P((Tcl_Interp *, Tcl_Obj *, db_recno_t, u_char *, int)); +int _Set3DBTList __P((Tcl_Interp *, Tcl_Obj *, DBT *, int, DBT *, int, DBT *)); +int _SetMultiList __P((Tcl_Interp *, Tcl_Obj *, DBT *, DBT*, int, int)); +int _GetGlobPrefix __P((char *, char **)); +int _ReturnSetup __P((Tcl_Interp *, int, int, char *)); +int _ErrorSetup __P((Tcl_Interp *, int, char *)); +void _ErrorFunc __P((CONST char *, char *)); +int _GetLsn __P((Tcl_Interp *, Tcl_Obj *, DB_LSN *)); +int _GetUInt32 __P((Tcl_Interp *, Tcl_Obj *, u_int32_t *)); +Tcl_Obj *_GetFlagsList __P((Tcl_Interp *, u_int32_t, void (*)(u_int32_t, void *, void (*)(u_int32_t, const FN *, void *)))); +void _debug_check __P((void)); +int _CopyObjBytes __P((Tcl_Interp *, Tcl_Obj *obj, void **, int *, int *)); +int tcl_LockDetect __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LockGet __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LockStat __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LockTimeout __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LockVec __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LogArchive __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LogCompare __P((Tcl_Interp *, int, Tcl_Obj * CONST*)); +int tcl_LogFile __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LogFlush __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LogGet __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LogPut __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_LogStat __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int logc_Cmd __P((ClientData, Tcl_Interp *, int, Tcl_Obj * CONST*)); +void _MpInfoDelete __P((Tcl_Interp *, DBTCL_INFO *)); +int tcl_MpSync __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_MpTrickle __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_Mp __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *, DBTCL_INFO *)); +int tcl_MpStat __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_RepElect __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +int tcl_RepFlush __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +int tcl_RepLimit __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +int tcl_RepRequest __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +int tcl_RepStart __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +int tcl_RepProcessMessage __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +int tcl_RepStat __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); +void _TxnInfoDelete __P((Tcl_Interp *, DBTCL_INFO *)); +int tcl_TxnCheckpoint __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_Txn __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *, DBTCL_INFO *)); +int tcl_TxnStat __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_TxnTimeout __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *)); +int tcl_TxnRecover __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *, DBTCL_INFO *)); +int bdb_RandCommand __P((Tcl_Interp *, int, Tcl_Obj * CONST*)); +int tcl_Mutex __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *, DBTCL_INFO *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_tcl_ext_h_ */ diff --git a/db/dbinc_auto/txn_auto.h b/db/dbinc_auto/txn_auto.h new file mode 100644 index 000000000..ac841ba5b --- /dev/null +++ b/db/dbinc_auto/txn_auto.h @@ -0,0 +1,55 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef __txn_AUTO_H +#define __txn_AUTO_H +#define DB___txn_regop 10 +typedef struct ___txn_regop_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + int32_t timestamp; +} __txn_regop_args; + +#define DB___txn_ckp 11 +typedef struct ___txn_ckp_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DB_LSN ckp_lsn; + DB_LSN last_ckp; + int32_t timestamp; +} __txn_ckp_args; + +#define DB___txn_child 12 +typedef struct ___txn_child_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t child; + DB_LSN c_lsn; +} __txn_child_args; + +#define DB___txn_xa_regop 13 +typedef struct ___txn_xa_regop_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + DBT xid; + int32_t formatID; + u_int32_t gtrid; + u_int32_t bqual; + DB_LSN begin_lsn; +} __txn_xa_regop_args; + +#define DB___txn_recycle 14 +typedef struct ___txn_recycle_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t min; + u_int32_t max; +} __txn_recycle_args; + +#endif diff --git a/db/dbinc_auto/txn_ext.h b/db/dbinc_auto/txn_ext.h new file mode 100644 index 000000000..d297736e4 --- /dev/null +++ b/db/dbinc_auto/txn_ext.h @@ -0,0 +1,71 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _txn_ext_h_ +#define _txn_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __txn_begin __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)); +int __txn_xa_begin __P((DB_ENV *, DB_TXN *)); +int __txn_compensate_begin __P((DB_ENV *, DB_TXN **txnp)); +int __txn_commit __P((DB_TXN *, u_int32_t)); +int __txn_abort __P((DB_TXN *)); +int __txn_discard __P((DB_TXN *, u_int32_t flags)); +int __txn_prepare __P((DB_TXN *, u_int8_t *)); +u_int32_t __txn_id __P((DB_TXN *)); +int __txn_free __P((DB_TXN *)); +int __txn_checkpoint __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); +int __txn_getckp __P((DB_ENV *, DB_LSN *)); +int __txn_activekids __P((DB_ENV *, u_int32_t, DB_TXN *)); +int __txn_force_abort __P((DB_ENV *, u_int8_t *)); +int __txn_preclose __P((DB_ENV *)); +int __txn_reset __P((DB_ENV *)); +int __txn_regop_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, int32_t)); +int __txn_regop_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_regop_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_regop_read __P((DB_ENV *, void *, __txn_regop_args **)); +int __txn_ckp_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, DB_LSN *, DB_LSN *, int32_t)); +int __txn_ckp_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_ckp_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_ckp_read __P((DB_ENV *, void *, __txn_ckp_args **)); +int __txn_child_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, DB_LSN *)); +int __txn_child_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_child_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_child_read __P((DB_ENV *, void *, __txn_child_args **)); +int __txn_xa_regop_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, const DBT *, int32_t, u_int32_t, u_int32_t, DB_LSN *)); +int __txn_xa_regop_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_xa_regop_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_xa_regop_read __P((DB_ENV *, void *, __txn_xa_regop_args **)); +int __txn_recycle_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, u_int32_t)); +int __txn_recycle_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_recycle_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_recycle_read __P((DB_ENV *, void *, __txn_recycle_args **)); +int __txn_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __txn_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +int __txn_init_recover __P((DB_ENV *, int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), size_t *)); +void __txn_dbenv_create __P((DB_ENV *)); +int __txn_regop_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_xa_regop_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_ckp_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_child_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int __txn_restore_txn __P((DB_ENV *, DB_LSN *, __txn_xa_regop_args *)); +int __txn_recycle_recover __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +void __txn_continue __P((DB_ENV *, DB_TXN *, TXN_DETAIL *, size_t)); +int __txn_map_gid __P((DB_ENV *, u_int8_t *, TXN_DETAIL **, size_t *)); +int __txn_recover __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t)); +int __txn_get_prepared __P((DB_ENV *, XID *, DB_PREPLIST *, long, long *, u_int32_t)); +int __txn_open __P((DB_ENV *)); +int __txn_dbenv_refresh __P((DB_ENV *)); +void __txn_region_destroy __P((DB_ENV *, REGINFO *)); +int __txn_id_set __P((DB_ENV *, u_int32_t, u_int32_t)); +int __txn_stat __P((DB_ENV *, DB_TXN_STAT **, u_int32_t)); +int __txn_remevent __P((DB_ENV *, DB_TXN *, const char *, u_int8_t*)); +int __txn_lockevent __P((DB_ENV *, DB_TXN *, DB *, DB_LOCK *, u_int32_t)); +void __txn_remlock __P((DB_ENV *, DB_TXN *, DB_LOCK *, u_int32_t)); +int __txn_doevents __P((DB_ENV *, DB_TXN *, int, int)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_txn_ext_h_ */ diff --git a/db/dbinc_auto/xa_ext.h b/db/dbinc_auto/xa_ext.h new file mode 100644 index 000000000..fe7f84f15 --- /dev/null +++ b/db/dbinc_auto/xa_ext.h @@ -0,0 +1,32 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _xa_ext_h_ +#define _xa_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __db_xa_open __P((char *, int, long)); +int __db_xa_close __P((char *, int, long)); +int __db_xa_start __P((XID *, int, long)); +int __db_xa_end __P((XID *, int, long)); +int __db_xa_prepare __P((XID *, int, long)); +int __db_xa_commit __P((XID *, int, long)); +int __db_xa_recover __P((XID *, long, int, long)); +int __db_xa_rollback __P((XID *, int, long)); +int __db_xa_forget __P((XID *, int, long)); +int __db_xa_complete __P((int *, int *, int, long)); +int __db_xa_create __P((DB *)); +int __db_rmid_to_env __P((int rmid, DB_ENV **envp)); +int __db_xid_to_txn __P((DB_ENV *, XID *, size_t *)); +int __db_map_rmid __P((int, DB_ENV *)); +int __db_unmap_rmid __P((int)); +int __db_map_xid __P((DB_ENV *, XID *, size_t)); +void __db_unmap_xid __P((DB_ENV *, XID *, size_t)); +int __db_get_xa_txn __P((DB_ENV *env, DB_TXN **txnp)); +int __db_get_current_thread __P((void **)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_xa_ext_h_ */ diff --git a/db/dbreg/dbreg.c b/db/dbreg/dbreg.c new file mode 100644 index 000000000..69b2fba22 --- /dev/null +++ b/db/dbreg/dbreg.c @@ -0,0 +1,449 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: dbreg.c,v 11.66 2002/08/11 02:14:16 margo Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/log.h" +#include "dbinc/txn.h" + +/* + * The dbreg subsystem, as its name implies, registers database handles so + * that we can associate log messages with them without logging a filename + * or a full, unique DB ID. Instead, we assign each dbp an int32_t which is + * easy and cheap to log, and use this subsystem to map back and forth. + * + * Overview of how dbreg ids are managed: + * + * OPEN + * dbreg_setup (Creates FNAME struct.) + * dbreg_new_id (Assigns new ID to dbp and logs it. May be postponed + * until we attempt to log something else using that dbp, if the dbp + * was opened on a replication client.) + * + * CLOSE + * dbreg_close_id (Logs closure of dbp/revocation of ID.) + * dbreg_revoke_id (As name implies, revokes ID.) + * dbreg_teardown (Destroys FNAME.) + * + * RECOVERY + * dbreg_setup + * dbreg_assign_id (Assigns a particular ID we have in the log to a dbp.) + * + * sometimes: dbreg_revoke_id; dbreg_teardown + * other times: normal close path + * + * A note about locking: + * + * FNAME structures are referenced only by their corresponding dbp's + * until they have a valid id. + * + * Once they have a valid id, they must get linked into the log + * region list so they can get logged on checkpoints. + * + * An FNAME that may/does have a valid id must be accessed under + * protection of the fq_mutex, with the following exception: + * + * We don't want to have to grab the fq_mutex on every log + * record, and it should be safe not to do so when we're just + * looking at the id, because once allocated, the id should + * not change under a handle until the handle is closed. + * + * If a handle is closed during an attempt by another thread to + * log with it, well, the application doing the close deserves to + * go down in flames and a lot else is about to fail anyway. + * + * When in the course of logging we encounter an invalid id + * and go to allocate it lazily, we *do* need to check again + * after grabbing the mutex, because it's possible to race with + * another thread that has also decided that it needs to allocate + * a id lazily. + * + * See SR #5623 for further discussion of the new dbreg design. + */ + +/* + * __dbreg_setup -- + * Allocate and initialize an FNAME structure. The FNAME structures + * live in the log shared region and map one-to-one with open database handles. + * When the handle needs to be logged, the FNAME should have a valid fid + * allocated. If the handle currently isn't logged, it still has an FNAME + * entry. If we later discover that the handle needs to be logged, we can + * allocate a id for it later. (This happens when the handle is on a + * replication client that later becomes a master.) + * + * PUBLIC: int __dbreg_setup __P((DB *, const char *, u_int32_t)); + */ +int +__dbreg_setup(dbp, name, create_txnid) + DB *dbp; + const char *name; + u_int32_t create_txnid; +{ + DB_ENV *dbenv; + DB_LOG *dblp; + FNAME *fnp; + LOG *lp; + int ret; + size_t len; + void *namep; + + dbenv = dbp->dbenv; + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + + fnp = NULL; + namep = NULL; + + /* Allocate an FNAME and, if necessary, a buffer for the name itself. */ + R_LOCK(dbenv, &dblp->reginfo); + if ((ret = + __db_shalloc(dblp->reginfo.addr, sizeof(FNAME), 0, &fnp)) != 0) { + R_UNLOCK(dbenv, &dblp->reginfo); + return (ret); + } + memset(fnp, 0, sizeof(FNAME)); + if (name != NULL) { + len = strlen(name) + 1; + if ((ret = __db_shalloc(dblp->reginfo.addr, + len, 0, &namep)) != 0) { + R_UNLOCK(dbenv, &dblp->reginfo); + return (ret); + } + fnp->name_off = R_OFFSET(&dblp->reginfo, namep); + memcpy(namep, name, len); + } else + fnp->name_off = INVALID_ROFF; + + R_UNLOCK(dbenv, &dblp->reginfo); + + /* + * Fill in all the remaining info that we'll need later to register + * the file, if we use it for logging. + */ + fnp->id = DB_LOGFILEID_INVALID; + fnp->s_type = dbp->type; + memcpy(fnp->ufid, dbp->fileid, DB_FILE_ID_LEN); + fnp->meta_pgno = dbp->meta_pgno; + fnp->create_txnid = create_txnid; + + dbp->log_filename = fnp; + + return (0); +} + +/* + * __dbreg_teardown -- + * Destroy a DB handle's FNAME struct. + * + * PUBLIC: int __dbreg_teardown __P((DB *)); + */ +int +__dbreg_teardown(dbp) + DB *dbp; +{ + DB_ENV *dbenv; + DB_LOG *dblp; + FNAME *fnp; + + dbenv = dbp->dbenv; + dblp = dbenv->lg_handle; + fnp = dbp->log_filename; + + /* + * We may not have an FNAME if we were never opened. This is not an + * error. + */ + if (fnp == NULL) + return (0); + + DB_ASSERT(fnp->id == DB_LOGFILEID_INVALID); + + R_LOCK(dbenv, &dblp->reginfo); + if (fnp->name_off != INVALID_ROFF) + __db_shalloc_free(dblp->reginfo.addr, + R_ADDR(&dblp->reginfo, fnp->name_off)); + __db_shalloc_free(dblp->reginfo.addr, fnp); + R_UNLOCK(dbenv, &dblp->reginfo); + + dbp->log_filename = NULL; + + return (0); +} + +/* + * __dbreg_new_id -- + * Assign an unused dbreg id to this database handle. + * + * PUBLIC: int __dbreg_new_id __P((DB *, DB_TXN *)); + */ +int +__dbreg_new_id(dbp, txn) + DB *dbp; + DB_TXN *txn; +{ + DBT fid_dbt, r_name; + DB_ENV *dbenv; + DB_LOG *dblp; + DB_LSN unused; + FNAME *fnp; + LOG *lp; + int32_t id; + int ret; + + dbenv = dbp->dbenv; + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + fnp = dbp->log_filename; + + /* The fq_mutex protects the FNAME list and id management. */ + MUTEX_LOCK(dbenv, &lp->fq_mutex); + + /* + * It's possible that after deciding we needed to call this function, + * someone else allocated an ID before we grabbed the lock. Check + * to make sure there was no race and we have something useful to do. + */ + if (fnp->id != DB_LOGFILEID_INVALID) { + MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + return (0); + } + + /* Get an unused ID from the free list. */ + if ((ret = __dbreg_pop_id(dbenv, &id)) != 0) + goto err; + + /* If no ID was found, allocate a new one. */ + if (id == DB_LOGFILEID_INVALID) + id = lp->fid_max++; + + fnp->id = id; + + /* Hook the FNAME into the list of open files. */ + SH_TAILQ_INSERT_HEAD(&lp->fq, fnp, q, __fname); + + /* + * Log the registry. We should only request a new ID in situations + * where logging is reasonable. + */ + DB_ASSERT(!F_ISSET(dbp, DB_AM_RECOVER)); + + memset(&fid_dbt, 0, sizeof(fid_dbt)); + memset(&r_name, 0, sizeof(r_name)); + if (fnp->name_off != INVALID_ROFF) { + r_name.data = R_ADDR(&dblp->reginfo, fnp->name_off); + r_name.size = (u_int32_t)strlen((char *)r_name.data) + 1; + } + fid_dbt.data = dbp->fileid; + fid_dbt.size = DB_FILE_ID_LEN; + if ((ret = __dbreg_register_log(dbenv, txn, &unused, 0, LOG_OPEN, + r_name.size == 0 ? NULL : &r_name, &fid_dbt, id, fnp->s_type, + fnp->meta_pgno, fnp->create_txnid)) != 0) + goto err; + + DB_ASSERT(dbp->type == fnp->s_type); + DB_ASSERT(dbp->meta_pgno == fnp->meta_pgno); + + if ((ret = __dbreg_add_dbentry(dbenv, dblp, dbp, id)) != 0) + goto err; + +err: MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + return (ret); +} + +/* + * __dbreg_assign_id -- + * Assign a particular dbreg id to this database handle. + * + * PUBLIC: int __dbreg_assign_id __P((DB *, int32_t)); + */ +int +__dbreg_assign_id(dbp, id) + DB *dbp; + int32_t id; +{ + DB *close_dbp; + DB_ENV *dbenv; + DB_LOG *dblp; + FNAME *close_fnp, *fnp; + LOG *lp; + int ret; + + dbenv = dbp->dbenv; + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + fnp = dbp->log_filename; + + close_dbp = NULL; + close_fnp = NULL; + + /* The fq_mutex protects the FNAME list and id management. */ + MUTEX_LOCK(dbenv, &lp->fq_mutex); + + /* We should only call this on DB handles that have no ID. */ + DB_ASSERT(fnp->id == DB_LOGFILEID_INVALID); + + /* + * Make sure there isn't already a file open with this ID. There can + * be in recovery, if we're recovering across a point where an ID got + * reused. + */ + if (__dbreg_id_to_fname(dblp, id, 1, &close_fnp) == 0) { + /* + * We want to save off any dbp we have open with this id. + * We can't safely close it now, because we hold the fq_mutex, + * but we should be able to rely on it being open in this + * process, and we're running recovery, so no other thread + * should muck with it if we just put off closing it until + * we're ready to return. + * + * Once we have the dbp, revoke its id; we're about to + * reuse it. + */ + if ((ret = + __dbreg_id_to_db(dbenv, NULL, &close_dbp, id, 0)) != 0) + goto err; + + if ((ret = __dbreg_revoke_id(close_dbp, 1)) != 0) + goto err; + } + + /* + * Remove this ID from the free list, if it's there, and make sure + * we don't allocate it anew. + */ + if ((ret = __dbreg_pluck_id(dbenv, id)) != 0) + goto err; + if (id >= lp->fid_max) + lp->fid_max = id + 1; + + /* Now go ahead and assign the id to our dbp. */ + fnp->id = id; + SH_TAILQ_INSERT_HEAD(&lp->fq, fnp, q, __fname); + + if ((ret = __dbreg_add_dbentry(dbenv, dblp, dbp, id)) != 0) + goto err; + +err: MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + + /* There's nothing useful that our caller can do if this close fails. */ + if (close_dbp != NULL) + (void)close_dbp->close(close_dbp, DB_NOSYNC); + + return (ret); +} + +/* + * __dbreg_revoke_id -- + * Take a log id away from a dbp, in preparation for closing it, + * but without logging the close. + * + * PUBLIC: int __dbreg_revoke_id __P((DB *, int)); + */ +int +__dbreg_revoke_id(dbp, have_lock) + DB *dbp; + int have_lock; +{ + DB_ENV *dbenv; + DB_LOG *dblp; + FNAME *fnp; + LOG *lp; + int32_t id; + int ret; + + dbenv = dbp->dbenv; + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + fnp = dbp->log_filename; + + /* If we lack an ID, this is a null-op. */ + if (fnp == NULL || fnp->id == DB_LOGFILEID_INVALID) + return (0); + + if (!have_lock) + MUTEX_LOCK(dbenv, &lp->fq_mutex); + + id = fnp->id; + fnp->id = DB_LOGFILEID_INVALID; + + /* Remove the FNAME from the list of open files. */ + SH_TAILQ_REMOVE(&lp->fq, fnp, q, __fname); + + /* Remove this id from the dbentry table. */ + __dbreg_rem_dbentry(dblp, id); + + /* Push this id onto the free list. */ + ret = __dbreg_push_id(dbenv, id); + + if (!have_lock) + MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + return (ret); +} + +/* + * __dbreg_close_id -- + * Take a dbreg id away from a dbp that we're closing, and log + * the unregistry. + * + * PUBLIC: int __dbreg_close_id __P((DB *, DB_TXN *)); + */ +int +__dbreg_close_id(dbp, txn) + DB *dbp; + DB_TXN *txn; +{ + DBT fid_dbt, r_name, *dbtp; + DB_ENV *dbenv; + DB_LOG *dblp; + DB_LSN r_unused; + FNAME *fnp; + LOG *lp; + int ret; + + dbenv = dbp->dbenv; + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + fnp = dbp->log_filename; + + /* If we lack an ID, this is a null-op. */ + if (fnp == NULL || fnp->id == DB_LOGFILEID_INVALID) + return (0); + + MUTEX_LOCK(dbenv, &lp->fq_mutex); + + if (fnp->name_off == INVALID_ROFF) + dbtp = NULL; + else { + memset(&r_name, 0, sizeof(r_name)); + r_name.data = R_ADDR(&dblp->reginfo, fnp->name_off); + r_name.size = + (u_int32_t)strlen((char *)r_name.data) + 1; + dbtp = &r_name; + } + memset(&fid_dbt, 0, sizeof(fid_dbt)); + fid_dbt.data = fnp->ufid; + fid_dbt.size = DB_FILE_ID_LEN; + if ((ret = __dbreg_register_log(dbenv, txn, + &r_unused, 0, LOG_CLOSE, dbtp, &fid_dbt, fnp->id, + fnp->s_type, fnp->meta_pgno, TXN_INVALID)) != 0) + goto err; + + ret = __dbreg_revoke_id(dbp, 1); + +err: MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + return (ret); +} diff --git a/db/dbreg/dbreg.src b/db/dbreg/dbreg.src new file mode 100644 index 000000000..337ffcb61 --- /dev/null +++ b/db/dbreg/dbreg.src @@ -0,0 +1,49 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: dbreg.src,v 10.22 2002/03/27 04:31:44 bostic Exp + */ + +PREFIX __dbreg +DBPRIVATE + +INCLUDE #include "db_config.h" +INCLUDE +INCLUDE #ifndef NO_SYSTEM_INCLUDES +INCLUDE #include <sys/types.h> +INCLUDE +INCLUDE #include <ctype.h> +INCLUDE #include <string.h> +INCLUDE #endif +INCLUDE +INCLUDE #include "db_int.h" +INCLUDE #include "dbinc/crypto.h" +INCLUDE #include "dbinc/db_page.h" +INCLUDE #include "dbinc/db_dispatch.h" +INCLUDE #include "dbinc/db_am.h" +INCLUDE #include "dbinc/log.h" +INCLUDE #include "dbinc/rep.h" +INCLUDE #include "dbinc/txn.h" +INCLUDE + +/* + * Used for registering name/id translations at open or close. + * opcode: register or unregister + * name: file name + * fileid: unique file id + * ftype: file type + * ftype: database type + * id: transaction id of the subtransaction that created the fs object + */ +BEGIN register 2 +ARG opcode u_int32_t lu +DBT name DBT s +DBT uid DBT s +ARG fileid int32_t ld +ARG ftype DBTYPE lx +ARG meta_pgno db_pgno_t lu +ARG id u_int32_t lx +END diff --git a/db/dbreg/dbreg_auto.c b/db/dbreg/dbreg_auto.c new file mode 100644 index 000000000..91eace3f4 --- /dev/null +++ b/db/dbreg/dbreg_auto.c @@ -0,0 +1,358 @@ +/* Do not edit: automatically built by gen_rec.awk. */ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <ctype.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/crypto.h" +#include "dbinc/db_page.h" +#include "dbinc/db_dispatch.h" +#include "dbinc/db_am.h" +#include "dbinc/log.h" +#include "dbinc/rep.h" +#include "dbinc/txn.h" + +/* + * PUBLIC: int __dbreg_register_log __P((DB_ENV *, DB_TXN *, + * PUBLIC: DB_LSN *, u_int32_t, u_int32_t, const DBT *, const DBT *, + * PUBLIC: int32_t, DBTYPE, db_pgno_t, u_int32_t)); + */ +int +__dbreg_register_log(dbenv, txnid, ret_lsnp, flags, + opcode, name, uid, fileid, ftype, meta_pgno, + id) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + const DBT *name; + const DBT *uid; + int32_t fileid; + DBTYPE ftype; + db_pgno_t meta_pgno; + u_int32_t id; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t uinttmp; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB___dbreg_register; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + if (TAILQ_FIRST(&txnid->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + return (ret); + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + + sizeof(u_int32_t) + (name == NULL ? 0 : name->size) + + sizeof(u_int32_t) + (uid == NULL ? 0 : uid->size) + + sizeof(u_int32_t) + + sizeof(u_int32_t) + + sizeof(u_int32_t) + + sizeof(u_int32_t); + if (CRYPTO_ON(dbenv)) { + npad = + ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size); + logrec.size += npad; + } + + if ((ret = __os_malloc(dbenv, + logrec.size, &logrec.data)) != 0) + return (ret); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + uinttmp = (u_int32_t)opcode; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + if (name == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &name->size, sizeof(name->size)); + bp += sizeof(name->size); + memcpy(bp, name->data, name->size); + bp += name->size; + } + + if (uid == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &uid->size, sizeof(uid->size)); + bp += sizeof(uid->size); + memcpy(bp, uid->data, uid->size); + bp += uid->size; + } + + uinttmp = (u_int32_t)fileid; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + uinttmp = (u_int32_t)ftype; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + uinttmp = (u_int32_t)meta_pgno; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + uinttmp = (u_int32_t)id; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)__dbreg_register_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + __os_free(dbenv, logrec.data); + return (ret); +} + +/* + * PUBLIC: int __dbreg_register_getpgnos __P((DB_ENV *, DBT *, + * PUBLIC: DB_LSN *, db_recops, void *)); + */ +int +__dbreg_register_getpgnos(dbenv, rec, lsnp, notused1, summary) + DB_ENV *dbenv; + DBT *rec; + DB_LSN *lsnp; + db_recops notused1; + void *summary; +{ + TXN_RECS *t; + int ret; + COMPQUIET(rec, NULL); + COMPQUIET(notused1, DB_TXN_ABORT); + + t = (TXN_RECS *)summary; + + if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0) + return (ret); + + t->array[t->npages].flags = LSN_PAGE_NOLOCK; + t->array[t->npages].lsn = *lsnp; + t->array[t->npages].fid = DB_LOGFILEID_INVALID; + memset(&t->array[t->npages].pgdesc, 0, + sizeof(t->array[t->npages].pgdesc)); + + t->npages++; + + return (0); +} + +/* + * PUBLIC: int __dbreg_register_print __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__dbreg_register_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + __dbreg_register_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = __dbreg_register_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]__dbreg_register: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\topcode: %lu\n", (u_long)argp->opcode); + (void)printf("\tname: "); + for (i = 0; i < argp->name.size; i++) { + ch = ((u_int8_t *)argp->name.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tuid: "); + for (i = 0; i < argp->uid.size; i++) { + ch = ((u_int8_t *)argp->uid.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tfileid: %ld\n", (long)argp->fileid); + (void)printf("\tftype: 0x%lx\n", (u_long)argp->ftype); + (void)printf("\tmeta_pgno: %lu\n", (u_long)argp->meta_pgno); + (void)printf("\tid: 0x%lx\n", (u_long)argp->id); + (void)printf("\n"); + __os_free(dbenv, argp); + return (0); +} + +/* + * PUBLIC: int __dbreg_register_read __P((DB_ENV *, void *, + * PUBLIC: __dbreg_register_args **)); + */ +int +__dbreg_register_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + __dbreg_register_args **argpp; +{ + __dbreg_register_args *argp; + u_int32_t uinttmp; + u_int8_t *bp; + int ret; + + if ((ret = __os_malloc(dbenv, + sizeof(__dbreg_register_args) + sizeof(DB_TXN), &argp)) != 0) + return (ret); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->opcode = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + memset(&argp->name, 0, sizeof(argp->name)); + memcpy(&argp->name.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->name.data = bp; + bp += argp->name.size; + + memset(&argp->uid, 0, sizeof(argp->uid)); + memcpy(&argp->uid.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->uid.data = bp; + bp += argp->uid.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->fileid = (int32_t)uinttmp; + bp += sizeof(uinttmp); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->ftype = (DBTYPE)uinttmp; + bp += sizeof(uinttmp); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->meta_pgno = (db_pgno_t)uinttmp; + bp += sizeof(uinttmp); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->id = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __dbreg_init_print __P((DB_ENV *, int (***)(DB_ENV *, + * PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *)); + */ +int +__dbreg_init_print(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __dbreg_register_print, DB___dbreg_register)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __dbreg_init_getpgnos __P((DB_ENV *, + * PUBLIC: int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), + * PUBLIC: size_t *)); + */ +int +__dbreg_init_getpgnos(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __dbreg_register_getpgnos, DB___dbreg_register)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __dbreg_init_recover __P((DB_ENV *, int (***)(DB_ENV *, + * PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *)); + */ +int +__dbreg_init_recover(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __dbreg_register_recover, DB___dbreg_register)) != 0) + return (ret); + return (0); +} diff --git a/db/dbreg/dbreg_rec.c b/db/dbreg/dbreg_rec.c new file mode 100644 index 000000000..1deefa88c --- /dev/null +++ b/db/dbreg/dbreg_rec.c @@ -0,0 +1,363 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: dbreg_rec.c,v 11.107 2002/08/08 15:44:46 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/db_am.h" +#include "dbinc/log.h" +#include "dbinc/txn.h" + +static int __dbreg_open_file __P((DB_ENV *, + DB_TXN *, __dbreg_register_args *, void *)); + +/* + * PUBLIC: int __dbreg_register_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__dbreg_register_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + DB_ENTRY *dbe; + DB_LOG *dblp; + DB *dbp; + __dbreg_register_args *argp; + int do_close, do_open, do_rem, ret, t_ret; + + dblp = dbenv->lg_handle; + dbp = NULL; + +#ifdef DEBUG_RECOVER + REC_PRINT(__dbreg_register_print); +#endif + do_open = do_close = 0; + if ((ret = __dbreg_register_read(dbenv, dbtp->data, &argp)) != 0) + goto out; + + switch (argp->opcode) { + case LOG_OPEN: + if ((DB_REDO(op) || + op == DB_TXN_OPENFILES || op == DB_TXN_POPENFILES)) + do_open = 1; + else + do_close = 1; + break; + + case LOG_CLOSE: + if (DB_UNDO(op)) + do_open = 1; + else + do_close = 1; + break; + case LOG_RCLOSE: + /* + * LOG_RCLOSE was generated by recover because a file + * was left open. The POPENFILES pass, which is run + * to open files to abort prepared transactions, + * may not include the open for this file so we + * open it here. Note that a normal CLOSE is + * not legal before the prepared transaction is + * committed or aborted. + */ + if (DB_UNDO(op) || op == DB_TXN_POPENFILES) + do_open = 1; + else + do_close = 1; + break; + + case LOG_CHECKPOINT: + if (DB_UNDO(op) || + op == DB_TXN_OPENFILES || op == DB_TXN_POPENFILES) + do_open = 1; + break; + } + + if (do_open) { + /* + * We must open the db even if the meta page is not + * yet written as we may be creating subdatabase. + */ + if (op == DB_TXN_OPENFILES && argp->opcode != LOG_CHECKPOINT) + F_SET(dblp, DBLOG_FORCE_OPEN); + + /* + * During an abort or an open pass to recover prepared txns, + * we need to make sure that we use the same locker id on the + * open. We pass the txnid along to ensure this. + */ + ret = __dbreg_open_file(dbenv, + op == DB_TXN_ABORT || op == DB_TXN_POPENFILES ? + argp->txnid : NULL, argp, info); + if (ret == ENOENT || ret == EINVAL) { + /* + * If this is an OPEN while rolling forward, it's + * possible that the file was recreated since last + * time we got here. In that case, we've got deleted + * set and probably shouldn't, so we need to check + * for that case and possibly retry. + */ + if (op == DB_TXN_FORWARD_ROLL && + argp->txnid != 0 && + dblp->dbentry[argp->fileid].deleted) { + dblp->dbentry[argp->fileid].deleted = 0; + ret = + __dbreg_open_file(dbenv, NULL, argp, info); + } + ret = 0; + } + F_CLR(dblp, DBLOG_FORCE_OPEN); + } + + if (do_close) { + /* + * If we are undoing an open, or redoing a close, + * then we need to close the file. + * + * If the file is deleted, then we can just ignore this close. + * Otherwise, we should usually have a valid dbp we should + * close or whose reference count should be decremented. + * However, if we shut down without closing a file, we may, in + * fact, not have the file open, and that's OK. + */ + do_rem = 0; + MUTEX_THREAD_LOCK(dbenv, dblp->mutexp); + if (argp->fileid < dblp->dbentry_cnt) { + /* + * Typically, closes should match an open which means + * that if this is a close, there should be a valid + * entry in the dbentry table when we get here, + * however there is an exception. If this is an + * OPENFILES pass, then we may have started from + * a log file other than the first, and the + * corresponding open appears in an earlier file. + * We can ignore that case, but all others are errors. + */ + dbe = &dblp->dbentry[argp->fileid]; + if (dbe->dbp == NULL && !dbe->deleted) { + /* No valid entry here. */ + if ((argp->opcode != LOG_CLOSE && + argp->opcode != LOG_RCLOSE) || + (op != DB_TXN_OPENFILES && + op !=DB_TXN_POPENFILES)) { + __db_err(dbenv, + "Improper file close at %lu/%lu", + (u_long)lsnp->file, + (u_long)lsnp->offset); + ret = EINVAL; + } + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + goto done; + } + + /* We have either an open entry or a deleted entry. */ + if ((dbp = dbe->dbp) != NULL) { + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + (void)__dbreg_revoke_id(dbp, 0); + + /* + * If we're a replication client, it's + * possible to get here with a dbp that + * the user opened, but which we later + * assigned a fileid to. Be sure that + * we only close dbps that we opened in + * the recovery code; they should have + * DB_AM_RECOVER set. + * + * The only exception is if we're aborting + * in a normal environment; then we might + * get here with a non-AM_RECOVER database. + */ + if (F_ISSET(dbp, DB_AM_RECOVER) || + op == DB_TXN_ABORT) + do_rem = 1; + } else if (dbe->deleted) { + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + __dbreg_rem_dbentry(dblp, argp->fileid); + } + } else + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + if (do_rem) { + /* + * If we are undoing a create we'd better discard + * any buffers from the memory pool. + */ + if (dbp != NULL && dbp->mpf != NULL && argp->id != 0) { + if ((ret = dbp->mpf->close(dbp->mpf, + DB_MPOOL_DISCARD)) != 0) + goto out; + dbp->mpf = NULL; + } + + /* + * During recovery, all files are closed. On an abort, + * we only close the file if we opened it during the + * abort (DB_AM_RECOVER set), otherwise we simply do + * a __db_refresh. For the close case, if remove or + * rename has closed the file, don't request a sync, + * because the NULL mpf would be a problem. + */ + if (dbp != NULL) { + if (op == DB_TXN_ABORT && + !F_ISSET(dbp, DB_AM_RECOVER)) + t_ret = + __db_refresh(dbp, NULL, DB_NOSYNC); + else + t_ret = dbp->close(dbp, DB_NOSYNC); + if (t_ret != 0 && ret == 0) + ret = t_ret; + } + } + } +done: if (ret == 0) + *lsnp = argp->prev_lsn; +out: if (argp != NULL) + __os_free(dbenv, argp); + return (ret); +} + +/* + * __dbreg_open_file -- + * Called during log_register recovery. Make sure that we have an + * entry in the dbentry table for this ndx. Returns 0 on success, + * non-zero on error. + */ +static int +__dbreg_open_file(dbenv, txn, argp, info) + DB_ENV *dbenv; + DB_TXN *txn; + __dbreg_register_args *argp; + void *info; +{ + DB_ENTRY *dbe; + DB_LOG *lp; + DB *dbp; + int ret; + u_int32_t id; + + lp = (DB_LOG *)dbenv->lg_handle; + /* + * We never re-open temporary files. Temp files are only + * useful during aborts in which case the dbp was entered + * when the file was registered. During recovery, we treat + * temp files as properly deleted files, allowing the open to + * fail and not reporting any errors when recovery fails to + * get a valid dbp from __dbreg_id_to_db. + */ + if (argp->name.size == 0) { + (void)__dbreg_add_dbentry(dbenv, lp, NULL, argp->fileid); + return (ENOENT); + } + + /* + * When we're opening, we have to check that the name we are opening + * is what we expect. If it's not, then we close the old file and + * open the new one. + */ + MUTEX_THREAD_LOCK(dbenv, lp->mutexp); + if (argp->fileid < lp->dbentry_cnt) + dbe = &lp->dbentry[argp->fileid]; + else + dbe = NULL; + + if (dbe != NULL) { + if (dbe->deleted) { + MUTEX_THREAD_UNLOCK(dbenv, lp->mutexp); + return (ENOENT); + } + if ((dbp = dbe->dbp) != NULL) { + if (dbp->meta_pgno != argp->meta_pgno || + memcmp(dbp->fileid, + argp->uid.data, DB_FILE_ID_LEN) != 0) { + MUTEX_THREAD_UNLOCK(dbenv, lp->mutexp); + (void)__dbreg_revoke_id(dbp, 0); + if (F_ISSET(dbp, DB_AM_RECOVER)) + dbp->close(dbp, DB_NOSYNC); + goto reopen; + } + + /* + * We should only get here if we already have the + * dbp from an openfiles pass, in which case, what's + * here had better be the same dbp. + */ + DB_ASSERT(dbe->dbp == dbp); + MUTEX_THREAD_UNLOCK(dbenv, lp->mutexp); + + /* + * This is a successful open. We need to record that + * in the txnlist so that we know how to handle the + * subtransaction that created the file system object. + */ + if (argp->id != TXN_INVALID && + (ret = __db_txnlist_update(dbenv, info, + argp->id, TXN_EXPECTED, NULL)) == TXN_NOTFOUND) + ret = __db_txnlist_add(dbenv, + info, argp->id, TXN_EXPECTED, NULL); + return (0); + } + } + + MUTEX_THREAD_UNLOCK(dbenv, lp->mutexp); + + /* + * We are about to pass a recovery txn pointer into the main library. + * We need to make sure that any accessed fields are set appropriately. + */ +reopen: if (txn != NULL) { + id = txn->txnid; + memset(txn, 0, sizeof(DB_TXN)); + txn->txnid = id; + txn->mgrp = dbenv->tx_handle; + } + + return (__dbreg_do_open(dbenv, txn, lp, argp->uid.data, argp->name.data, + argp->ftype, argp->fileid, argp->meta_pgno, info, argp->id)); +} diff --git a/db/dbreg/dbreg_util.c b/db/dbreg/dbreg_util.c new file mode 100644 index 000000000..f625062c7 --- /dev/null +++ b/db/dbreg/dbreg_util.c @@ -0,0 +1,689 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: dbreg_util.c,v 11.13 2002/08/06 06:11:23 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/db_am.h" +#include "dbinc/log.h" +#include "dbinc/txn.h" + +static int __dbreg_check_master __P((DB_ENV *, u_int8_t *, char *)); + +/* + * __dbreg_add_dbentry -- + * Adds a DB entry to the dbreg DB entry table. + * + * PUBLIC: int __dbreg_add_dbentry __P((DB_ENV *, DB_LOG *, DB *, int32_t)); + */ +int +__dbreg_add_dbentry(dbenv, dblp, dbp, ndx) + DB_ENV *dbenv; + DB_LOG *dblp; + DB *dbp; + int32_t ndx; +{ + int32_t i; + int ret; + + ret = 0; + + MUTEX_THREAD_LOCK(dbenv, dblp->mutexp); + + /* + * Check if we need to grow the table. Note, ndx is 0-based (the + * index into the DB entry table) an dbentry_cnt is 1-based, the + * number of available slots. + */ + if (dblp->dbentry_cnt <= ndx) { + if ((ret = __os_realloc(dbenv, + (ndx + DB_GROW_SIZE) * sizeof(DB_ENTRY), + &dblp->dbentry)) != 0) + goto err; + + /* Initialize the new entries. */ + for (i = dblp->dbentry_cnt; i < ndx + DB_GROW_SIZE; i++) { + dblp->dbentry[i].dbp = NULL; + dblp->dbentry[i].deleted = 0; + } + dblp->dbentry_cnt = i; + } + + DB_ASSERT(dblp->dbentry[ndx].dbp == NULL); + dblp->dbentry[ndx].deleted = dbp == NULL; + dblp->dbentry[ndx].dbp = dbp; + +err: MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + return (ret); +} + +/* + * __dbreg_rem_dbentry + * Remove an entry from the DB entry table. Find the appropriate DB and + * unlink it from the linked list off the table. If the DB is NULL, treat + * this as a simple refcount decrement. + * + * PUBLIC: void __dbreg_rem_dbentry __P((DB_LOG *, int32_t)); + */ +void +__dbreg_rem_dbentry(dblp, ndx) + DB_LOG *dblp; + int32_t ndx; +{ + MUTEX_THREAD_LOCK(dblp->dbenv, dblp->mutexp); + dblp->dbentry[ndx].dbp = NULL; + dblp->dbentry[ndx].deleted = 0; + MUTEX_THREAD_UNLOCK(dblp->dbenv, dblp->mutexp); +} + +/* + * __dbreg_open_files -- + * Put a LOG_CHECKPOINT log record for each open database. + * + * PUBLIC: int __dbreg_open_files __P((DB_ENV *)); + */ +int +__dbreg_open_files(dbenv) + DB_ENV *dbenv; +{ + DB_LOG *dblp; + DB_LSN r_unused; + DBT *dbtp, fid_dbt, t; + FNAME *fnp; + LOG *lp; + int ret; + + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + + ret = 0; + + MUTEX_LOCK(dbenv, &lp->fq_mutex); + + for (fnp = SH_TAILQ_FIRST(&lp->fq, __fname); + fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) { + if (fnp->name_off == INVALID_ROFF) + dbtp = NULL; + else { + memset(&t, 0, sizeof(t)); + t.data = R_ADDR(&dblp->reginfo, fnp->name_off); + t.size = (u_int32_t)strlen(t.data) + 1; + dbtp = &t; + } + memset(&fid_dbt, 0, sizeof(fid_dbt)); + fid_dbt.data = fnp->ufid; + fid_dbt.size = DB_FILE_ID_LEN; + /* + * Output LOG_CHECKPOINT records which will be + * processed during the OPENFILES pass of recovery. + * At the end of recovery we want to output the + * files that were open so that a future recovery + * run will have the correct files open during + * a backward pass. For this we output LOG_RCLOSE + * records so that the files will be closed on + * the forward pass. + */ + if ((ret = __dbreg_register_log(dbenv, + NULL, &r_unused, 0, + F_ISSET(dblp, DBLOG_RECOVER) ? LOG_RCLOSE : LOG_CHECKPOINT, + dbtp, &fid_dbt, fnp->id, fnp->s_type, fnp->meta_pgno, + TXN_INVALID)) != 0) + break; + } + + MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + + return (ret); +} + +/* + * __dbreg_close_files -- + * Close files that were opened by the recovery daemon. We sync the + * file, unless its mpf pointer has been NULLed by a db_remove or + * db_rename. We may not have flushed the log_register record that + * closes the file. + * + * PUBLIC: int __dbreg_close_files __P((DB_ENV *)); + */ +int +__dbreg_close_files(dbenv) + DB_ENV *dbenv; +{ + DB_LOG *dblp; + DB *dbp; + int ret, t_ret; + int32_t i; + + /* If we haven't initialized logging, we have nothing to do. */ + if (!LOGGING_ON(dbenv)) + return (0); + + dblp = dbenv->lg_handle; + ret = 0; + MUTEX_THREAD_LOCK(dbenv, dblp->mutexp); + for (i = 0; i < dblp->dbentry_cnt; i++) { + /* We only want to close dbps that recovery opened. */ + if ((dbp = dblp->dbentry[i].dbp) != NULL && + F_ISSET(dbp, DB_AM_RECOVER)) { + /* + * It's unsafe to call DB->close while holding the + * thread lock, because we'll call __dbreg_rem_dbentry + * and grab it again. + * + * Just drop it. Since dbreg ids go monotonically + * upward, concurrent opens should be safe, and the + * user should have no business closing files while + * we're in this loop anyway--we're in the process of + * making all outstanding dbps invalid. + */ + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + if ((t_ret = dbp->close(dbp, + dbp->mpf == NULL ? DB_NOSYNC : 0)) != 0 && ret == 0) + ret = t_ret; + MUTEX_THREAD_LOCK(dbenv, dblp->mutexp); + } + dblp->dbentry[i].deleted = 0; + dblp->dbentry[i].dbp = NULL; + } + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + return (ret); +} + +/* + * __dbreg_id_to_db -- + * Return the DB corresponding to the specified dbreg id. + * + * PUBLIC: int __dbreg_id_to_db __P((DB_ENV *, DB_TXN *, DB **, int32_t, int)); + */ +int +__dbreg_id_to_db(dbenv, txn, dbpp, ndx, inc) + DB_ENV *dbenv; + DB_TXN *txn; + DB **dbpp; + int32_t ndx; + int inc; +{ + DB_LOG *dblp; + FNAME *fname; + int ret; + char *name; + + ret = 0; + dblp = dbenv->lg_handle; + COMPQUIET(inc, 0); + + MUTEX_THREAD_LOCK(dbenv, dblp->mutexp); + + /* + * Under XA, a process different than the one issuing DB operations + * may abort a transaction. In this case, the "recovery" routines + * are run by a process that does not necessarily have the file open, + * so we we must open the file explicitly. + */ + if (ndx >= dblp->dbentry_cnt || + (!dblp->dbentry[ndx].deleted && dblp->dbentry[ndx].dbp == NULL)) { + if (F_ISSET(dblp, DBLOG_RECOVER)) { + ret = ENOENT; + goto err; + } + + /* + * __dbreg_id_to_fname acquires the region's fq_mutex, + * which we can't safely acquire while we hold the thread lock. + * We no longer need it anyway--the dbentry table didn't + * have what we needed. + */ + MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + + if (__dbreg_id_to_fname(dblp, ndx, 0, &fname) != 0) + /* + * With transactional opens, we may actually have + * closed this file in the transaction in which + * case this will fail too. Then it's up to the + * caller to reopen the file. + */ + return (ENOENT); + + /* + * Note that we're relying on fname not to change, even + * though we released the mutex that protects it (fq_mutex) + * inside __dbreg_id_to_fname. This should be a safe + * assumption, because the other process that has the file + * open shouldn't be closing it while we're trying to abort. + */ + name = R_ADDR(&dblp->reginfo, fname->name_off); + + /* + * At this point, we are not holding the thread lock, so exit + * directly instead of going through the exit code at the + * bottom. If the __dbreg_do_open succeeded, then we don't need + * to do any of the remaining error checking at the end of this + * routine. + * XXX I am sending a NULL txnlist and 0 txnid which may be + * completely broken ;( + */ + if ((ret = __dbreg_do_open(dbenv, txn, dblp, + fname->ufid, name, fname->s_type, + ndx, fname->meta_pgno, NULL, 0)) != 0) + return (ret); + + *dbpp = dblp->dbentry[ndx].dbp; + return (0); + } + + /* + * Return DB_DELETED if the file has been deleted (it's not an error). + */ + if (dblp->dbentry[ndx].deleted) { + ret = DB_DELETED; + goto err; + } + + /* It's an error if we don't have a corresponding writeable DB. */ + if ((*dbpp = dblp->dbentry[ndx].dbp) == NULL) + ret = ENOENT; + +err: MUTEX_THREAD_UNLOCK(dbenv, dblp->mutexp); + return (ret); +} + +/* + * __dbreg_id_to_fname -- + * Traverse the shared-memory region looking for the entry that + * matches the passed dbreg id. Returns 0 on success; -1 on error. + * + * PUBLIC: int __dbreg_id_to_fname __P((DB_LOG *, int32_t, int, FNAME **)); + */ +int +__dbreg_id_to_fname(dblp, lid, have_lock, fnamep) + DB_LOG *dblp; + int32_t lid; + int have_lock; + FNAME **fnamep; +{ + DB_ENV *dbenv; + FNAME *fnp; + LOG *lp; + int ret; + + dbenv = dblp->dbenv; + lp = dblp->reginfo.primary; + + ret = -1; + + if (!have_lock) + MUTEX_LOCK(dbenv, &lp->fq_mutex); + for (fnp = SH_TAILQ_FIRST(&lp->fq, __fname); + fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) { + if (fnp->id == lid) { + *fnamep = fnp; + ret = 0; + break; + } + } + if (!have_lock) + MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + + return (ret); +} +/* + * __dbreg_fid_to_fname -- + * Traverse the shared-memory region looking for the entry that + * matches the passed file unique id. Returns 0 on success; -1 on error. + * + * PUBLIC: int __dbreg_fid_to_fname __P((DB_LOG *, u_int8_t *, int, FNAME **)); + */ +int +__dbreg_fid_to_fname(dblp, fid, have_lock, fnamep) + DB_LOG *dblp; + u_int8_t *fid; + int have_lock; + FNAME **fnamep; +{ + DB_ENV *dbenv; + FNAME *fnp; + LOG *lp; + int ret; + + dbenv = dblp->dbenv; + lp = dblp->reginfo.primary; + + ret = -1; + + if (!have_lock) + MUTEX_LOCK(dbenv, &lp->fq_mutex); + for (fnp = SH_TAILQ_FIRST(&lp->fq, __fname); + fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) { + if (memcmp(fnp->ufid, fid, DB_FILE_ID_LEN) == 0) { + *fnamep = fnp; + ret = 0; + break; + } + } + if (!have_lock) + MUTEX_UNLOCK(dbenv, &lp->fq_mutex); + + return (ret); +} + +/* + * __dbreg_get_name + * + * Interface to get name of registered files. This is mainly diagnostic + * and the name passed could be transient unless there is something + * ensuring that the file cannot be closed. + * + * PUBLIC: int __dbreg_get_name __P((DB_ENV *, u_int8_t *, char **)); + */ +int +__dbreg_get_name(dbenv, fid, namep) + DB_ENV *dbenv; + u_int8_t *fid; + char **namep; +{ + DB_LOG *dblp; + FNAME *fname; + + dblp = dbenv->lg_handle; + + if (dblp != NULL && __dbreg_fid_to_fname(dblp, fid, 0, &fname) == 0) { + *namep = R_ADDR(&dblp->reginfo, fname->name_off); + return (0); + } + + return (-1); +} + +/* + * __dbreg_do_open -- + * Open files referenced in the log. This is the part of the open that + * is not protected by the thread mutex. + * PUBLIC: int __dbreg_do_open __P((DB_ENV *, DB_TXN *, DB_LOG *, u_int8_t *, + * PUBLIC: char *, DBTYPE, int32_t, db_pgno_t, void *, u_int32_t)); + */ +int +__dbreg_do_open(dbenv, + txn, lp, uid, name, ftype, ndx, meta_pgno, info, id) + DB_ENV *dbenv; + DB_TXN *txn; + DB_LOG *lp; + u_int8_t *uid; + char *name; + DBTYPE ftype; + int32_t ndx; + db_pgno_t meta_pgno; + void *info; + u_int32_t id; +{ + DB *dbp; + int ret; + u_int32_t cstat; + + if ((ret = db_create(&dbp, lp->dbenv, 0)) != 0) + return (ret); + + /* + * We can open files under a number of different scenarios. + * First, we can open a file during a normal txn_abort, if that file + * was opened and closed during the transaction (as is the master + * database of a sub-database). + * Second, we might be aborting a transaction in XA and not have + * it open in the process that is actually doing the abort. + * Third, we might be in recovery. + * In case 3, there is no locking, so there is no issue. + * In cases 1 and 2, we are guaranteed to already hold any locks + * that we need, since we're still in the same transaction, so by + * setting DB_AM_RECOVER, we guarantee that we don't log and that + * we don't try to acquire locks on behalf of a different locker id. + */ + F_SET(dbp, DB_AM_RECOVER); + if (meta_pgno != PGNO_BASE_MD) { + memcpy(dbp->fileid, uid, DB_FILE_ID_LEN); + dbp->meta_pgno = meta_pgno; + } + dbp->type = ftype; + if ((ret = __db_dbopen(dbp, txn, name, NULL, + DB_ODDFILESIZE, __db_omode("rw----"), meta_pgno)) == 0) { + /* + * Verify that we are opening the same file that we were + * referring to when we wrote this log record. + */ + if ((meta_pgno != PGNO_BASE_MD && + __dbreg_check_master(dbenv, uid, name) != 0) || + memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) + cstat = TXN_IGNORE; + else + cstat = TXN_EXPECTED; + + /* Assign the specific dbreg id to this dbp. */ + if ((ret = __dbreg_assign_id(dbp, ndx)) != 0) + goto err; + + /* + * If we successfully opened this file, then we need to + * convey that information to the txnlist so that we + * know how to handle the subtransaction that created + * the file system object. + */ + if (id != TXN_INVALID) { + if ((ret = __db_txnlist_update(dbenv, + info, id, cstat, NULL)) == TXN_NOTFOUND) + ret = __db_txnlist_add(dbenv, + info, id, cstat, NULL); + else if (ret > 0) + ret = 0; + } +err: if (cstat == TXN_IGNORE) + goto not_right; + return (ret); + } else { + /* Record that the open failed in the txnlist. */ + if (id != TXN_INVALID && (ret = __db_txnlist_update(dbenv, + info, id, TXN_UNEXPECTED, NULL)) == TXN_NOTFOUND) + ret = __db_txnlist_add(dbenv, + info, id, TXN_UNEXPECTED, NULL); + } +not_right: + (void)dbp->close(dbp, 0); + /* Add this file as deleted. */ + (void)__dbreg_add_dbentry(dbenv, lp, NULL, ndx); + return (ENOENT); +} + +static int +__dbreg_check_master(dbenv, uid, name) + DB_ENV *dbenv; + u_int8_t *uid; + char *name; +{ + DB *dbp; + int ret; + + ret = 0; + if ((ret = db_create(&dbp, dbenv, 0)) != 0) + return (ret); + dbp->type = DB_BTREE; + F_SET(dbp, DB_AM_RECOVER); + ret = __db_dbopen(dbp, + NULL, name, NULL, 0, __db_omode("rw----"), PGNO_BASE_MD); + + if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) + ret = EINVAL; + + (void)dbp->close(dbp, 0); + return (ret); +} + +/* + * __dbreg_lazy_id -- + * When a replication client gets upgraded to being a replication master, + * it may have database handles open that have not been assigned an ID, but + * which have become legal to use for logging. + * + * This function lazily allocates a new ID for such a function, in a + * new transaction created for the purpose. We need to do this in a new + * transaction because we definitely wish to commit the dbreg_register, but + * at this point we have no way of knowing whether the log record that incited + * us to call this will be part of a committed transaction. + * + * PUBLIC: int __dbreg_lazy_id __P((DB *)); + */ +int +__dbreg_lazy_id(dbp) + DB *dbp; +{ + DB_ENV *dbenv; + DB_TXN *txn; + int ret; + + dbenv = dbp->dbenv; + + DB_ASSERT(F_ISSET(dbenv, DB_ENV_REP_MASTER)); + + if ((ret = dbenv->txn_begin(dbenv, NULL, &txn, 0)) != 0) + return (ret); + + if ((ret = __dbreg_new_id(dbp, txn)) != 0) { + (void)txn->abort(txn); + return (ret); + } + + return (txn->commit(txn, DB_TXN_NOSYNC)); +} + +/* + * __dbreg_push_id and __dbreg_pop_id -- + * Dbreg ids from closed files are kept on a stack in shared memory + * for recycling. (We want to reuse them as much as possible because each + * process keeps open files in an array by ID.) Push them to the stack and + * pop them from it, managing memory as appropriate. + * + * The stack is protected by the fq_mutex, and in both functions we assume + * that this is already locked. + * + * PUBLIC: int __dbreg_push_id __P((DB_ENV *, int32_t)); + * PUBLIC: int __dbreg_pop_id __P((DB_ENV *, int32_t *)); + */ +int +__dbreg_push_id(dbenv, id) + DB_ENV *dbenv; + int32_t id; +{ + DB_LOG *dblp; + LOG *lp; + int32_t *stack, *newstack; + int ret; + + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + + if (lp->free_fid_stack != INVALID_ROFF) + stack = R_ADDR(&dblp->reginfo, lp->free_fid_stack); + else + stack = NULL; + + /* Check if we have room on the stack. */ + if (lp->free_fids_alloced <= lp->free_fids + 1) { + R_LOCK(dbenv, &dblp->reginfo); + if ((ret = __db_shalloc(dblp->reginfo.addr, + (lp->free_fids_alloced + 20) * sizeof(u_int32_t), 0, + &newstack)) != 0) { + R_UNLOCK(dbenv, &dblp->reginfo); + return (ret); + } + + memcpy(newstack, stack, + lp->free_fids_alloced * sizeof(u_int32_t)); + lp->free_fid_stack = R_OFFSET(&dblp->reginfo, newstack); + lp->free_fids_alloced += 20; + + if (stack != NULL) + __db_shalloc_free(dblp->reginfo.addr, stack); + + stack = newstack; + R_UNLOCK(dbenv, &dblp->reginfo); + } + + DB_ASSERT(stack != NULL); + stack[lp->free_fids++] = id; + return (0); +} + +int +__dbreg_pop_id(dbenv, id) + DB_ENV *dbenv; + int32_t *id; +{ + DB_LOG *dblp; + LOG *lp; + int32_t *stack; + + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + + /* Do we have anything to pop? */ + if (lp->free_fid_stack != INVALID_ROFF && lp->free_fids > 0) { + stack = R_ADDR(&dblp->reginfo, lp->free_fid_stack); + *id = stack[--lp->free_fids]; + } else + *id = DB_LOGFILEID_INVALID; + + return (0); +} + +/* + * __dbreg_pluck_id -- + * Remove a particular dbreg id from the stack of free ids. This is + * used when we open a file, as in recovery, with a specific ID that might + * be on the stack. + * + * Returns success whether or not the particular id was found, and like + * push and pop, assumes that the fq_mutex is locked. + * + * PUBLIC: int __dbreg_pluck_id __P((DB_ENV *, int32_t)); + */ +int +__dbreg_pluck_id(dbenv, id) + DB_ENV *dbenv; + int32_t id; +{ + DB_LOG *dblp; + LOG *lp; + int32_t *stack; + int i; + + dblp = dbenv->lg_handle; + lp = dblp->reginfo.primary; + + /* Do we have anything to look at? */ + if (lp->free_fid_stack != INVALID_ROFF) { + stack = R_ADDR(&dblp->reginfo, lp->free_fid_stack); + for (i = 0; i < lp->free_fids; i++) + if (id == stack[i]) { + /* + * Found it. Overwrite it with the top + * id (which may harmlessly be itself), + * and shorten the stack by one. + */ + stack[i] = stack[lp->free_fids - 1]; + lp->free_fids--; + return (0); + } + } + + return (0); +} diff --git a/db/dist/aclocal/sosuffix.ac b/db/dist/aclocal/sosuffix.ac new file mode 100644 index 000000000..07cd36bd4 --- /dev/null +++ b/db/dist/aclocal/sosuffix.ac @@ -0,0 +1,69 @@ +# Id: sosuffix.ac,v 1.1 2002/07/08 13:15:05 dda Exp +# Determine shared object suffixes. +# +# Our method is to use the libtool variable $library_names_spec, +# set by using AC_PROG_LIBTOOL. This variable is a snippet of shell +# defined in terms of $versuffix, $release, $libname, $module and $jnimodule. +# We want to eval it and grab the suffix used for shared objects. +# By setting $module and $jnimodule to yes/no, we obtain the suffixes +# used to create dlloadable, or java loadable modules. +# On many (*nix) systems, these all evaluate to .so, but there +# are some notable exceptions. + +# This macro is used internally to discover the suffix for the current +# settings of $module and $jnimodule. The result is stored in $_SOSUFFIX. +AC_DEFUN(_SOSUFFIX_INTERNAL, [ + versuffix="" + release="" + libname=libfoo + eval library_names=\"$library_names_spec\" + _SOSUFFIX=`echo "$library_names" | sed -e 's/.*\.\([[a-zA-Z0-9_]]*\).*/\1/'` + if test "$_SOSUFFIX" = '' ; then + _SOSUFFIX=so + if test "$enable_shared" = "yes" && test "$_SOSUFFIX_MESSAGE" = ""; then + _SOSUFFIX_MESSAGE=yes + AC_MSG_WARN([libtool may not know about this architecture.]) + AC_MSG_WARN([assuming .$_SUFFIX suffix for dynamic libraries.]) + fi + fi +]) + +# SOSUFFIX_CONFIG will set the variable SOSUFFIX to be the +# shared library extension used for general linking, not dlopen. +AC_DEFUN(SOSUFFIX_CONFIG, [ + AC_MSG_CHECKING([SOSUFFIX from libtool]) + module=no + jnimodule=no + _SOSUFFIX_INTERNAL + SOSUFFIX=$_SOSUFFIX + AC_MSG_RESULT($SOSUFFIX) + AC_SUBST(SOSUFFIX) +]) + +# MODSUFFIX_CONFIG will set the variable MODSUFFIX to be the +# shared library extension used for dlopen'ed modules. +# To discover this, we set $module, simulating libtool's -module option. +AC_DEFUN(MODSUFFIX_CONFIG, [ + AC_MSG_CHECKING([MODSUFFIX from libtool]) + module=yes + jnimodule=no + _SOSUFFIX_INTERNAL + MODSUFFIX=$_SOSUFFIX + AC_MSG_RESULT($MODSUFFIX) + AC_SUBST(MODSUFFIX) +]) + +# JMODSUFFIX_CONFIG will set the variable JMODSUFFIX to be the +# shared library extension used JNI modules opened by Java. +# To discover this, we set $jnimodule, simulating libtool's -jnimodule option. +# -jnimodule is currently a Sleepycat local extension to libtool. +AC_DEFUN(JMODSUFFIX_CONFIG, [ + AC_MSG_CHECKING([JMODSUFFIX from libtool]) + module=yes + jnimodule=yes + _SOSUFFIX_INTERNAL + JMODSUFFIX=$_SOSUFFIX + AC_MSG_RESULT($JMODSUFFIX) + AC_SUBST(JMODSUFFIX) +]) + diff --git a/db/dist/s_crypto b/db/dist/s_crypto new file mode 100644 index 000000000..3597f614d --- /dev/null +++ b/db/dist/s_crypto @@ -0,0 +1,45 @@ +#!/bin/sh - +# Id: s_crypto,v 11.2 2002/03/26 23:07:52 bostic Exp + +# Remove crypto from the DB source tree. + +d=.. + +t=/tmp/__db_a +trap 'rm -f $t ; exit 0' 0 +trap 'rm -f $t ; exit 1' 1 2 3 13 15 + +if ! test -d $d/crypto; then + echo "s_crypto: no crypto sources found in the source tree." + exit 1 +fi + +# Remove the crypto. +rm -rf $d/crypto # Remove the crypto. + +# Win/32. +(echo '/#define.HAVE_CRYPTO/' && + echo 'c' && + echo '/* #undef HAVE_CRYPTO */' + echo '.' && + echo 'w' && + echo 'q') | ed $d/build_win32/db_config.h + +(echo '1,$s/^\(^crypto[^ ]* *\)\(.*\)/\1skip/' && + echo 'w' && + echo 'q') | ed ./srcfiles.in + + sh ./s_win32 + sh ./s_win32_dsp + +# VxWorks +(echo '/#define.HAVE_CRYPTO/' && + echo 'c' && + echo '/* #undef HAVE_CRYPTO */' + echo '.' && + echo 'w' && + echo 'q') | ed $d/build_vxworks/db_config.h + + cp vx_2.0/filelist $t + sed '/^crypto/d' < $t > vx_2.0/filelist + sh ./s_vxworks diff --git a/db/dist/template/rec_dbreg b/db/dist/template/rec_dbreg new file mode 100644 index 000000000..bbdf19d5f --- /dev/null +++ b/db/dist/template/rec_dbreg @@ -0,0 +1,75 @@ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/__dbreg.h" +#include "dbinc/log.h" + +/* + * __dbreg_register_recover -- + * Recovery function for register. + * + * PUBLIC: int __dbreg_register_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__dbreg_register_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __dbreg_register_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__dbreg_register_print); + REC_INTRO(__dbreg_register_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + diff --git a/db/dist/template/rec_fileops b/db/dist/template/rec_fileops new file mode 100644 index 000000000..c1487835e --- /dev/null +++ b/db/dist/template/rec_fileops @@ -0,0 +1,323 @@ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/__fop.h" +#include "dbinc/log.h" + +/* + * __fop_create_recover -- + * Recovery function for create. + * + * PUBLIC: int __fop_create_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_create_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_create_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__fop_create_print); + REC_INTRO(__fop_create_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __fop_remove_recover -- + * Recovery function for remove. + * + * PUBLIC: int __fop_remove_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_remove_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_remove_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__fop_remove_print); + REC_INTRO(__fop_remove_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __fop_write_recover -- + * Recovery function for write. + * + * PUBLIC: int __fop_write_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_write_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_write_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__fop_write_print); + REC_INTRO(__fop_write_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __fop_rename_recover -- + * Recovery function for rename. + * + * PUBLIC: int __fop_rename_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_rename_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_rename_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__fop_rename_print); + REC_INTRO(__fop_rename_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __fop_file_remove_recover -- + * Recovery function for file_remove. + * + * PUBLIC: int __fop_file_remove_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_file_remove_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_file_remove_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__fop_file_remove_print); + REC_INTRO(__fop_file_remove_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + diff --git a/db/dist/vx_2.0/BerkeleyDB.wpj b/db/dist/vx_2.0/BerkeleyDB.wpj new file mode 100644 index 000000000..78684d900 --- /dev/null +++ b/db/dist/vx_2.0/BerkeleyDB.wpj @@ -0,0 +1,251 @@ +Document file - DO NOT EDIT + +<BEGIN> BUILD_PENTIUM_debug_BUILDRULE +BerkeleyDB.out +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_AR +ar386 +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_ARCHIVE +$(PRJ_DIR)/PENTIUMgnu/BerkeleyDB_sim.a +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_AS +cc386 +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_CC +cc386 +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_CFLAGS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM \ + -O0 \ + -I$(PRJ_DIR) \ + -I$(PRJ_DIR)/.. \ + -DDIAGNOSTIC \ + -DDEBUG +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_CFLAGS_AS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_CPP +cc386 -E -P -xc +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_LD +ld386 +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_LDFLAGS +-X -N +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_NM +nm386 -g +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_POST_BUILD_RULE + +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_PRJ_LIBS + +<END> + +<BEGIN> BUILD_PENTIUM_debug_MACRO_SIZE +size386 +<END> + +<BEGIN> BUILD_PENTIUM_debug_RO_DEPEND_PATH +{$(WIND_BASE)/target/h/} \ + {$(WIND_BASE)/target/src/} \ + {$(WIND_BASE)/target/config/} +<END> + +<BEGIN> BUILD_PENTIUM_debug_TC +::tc_PENTIUMgnu +<END> + +<BEGIN> BUILD_PENTIUM_release_BUILDRULE +BerkeleyDB.out +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_AR +ar386 +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_ARCHIVE +$(PRJ_DIR)/PENTIUMgnu/BerkeleyDB_sim.a +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_AS +cc386 +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_CC +cc386 +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_CFLAGS +-mpentium \ + -ansi \ + -nostdinc \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM \ + -O2 \ + -I$(PRJ_DIR) \ + -I$(PRJ_DIR)/.. +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_CFLAGS_AS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_CPP +cc386 -E -P -xc +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_LD +ld386 +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_LDDEPS + +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_LDFLAGS +-X -N +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_NM +nm386 -g +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_POST_BUILD_RULE + +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_PRJ_LIBS + +<END> + +<BEGIN> BUILD_PENTIUM_release_MACRO_SIZE +size386 +<END> + +<BEGIN> BUILD_PENTIUM_release_RO_DEPEND_PATH +{$(WIND_BASE)/target/h/} \ + {$(WIND_BASE)/target/src/} \ + {$(WIND_BASE)/target/config/} +<END> + +<BEGIN> BUILD_PENTIUM_release_TC +::tc_PENTIUMgnu +<END> + +<BEGIN> BUILD_RULE_BerkeleyDB.out + +<END> + +<BEGIN> BUILD_RULE_BerkeleyDB_sim.out + +<END> + +<BEGIN> BUILD_RULE_archive + +<END> + +<BEGIN> BUILD_RULE_objects + +<END> + +<BEGIN> BUILD__CURRENT +PENTIUM_debug +<END> + +<BEGIN> BUILD__LIST +PENTIUM_release PENTIUM_debug +<END> + +<BEGIN> CORE_INFO_TYPE +::prj_vxApp +<END> + +<BEGIN> CORE_INFO_VERSION +2.0 +<END> + diff --git a/db/dist/vx_2.0/wpj.in b/db/dist/vx_2.0/wpj.in new file mode 100644 index 000000000..2b942bb56 --- /dev/null +++ b/db/dist/vx_2.0/wpj.in @@ -0,0 +1,160 @@ +Document file - DO NOT EDIT + +<BEGIN> BUILD_PENTIUMgnu_BUILDRULE +__DB_APPLICATION_NAME__.out +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_AR +ar386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE +$(PRJ_DIR)/PENTIUMgnu/__DB_APPLICATION_NAME__.a +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_AS +cc386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CC +cc386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS +-g \ + -mpentium \ + -ansi \ + -nostdinc \ + -fvolatile \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP +cc386 -E -P -xc +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LD +ld386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS + +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS +-X -N +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_NM +nm386 -g +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE + +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS + +<END> + +<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE +size386 +<END> + +<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH +{$(WIND_BASE)/target/h/} \ + {$(WIND_BASE)/target/src/} \ + {$(WIND_BASE)/target/config/} +<END> + +<BEGIN> BUILD_PENTIUMgnu_TC +::tc_PENTIUMgnu +<END> + +<BEGIN> BUILD_RULE_archive + +<END> + +<BEGIN> BUILD_RULE___DB_APPLICATION_NAME__.out + +<END> + +<BEGIN> BUILD_RULE_objects + +<END> + +<BEGIN> BUILD__CURRENT +PENTIUMgnu +<END> + +<BEGIN> BUILD__LIST +PENTIUMgnu +<END> + +<BEGIN> CORE_INFO_TYPE +::prj_vxApp +<END> + +<BEGIN> CORE_INFO_VERSION +2.0 +<END> + +<BEGIN> FILE___DB_APPLICATION_NAME__.c_dependDone +FALSE +<END> + +<BEGIN> FILE___DB_APPLICATION_NAME__.c_dependencies + +<END> + +<BEGIN> FILE___DB_APPLICATION_NAME__.c_objects +__DB_APPLICATION_NAME__.o +<END> + +<BEGIN> FILE___DB_APPLICATION_NAME__.c_tool +C/C++ compiler +<END> + +<BEGIN> PROJECT_FILES +$(PRJ_DIR)/__DB_APPLICATION_NAME__.c +<END> + +<BEGIN> userComments +__DB_APPLICATION_NAME__ +<END> diff --git a/db/dist/vx_3.1/Makefile.custom b/db/dist/vx_3.1/Makefile.custom new file mode 100644 index 000000000..ca781f7b2 --- /dev/null +++ b/db/dist/vx_3.1/Makefile.custom @@ -0,0 +1,51 @@ +# +# Custom Makefile shell +# +# This file may be edited freely, since it will not be regenerated +# by the project manager. +# +# Use this makefile to define rules to make external binaries +# and deposit them in the $(EXTERNAL_BINARIES_DIR) directory. +# +# If you have specified external modules during your component +# creation, you will find make rules already in place below. +# You will likely have to edit these to suit your individual +# build setup. +# +# You may wish to use the CPU, BUILD_SPEC or TOOL make variables in +# your Makefile to support builds for different architectures. Use +# the FORCE_EXTERNAL_MAKE phony target to ensure that your external +# make always runs. +# +# The example below assumes that your custom makefile is in the +# mySourceTree directory, and that the binary file it produces +# is placed into the $(BUILD_SPEC) sub-directory. +# +# EXTERNAL_SOURCE_BASE = /folk/me/mySourceTree +# EXTERNAL_MODULE = myLibrary.o +# EXTERNAL_MAKE = make +# +# $(EXTERNAL_BINARIES_DIR)/$(EXTERNAL_MODULE) : FORCE_EXTERNAL_MAKE +# $(EXTERNAL_MAKE) -C $(EXTERNAL_SOURCE_BASE) \ +# -f $(EXTERNAL_SOURCE_BASE)/Makefile \ +# CPU=$(CPU) BUILD_SPEC=$(BUILD_SPEC) $(@F) +# $(CP) $(subst /,$(DIRCHAR),$(EXTERNAL_SOURCE_BASE)/$(BUILD_SPEC)/$(@F) $@) +# +# If you are not adding your external modules from the component wizard, +# you will have to include them in your component yourself: +# +# From the GUI, you can do this with the Component's 'Add external module' +# dialog. +# +# If you are using the command line, add the module(s) by editing the +# MODULES line in component.cdf file, e.g. +# +# Component INCLUDE_MYCOMPONENT { +# +# MODULES foo.o goo.o \ +# myLibrary.o +# + + +# rules to build custom libraries + diff --git a/db/dist/vx_3.1/cdf.1 b/db/dist/vx_3.1/cdf.1 new file mode 100644 index 000000000..17db06f7e --- /dev/null +++ b/db/dist/vx_3.1/cdf.1 @@ -0,0 +1,12 @@ +/* component.cdf - dynamically updated configuration */ + +/* + * NOTE: you may edit this file to alter the configuration + * But all non-configuration information, including comments, + * will be lost upon rebuilding this project. + */ + +/* Component information */ + +Component INCLUDE_BERKELEYDB { + ENTRY_POINTS ALL_GLOBAL_SYMBOLS diff --git a/db/dist/vx_3.1/cdf.2 b/db/dist/vx_3.1/cdf.2 new file mode 100644 index 000000000..76f123af9 --- /dev/null +++ b/db/dist/vx_3.1/cdf.2 @@ -0,0 +1,9 @@ + NAME BerkeleyDB + PREF_DOMAIN ANY + _INIT_ORDER usrComponentsInit +} + +/* EntryPoint information */ + +/* Module information */ + diff --git a/db/dist/vx_3.1/cdf.3 b/db/dist/vx_3.1/cdf.3 new file mode 100644 index 000000000..a3146ced9 --- /dev/null +++ b/db/dist/vx_3.1/cdf.3 @@ -0,0 +1,2 @@ +/* Parameter information */ + diff --git a/db/dist/vx_3.1/component.cdf b/db/dist/vx_3.1/component.cdf new file mode 100644 index 000000000..91edaa878 --- /dev/null +++ b/db/dist/vx_3.1/component.cdf @@ -0,0 +1,30 @@ +/* component.cdf - dynamically updated configuration */ + +/* + * NOTE: you may edit this file to alter the configuration + * But all non-configuration information, including comments, + * will be lost upon rebuilding this project. + */ + +/* Component information */ + +Component INCLUDE___DB_CAPAPPL_NAME__ { + ENTRY_POINTS ALL_GLOBAL_SYMBOLS + MODULES __DB_APPLICATION_NAME__.o + NAME __DB_APPLICATION_NAME__ + PREF_DOMAIN ANY + _INIT_ORDER usrComponentsInit +} + +/* EntryPoint information */ + +/* Module information */ + +Module __DB_APPLICATION_NAME__.o { + + NAME __DB_APPLICATION_NAME__.o + SRC_PATH_NAME $PRJ_DIR/../__DB_APPLICATION_NAME__.c +} + +/* Parameter information */ + diff --git a/db/dist/vx_3.1/component.wpj b/db/dist/vx_3.1/component.wpj new file mode 100644 index 000000000..01c51c1b9 --- /dev/null +++ b/db/dist/vx_3.1/component.wpj @@ -0,0 +1,475 @@ +Document file - DO NOT EDIT + +<BEGIN> CORE_INFO_TYPE +::prj_component +<END> + +<BEGIN> CORE_INFO_VERSION +AE1.1 +<END> + +<BEGIN> BUILD__CURRENT +PENTIUM2gnu.debug +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_CURRENT_TARGET +default +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_DEFAULTFORCPU +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_objects +__DB_APPLICATION_NAME__.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_objects +__DB_APPLICATION_NAME__.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CFLAGS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -I$(PRJ_DIR)/../.. \ + -I$(PRJ_DIR)/../../.. \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CFLAGS_AS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_TC +::tc_PENTIUM2gnu.debug +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_DEFAULTFORCPU +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_objects +__DB_APPLICATION_NAME__.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CFLAGS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -O2 \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -I$(PRJ_DIR)/../.. \ + -I$(PRJ_DIR)/../../.. \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CFLAGS_AS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -O2 \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_RELEASE +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_RELEASE +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_TC +::tc_PENTIUM2gnu.release +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_DEFAULTFORCPU +1 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_objects +__DB_APPLICATION_NAME__.o +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CFLAGS +-mcpu=pentium \ + -march=pentium \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -I$(PRJ_DIR)/../.. \ + -I$(PRJ_DIR)/../../.. \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CFLAGS_AS +-mcpu=pentium \ + -march=pentium \ + -ansi \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_TC +::tc_PENTIUMgnu.debug +<END> + +<BEGIN> BUILD__LIST +PENTIUM2gnu.debug PENTIUM2gnu.release PENTIUMgnu.debug +<END> + +<BEGIN> PROJECT_FILES +$(PRJ_DIR)/../__DB_APPLICATION_NAME__.c \ + $(PRJ_DIR)/compConfig.c +<END> + +<BEGIN> WCC__CDF_PATH +$(PRJ_DIR) +<END> + +<BEGIN> WCC__CURRENT +PENTIUM2gnu.debug +<END> + +<BEGIN> WCC__LIST +PENTIUM2gnu.debug +<END> + +<BEGIN> WCC__MXR_LIBS +lib$(CPU)$(TOOL)vx.a +<END> + +<BEGIN> WCC__OBJS_PATH +$(WIND_BASE)/target/lib/obj$CPU$TOOLvx +<END> + diff --git a/db/dist/vx_3.1/wpj.1 b/db/dist/vx_3.1/wpj.1 new file mode 100644 index 000000000..414b4e8fa --- /dev/null +++ b/db/dist/vx_3.1/wpj.1 @@ -0,0 +1,22 @@ +Document file - DO NOT EDIT + +<BEGIN> CORE_INFO_TYPE +::prj_component +<END> + +<BEGIN> CORE_INFO_VERSION +AE1.0 +<END> + +<BEGIN> BUILD__CURRENT +PENTIUM2gnu.debug +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_CURRENT_TARGET +default +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_DEFAULTFORCPU +0 +<END> + diff --git a/db/dist/vx_3.1/wpj.2 b/db/dist/vx_3.1/wpj.2 new file mode 100644 index 000000000..0294f763e --- /dev/null +++ b/db/dist/vx_3.1/wpj.2 @@ -0,0 +1,130 @@ +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CFLAGS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. \ + -DDEBUG \ + -DDIAGNOSTIC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CFLAGS_AS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUM2gnu.debug_TC +::tc_PENTIUM2gnu.debug +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_DEFAULTFORCPU +0 +<END> + diff --git a/db/dist/vx_3.1/wpj.3 b/db/dist/vx_3.1/wpj.3 new file mode 100644 index 000000000..f06e62539 --- /dev/null +++ b/db/dist/vx_3.1/wpj.3 @@ -0,0 +1,128 @@ +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CFLAGS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -O2 \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CFLAGS_AS +-mcpu=pentiumpro \ + -march=pentiumpro \ + -ansi \ + -O2 \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM2 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_RELEASE +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_RELEASE +1 +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUM2gnu.release_TC +::tc_PENTIUM2gnu.release +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_DEFAULTFORCPU +1 +<END> + diff --git a/db/dist/vx_3.1/wpj.4 b/db/dist/vx_3.1/wpj.4 new file mode 100644 index 000000000..84de6ebf3 --- /dev/null +++ b/db/dist/vx_3.1/wpj.4 @@ -0,0 +1,135 @@ +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_infoTags +toolMacro objects +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_objects +compConfig.o +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_FILE_$(PRJ_DIR)/compConfig.c_toolMacro +CC +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_AR +arpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_AS +ccpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CC +ccpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CFLAGS +-mcpu=pentium \ + -march=pentium \ + -ansi \ + -DRW_MULTI_THREAD \ + -D_REENTRANT \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -MD \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM \ + -I$(PRJ_DIR)/.. \ + -I$(PRJ_DIR)/../.. \ + -DDEBUG \ + -DDIAGNOSTIC +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CFLAGS_AS +-mcpu=pentium \ + -march=pentium \ + -ansi \ + -g \ + -nostdlib \ + -fno-builtin \ + -fno-defer-pop \ + -P \ + -x \ + assembler-with-cpp \ + -Wall \ + -I. \ + -I$(WIND_BASE)/target/h \ + -DCPU=PENTIUM +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CPP +ccpentium -E -P +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_CPPFILT +c++filtpentium --strip-underscores +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LD +ldpentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LDFLAGS +-X +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LDPARTIAL +ccpentium \ + -B$(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ \ + -nostdlib \ + -r \ + -Wl,-X +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_LD_PARTIAL_FLAGS +-X -r +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_NM +nmpentium -g +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_DEFINE_MACRO +-D +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_GENERATE_DEPENDENCY_FILE +-MD +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_OPTION_INCLUDE_DIR +-I +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_MACRO_SIZE +sizepentium +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_RELEASE +0 +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_RO_DEPEND_PATH +$(WIND_BASE)/target/h/ +<END> + +<BEGIN> BUILD_PENTIUMgnu.debug_TC +::tc_PENTIUMgnu.debug +<END> + +<BEGIN> BUILD__LIST +PENTIUMgnu.debug PENTIUM2gnu.debug PENTIUM2gnu.release +<END> + +<BEGIN> COMPONENT_COM_TYPE + +<END> + +<BEGIN> PROJECT_FILES diff --git a/db/dist/vx_3.1/wpj.5 b/db/dist/vx_3.1/wpj.5 new file mode 100644 index 000000000..f4056e7e2 --- /dev/null +++ b/db/dist/vx_3.1/wpj.5 @@ -0,0 +1,22 @@ +<END> + +<BEGIN> WCC__CDF_PATH +$(PRJ_DIR) +<END> + +<BEGIN> WCC__CURRENT +PENTIUMgnu.debug +<END> + +<BEGIN> WCC__LIST +PENTIUMgnu.debug +<END> + +<BEGIN> WCC__MXR_LIBS +lib$(CPU)$(TOOL)vx.a +<END> + +<BEGIN> WCC__OBJS_PATH +$(WIND_BASE)/target/lib/obj$CPU$TOOLvx +<END> + diff --git a/db/dist/vx_config.in b/db/dist/vx_config.in new file mode 100644 index 000000000..5f456b7e8 --- /dev/null +++ b/db/dist/vx_config.in @@ -0,0 +1,381 @@ +/* !!! + * The CONFIG_TEST option may be added using the Tornado project build. + * DO NOT modify it here. + */ +/* Define to 1 if you want to build a version for running the test suite. */ +/* #undef CONFIG_TEST */ + +/* !!! + * The DEBUG option may be added using the Tornado project build. + * DO NOT modify it here. + */ +/* Define to 1 if you want a debugging version. */ +/* #undef DEBUG */ + +/* Define to 1 if you want a version that logs read operations. */ +/* #undef DEBUG_ROP */ + +/* Define to 1 if you want a version that logs write operations. */ +/* #undef DEBUG_WOP */ + +/* !!! + * The DIAGNOSTIC option may be added using the Tornado project build. + * DO NOT modify it here. + */ +/* Define to 1 if you want a version with run-time diagnostic checking. */ +/* #undef DIAGNOSTIC */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if Berkeley DB release includes strong cryptography. */ +#define HAVE_CRYPTO 1 + +/* Define to 1 if you have the `directio' function. */ +/* #undef HAVE_DIRECTIO */ + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */ +#define HAVE_EXIT_SUCCESS 1 + +/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */ +/* #undef HAVE_FCNTL_F_SETFD */ + +/* Define to 1 if allocated filesystem blocks are not zeroed. */ +#define HAVE_FILESYSTEM_NOTZERO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getopt' function. */ +/* #undef HAVE_GETOPT */ + +/* Define to 1 if you have the `gettimeofday' function. */ +/* #undef HAVE_GETTIMEOFDAY */ + +/* Define to 1 if you have the `getuid' function. */ +/* #undef HAVE_GETUID */ + +/* Define to 1 if you have the <inttypes.h> header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `memcmp' function. */ +#define HAVE_MEMCMP 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mlock' function. */ +/* #undef HAVE_MLOCK */ + +/* Define to 1 if you have the `mmap' function. */ +/* #undef HAVE_MMAP */ + +/* Define to 1 if you have the `munlock' function. */ +/* #undef HAVE_MUNLOCK */ + +/* Define to 1 if you have the `munmap' function. */ +/* #undef HAVE_MUNMAP */ + +/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */ +/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */ + +/* Define to 1 to use the AIX _check_lock mutexes. */ +/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */ + +/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */ +/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */ + +/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */ +/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */ + +/* Define to 1 to use the UNIX fcntl system call mutexes. */ +/* #undef HAVE_MUTEX_FCNTL */ + +/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes. + */ +/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */ + +/* Define to 1 to use the msem_XXX mutexes on HP-UX. */ +/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */ + +/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */ +/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */ + +/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */ +/* #undef HAVE_MUTEX_MSEM_INIT */ + +/* Define to 1 to use the GCC compiler and Apple PowerPC assembly language. */ +/* #undef HAVE_MUTEX_PPC_APPLE_GCC_ASSEMBLY */ + +/* Define to 1 to use the GCC compiler and generic PowerPC assembly language. + */ +/* #undef HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY */ + +/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */ +/* #undef HAVE_MUTEX_PTHREADS */ + +/* Define to 1 to use Reliant UNIX initspin mutexes. */ +/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */ + +/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */ +/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */ + +/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */ +/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */ + +/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */ +/* #undef HAVE_MUTEX_SEMA_INIT */ + +/* Define to 1 to use the SGI XXX_lock mutexes. */ +/* #undef HAVE_MUTEX_SGI_INIT_LOCK */ + +/* Define to 1 to use the Solaris _lock_XXX mutexes. */ +/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */ + +/* Define to 1 to use the Solaris lwp threads mutexes. */ +/* #undef HAVE_MUTEX_SOLARIS_LWP */ + +/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */ +/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */ + +/* Define to 1 if mutexes hold system resources. */ +#define HAVE_MUTEX_SYSTEM_RESOURCES 1 + +/* Define to 1 if fast mutexes are available. */ +#define HAVE_MUTEX_THREADS 1 + +/* Define to 1 to configure mutexes intra-process only. */ +/* #undef HAVE_MUTEX_THREAD_ONLY */ + +/* Define to 1 to use the UNIX International mutexes. */ +/* #undef HAVE_MUTEX_UI_THREADS */ + +/* Define to 1 to use the UTS compiler and assembly language mutexes. */ +/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */ + +/* Define to 1 to use VMS mutexes. */ +/* #undef HAVE_MUTEX_VMS */ + +/* Define to 1 to use VxWorks mutexes. */ +#define HAVE_MUTEX_VXWORKS 1 + +/* Define to 1 to use Windows mutexes. */ +/* #undef HAVE_MUTEX_WIN32 */ + +/* Define to 1 to use the GCC compiler and x86 assembly language mutexes. */ +/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */ + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the O_DIRECT flag. */ +/* #undef HAVE_O_DIRECT */ + +/* Define to 1 if you have the `pread' function. */ +/* #undef HAVE_PREAD */ + +/* Define to 1 if you have the `pstat_getdynamic' function. */ +/* #undef HAVE_PSTAT_GETDYNAMIC */ + +/* Define to 1 if you have the `pwrite' function. */ +/* #undef HAVE_PWRITE */ + +/* Define to 1 if building on QNX. */ +/* #undef HAVE_QNX */ + +/* Define to 1 if you have the `qsort' function. */ +#define HAVE_QSORT 1 + +/* Define to 1 if you have the `raise' function. */ +#define HAVE_RAISE 1 + +/* Define to 1 if building RPC client/server. */ +/* #undef HAVE_RPC */ + +/* Define to 1 if you have the `sched_yield' function. */ +#define HAVE_SCHED_YIELD 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `shmget' function. */ +/* #undef HAVE_SHMGET */ + +/* Define to 1 if you have the `snprintf' function. */ +/* #undef HAVE_SNPRINTF */ + +/* Define to 1 if you have the <stdint.h> header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +/* #undef HAVE_STRCASECMP */ + +/* Define to 1 if you have the `strdup' function. */ +/* #undef HAVE_STRDUP */ + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if you have the `sysconf' function. */ +/* #undef HAVE_SYSCONF */ + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the <sys/select.h> header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +/* #undef HAVE_SYS_STAT_H */ + +/* Define to 1 if you have the <sys/time.h> header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the <sys/types.h> header file. */ +/* #undef HAVE_SYS_TYPES_H */ + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if unlink of file with open file descriptors will fail. */ +#define HAVE_UNLINK_WITH_OPEN_FAILURE 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +/* #undef HAVE_VSNPRINTF */ + +/* Define to 1 if building VxWorks. */ +#define HAVE_VXWORKS 1 + +/* Define to 1 if you have the `yield' function. */ +/* #undef HAVE_YIELD */ + +/* Define to 1 if you have the `_fstati64' function. */ +/* #undef HAVE__FSTATI64 */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "support@sleepycat.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Berkeley DB" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "Berkeley DB __EDIT_DB_VERSION__" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "db-__EDIT_DB_VERSION__" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "__EDIT_DB_VERSION__" + +/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +/* #undef TIME_WITH_SYS_TIME */ + +/* Define to 1 to mask harmless unitialized memory read/writes. */ +/* #undef UMRW */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* + * Exit success/failure macros. + */ +#ifndef HAVE_EXIT_SUCCESS +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#endif + +/* + * Don't step on the namespace. Other libraries may have their own + * implementations of these functions, we don't want to use their + * implementations or force them to use ours based on the load order. + */ +#ifndef HAVE_GETCWD +#define getcwd __db_Cgetcwd +#endif +#ifndef HAVE_GETOPT +#define getopt __db_Cgetopt +#define optarg __db_Coptarg +#define opterr __db_Copterr +#define optind __db_Coptind +#define optopt __db_Coptopt +#endif +#ifndef HAVE_MEMCMP +#define memcmp __db_Cmemcmp +#endif +#ifndef HAVE_MEMCPY +#define memcpy __db_Cmemcpy +#endif +#ifndef HAVE_MEMMOVE +#define memmove __db_Cmemmove +#endif +#ifndef HAVE_RAISE +#define raise __db_Craise +#endif +#ifndef HAVE_SNPRINTF +#define snprintf __db_Csnprintf +#endif +#ifndef HAVE_STRCASECMP +#define strcasecmp __db_Cstrcasecmp +#define strncasecmp __db_Cstrncasecmp +#endif +#ifndef HAVE_STRERROR +#define strerror __db_Cstrerror +#endif +#ifndef HAVE_VSNPRINTF +#define vsnprintf __db_Cvsnprintf +#endif + +/* + * !!! + * The following is not part of the automatic configuration setup, but + * provides the information necessary to build Berkeley DB on VxWorks. + */ +#include "vxWorks.h" diff --git a/db/dist/win_config.in b/db/dist/win_config.in new file mode 100644 index 000000000..52f3e5bf8 --- /dev/null +++ b/db/dist/win_config.in @@ -0,0 +1,439 @@ +/* Define to 1 if you want to build a version for running the test suite. */ +/* #undef CONFIG_TEST */ + +/* Define to 1 if you want a debugging version. */ +/* #undef DEBUG */ +#if defined(_DEBUG) +#if !defined(DEBUG) +#define DEBUG 1 +#endif +#endif + +/* Define to 1 if you want a version that logs read operations. */ +/* #undef DEBUG_ROP */ + +/* Define to 1 if you want a version that logs write operations. */ +/* #undef DEBUG_WOP */ + +/* Define to 1 if you want a version with run-time diagnostic checking. */ +/* #undef DIAGNOSTIC */ + +/* Define to 1 if you have the `clock_gettime' function. */ +/* #undef HAVE_CLOCK_GETTIME */ + +/* Define to 1 if Berkeley DB release includes strong cryptography. */ +#define HAVE_CRYPTO 1 + +/* Define to 1 if you have the `directio' function. */ +/* #undef HAVE_DIRECTIO */ + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_DIRENT_H */ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */ +#define HAVE_EXIT_SUCCESS 1 + +/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */ +/* #undef HAVE_FCNTL_F_SETFD */ + +/* Define to 1 if allocated filesystem blocks are not zeroed. */ +#define HAVE_FILESYSTEM_NOTZERO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getopt' function. */ +/* #undef HAVE_GETOPT */ + +/* Define to 1 if you have the `gettimeofday' function. */ +/* #undef HAVE_GETTIMEOFDAY */ + +/* Define to 1 if you have the `getuid' function. */ +/* #undef HAVE_GETUID */ + +/* Define to 1 if you have the <inttypes.h> header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `memcmp' function. */ +#define HAVE_MEMCMP 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mlock' function. */ +/* #undef HAVE_MLOCK */ + +/* Define to 1 if you have the `mmap' function. */ +/* #undef HAVE_MMAP */ + +/* Define to 1 if you have the `munlock' function. */ +/* #undef HAVE_MUNLOCK */ + +/* Define to 1 if you have the `munmap' function. */ +/* #undef HAVE_MUNMAP */ + +/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */ +/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */ + +/* Define to 1 to use the AIX _check_lock mutexes. */ +/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */ + +/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */ +/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */ + +/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */ +/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */ + +/* Define to 1 to use the UNIX fcntl system call mutexes. */ +/* #undef HAVE_MUTEX_FCNTL */ + +/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes. + */ +/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */ + +/* Define to 1 to use the msem_XXX mutexes on HP-UX. */ +/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */ + +/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */ +/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */ + +/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */ +/* #undef HAVE_MUTEX_MSEM_INIT */ + +/* Define to 1 to use the GCC compiler and Apple PowerPC assembly language. */ +/* #undef HAVE_MUTEX_PPC_APPLE_GCC_ASSEMBLY */ + +/* Define to 1 to use the GCC compiler and generic PowerPC assembly language. + */ +/* #undef HAVE_MUTEX_PPC_GENERIC_GCC_ASSEMBLY */ + +/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */ +/* #undef HAVE_MUTEX_PTHREADS */ + +/* Define to 1 to use Reliant UNIX initspin mutexes. */ +/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */ + +/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */ +/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */ + +/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */ +/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */ + +/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */ +/* #undef HAVE_MUTEX_SEMA_INIT */ + +/* Define to 1 to use the SGI XXX_lock mutexes. */ +/* #undef HAVE_MUTEX_SGI_INIT_LOCK */ + +/* Define to 1 to use the Solaris _lock_XXX mutexes. */ +/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */ + +/* Define to 1 to use the Solaris lwp threads mutexes. */ +/* #undef HAVE_MUTEX_SOLARIS_LWP */ + +/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */ +/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */ + +/* Define to 1 if mutexes hold system resources. */ +/* #undef HAVE_MUTEX_SYSTEM_RESOURCES */ + +/* Define to 1 if fast mutexes are available. */ +#define HAVE_MUTEX_THREADS 1 + +/* Define to 1 to configure mutexes intra-process only. */ +/* #undef HAVE_MUTEX_THREAD_ONLY */ + +/* Define to 1 to use the UNIX International mutexes. */ +/* #undef HAVE_MUTEX_UI_THREADS */ + +/* Define to 1 to use the UTS compiler and assembly language mutexes. */ +/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */ + +/* Define to 1 to use VMS mutexes. */ +/* #undef HAVE_MUTEX_VMS */ + +/* Define to 1 to use VxWorks mutexes. */ +/* #undef HAVE_MUTEX_VXWORKS */ + +/* Define to 1 to use Windows mutexes. */ +#define HAVE_MUTEX_WIN32 1 + +/* Define to 1 to use the GCC compiler and x86 assembly language mutexes. */ +/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */ + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the O_DIRECT flag. */ +/* #undef HAVE_O_DIRECT */ + +/* Define to 1 if you have the `pread' function. */ +/* #undef HAVE_PREAD */ + +/* Define to 1 if you have the `pstat_getdynamic' function. */ +/* #undef HAVE_PSTAT_GETDYNAMIC */ + +/* Define to 1 if you have the `pwrite' function. */ +/* #undef HAVE_PWRITE */ + +/* Define to 1 if building on QNX. */ +/* #undef HAVE_QNX */ + +/* Define to 1 if you have the `qsort' function. */ +#define HAVE_QSORT 1 + +/* Define to 1 if you have the `raise' function. */ +#define HAVE_RAISE 1 + +/* Define to 1 if building RPC client/server. */ +/* #undef HAVE_RPC */ + +/* Define to 1 if you have the `sched_yield' function. */ +/* #undef HAVE_SCHED_YIELD */ + +/* Define to 1 if you have the `select' function. */ +/* #undef HAVE_SELECT */ + +/* Define to 1 if you have the `shmget' function. */ +/* #undef HAVE_SHMGET */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +/* #undef HAVE_STRCASECMP */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */ + +/* Define to 1 if you have the `sysconf' function. */ +/* #undef HAVE_SYSCONF */ + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the <sys/select.h> header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if unlink of file with open file descriptors will fail. */ +/* #undef HAVE_UNLINK_WITH_OPEN_FAILURE */ + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if building VxWorks. */ +/* #undef HAVE_VXWORKS */ + +/* Define to 1 if you have the `yield' function. */ +/* #undef HAVE_YIELD */ + +/* Define to 1 if you have the `_fstati64' function. */ +#define HAVE__FSTATI64 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "support@sleepycat.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Berkeley DB" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "Berkeley DB __EDIT_DB_VERSION__" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "db-__EDIT_DB_VERSION__" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "__EDIT_DB_VERSION__" + +/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +/* #undef TIME_WITH_SYS_TIME */ + +/* Define to 1 to mask harmless unitialized memory read/writes. */ +/* #undef UMRW */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* + * Exit success/failure macros. + */ +#ifndef HAVE_EXIT_SUCCESS +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#endif + +/* + * Don't step on the namespace. Other libraries may have their own + * implementations of these functions, we don't want to use their + * implementations or force them to use ours based on the load order. + */ +#ifndef HAVE_GETCWD +#define getcwd __db_Cgetcwd +#endif +#ifndef HAVE_MEMCMP +#define memcmp __db_Cmemcmp +#endif +#ifndef HAVE_MEMCPY +#define memcpy __db_Cmemcpy +#endif +#ifndef HAVE_MEMMOVE +#define memmove __db_Cmemmove +#endif +#ifndef HAVE_RAISE +#define raise __db_Craise +#endif +#ifndef HAVE_SNPRINTF +#define snprintf __db_Csnprintf +#endif +#ifndef HAVE_STRCASECMP +#define strcasecmp __db_Cstrcasecmp +#define strncasecmp __db_Cstrncasecmp +#endif +#ifndef HAVE_STRERROR +#define strerror __db_Cstrerror +#endif +#ifndef HAVE_VSNPRINTF +#define vsnprintf __db_Cvsnprintf +#endif + +/* + * XXX + * The following is not part of the automatic configuration setup, but + * provides the information necessary to build Berkeley DB on Windows. + */ +#include <sys/types.h> +#include <sys/stat.h> + +#include <direct.h> +#include <fcntl.h> +#include <io.h> +#include <limits.h> +#include <memory.h> +#include <process.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <errno.h> + +/* + * To build Tcl interface libraries, the include path must be configured to + * use the directory containing <tcl.h>, usually the include directory in + * the Tcl distribution. + */ +#ifdef DB_TCL_SUPPORT +#include <tcl.h> +#endif + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +/* + * All of the necessary includes have been included, ignore the #includes + * in the Berkeley DB source files. + */ +#define NO_SYSTEM_INCLUDES + +/* + * Win32 has getcwd, snprintf and vsnprintf, but under different names. + */ +#define getcwd(buf, size) _getcwd(buf, size) +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +/* + * Win32 does not define getopt and friends in any header file, so we must. + */ +#if defined(__cplusplus) +extern "C" { +#endif +extern int optind; +extern char *optarg; +extern int getopt(int, char * const *, const char *); +#if defined(__cplusplus) +} +#endif + +/* + * We use DB_WIN32 much as one would use _WIN32, to determine that we're + * using an operating system environment that supports Win32 calls + * and semantics. We don't use _WIN32 because cygwin/gcc also defines + * that, even though it closely emulates the Unix environment. + */ +#define DB_WIN32 1 + +/* + * This is a grievous hack -- once we've included windows.h, we have no choice + * but to use ANSI-style varargs (because it pulls in stdarg.h for us). DB's + * code decides which type of varargs to use based on the state of __STDC__. + * Sensible. Unfortunately, Microsoft's compiler _doesn't_ define __STDC__ + * unless you invoke it with arguments turning OFF all vendor extensions. Even + * more unfortunately, if we do that, it fails to parse windows.h!!!!! So, we + * define __STDC__ here, after windows.h comes in. Note: the compiler knows + * we've defined it, and starts enforcing strict ANSI compilance from this point + * on. + */ +#define __STDC__ 1 diff --git a/db/docs/api_c/db_set_cache_priority.html b/db/docs/api_c/db_set_cache_priority.html new file mode 100644 index 000000000..39e2588f9 --- /dev/null +++ b/db/docs/api_c/db_set_cache_priority.html @@ -0,0 +1,110 @@ +<!--Id: db_set_cache_priority.so,v 10.3 2002/06/24 14:49:09 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB->set_cache_priority</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB->set_cache_priority</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB->set_cache_priority(DB *db, DB_CACHE_PRIORITY priority); +</pre></h3> +<h1>Description</h1> +<p>Set the cache priority for pages from the specified database. The +priority of a page biases the replacement algorithm to be more or less +likely to discard a page when space is needed in the buffer pool. The +bias is temporary, and pages will eventually be discarded if they are +not referenced again. The DB->set_cache_priority interface is +only advisory, and does not guarantee pages will be treated in a specific +way. +<p>The <b>priority</b> argument must be set to one of the following values: +<p><dl compact> +<p><dt><a name="DB_PRIORITY_VERY_LOW">DB_PRIORITY_VERY_LOW</a><dd>The lowest priority: pages are the most likely to be discarded. +<dt><a name="DB_PRIORITY_LOW">DB_PRIORITY_LOW</a><dd>The next lowest priority. +<dt><a name="DB_PRIORITY_DEFAULT">DB_PRIORITY_DEFAULT</a><dd>The default priority. +<dt><a name="DB_PRIORITY_HIGH">DB_PRIORITY_HIGH</a><dd>The next highest priority. +<dt><a name="DB_PRIORITY_VERY_HIGH">DB_PRIORITY_VERY_HIGH</a><dd>The highest priority: pages are the least likely to be discarded. +</dl> +<p>The DB->set_cache_priority function configures a database, not only operations performed +using the specified <a href="../api_c/db_create.html">DB</a> handle. +<p>The DB->set_cache_priority interface may be called at any time during the life of +the application. +<p>The DB->set_cache_priority function returns a non-zero error value on failure and 0 on success. +<h1>Errors</h1> +<p>The DB->set_cache_priority function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB->set_cache_priority function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/db_create.html">db_create</a>, +<a href="../api_c/db_set_alloc.html">DB->set_alloc</a>, +<a href="../api_c/db_associate.html">DB->associate</a>, +<a href="../api_c/db_close.html">DB->close</a>, +<a href="../api_c/db_cursor.html">DB->cursor</a>, +<a href="../api_c/db_del.html">DB->del</a>, +<a href="../api_c/db_err.html">DB->err</a>, +<a href="../api_c/db_err.html">DB->errx</a>, +<a href="../api_c/db_fd.html">DB->fd</a>, +<a href="../api_c/db_get.html">DB->get</a>, +<a href="../api_c/db_get_byteswapped.html">DB->get_byteswapped</a>, +<a href="../api_c/db_get_type.html">DB->get_type</a>, +<a href="../api_c/db_join.html">DB->join</a>, +<a href="../api_c/db_key_range.html">DB->key_range</a>, +<a href="../api_c/db_open.html">DB->open</a>, +<a href="../api_c/db_get.html">DB->pget</a>, +<a href="../api_c/db_put.html">DB->put</a>, +<a href="../api_c/db_remove.html">DB->remove</a>, +<a href="../api_c/db_rename.html">DB->rename</a>, +<a href="../api_c/db_set_append_recno.html">DB->set_append_recno</a>, +<a href="../api_c/db_set_bt_compare.html">DB->set_bt_compare</a>, +<a href="../api_c/db_set_bt_minkey.html">DB->set_bt_minkey</a>, +<a href="../api_c/db_set_bt_prefix.html">DB->set_bt_prefix</a>, +<a href="../api_c/db_set_cache_priority.html">DB->set_cache_priority</a>, +<a href="../api_c/db_set_cachesize.html">DB->set_cachesize</a>, +<a href="../api_c/db_set_dup_compare.html">DB->set_dup_compare</a>, +<a href="../api_c/db_set_encrypt.html">DB->set_encrypt</a>, +<a href="../api_c/db_set_errcall.html">DB->set_errcall</a>, +<a href="../api_c/db_set_errfile.html">DB->set_errfile</a>, +<a href="../api_c/db_set_errpfx.html">DB->set_errpfx</a>, +<a href="../api_c/db_set_feedback.html">DB->set_feedback</a>, +<a href="../api_c/db_set_flags.html">DB->set_flags</a>, +<a href="../api_c/db_set_h_ffactor.html">DB->set_h_ffactor</a>, +<a href="../api_c/db_set_h_hash.html">DB->set_h_hash</a>, +<a href="../api_c/db_set_h_nelem.html">DB->set_h_nelem</a>, +<a href="../api_c/db_set_lorder.html">DB->set_lorder</a>, +<a href="../api_c/db_set_pagesize.html">DB->set_pagesize</a>, +<a href="../api_c/db_set_paniccall.html">DB->set_paniccall</a>, +<a href="../api_c/db_set_q_extentsize.html">DB->set_q_extentsize</a>, +<a href="../api_c/db_set_re_delim.html">DB->set_re_delim</a>, +<a href="../api_c/db_set_re_len.html">DB->set_re_len</a>, +<a href="../api_c/db_set_re_pad.html">DB->set_re_pad</a>, +<a href="../api_c/db_set_re_source.html">DB->set_re_source</a>, +<a href="../api_c/db_stat.html">DB->stat</a>, +<a href="../api_c/db_sync.html">DB->sync</a>, +<a href="../api_c/db_truncate.html">DB->truncate</a>, +<a href="../api_c/db_upgrade.html">DB->upgrade</a> +and +<a href="../api_c/db_verify.html">DB->verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/db_set_encrypt.html b/db/docs/api_c/db_set_encrypt.html new file mode 100644 index 000000000..790a7d336 --- /dev/null +++ b/db/docs/api_c/db_set_encrypt.html @@ -0,0 +1,113 @@ +<!--Id: db_set_encrypt.so,v 10.2 2002/06/24 14:49:10 bostic Exp --> +<!--Id: env_set_encrypt.so,v 10.3 2002/06/24 14:49:18 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB->set_encrypt</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB->set_encrypt</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB->set_encrypt(DB *db, const char *passwd, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>Set the password used by the <a href="../api_c/env_create.html">DB_ENV</a> and <a href="../api_c/db_create.html">DB</a> methods to +perform encryption and decryption. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_ENCRYPT_AES">DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard +and Federal Information Processing Standard (FIPS) 197) algorithm for +encryption or decryption. +</dl> +<p>Because databases opened within Berkeley DB environments use the password +specified to the environment, it is an error to attempt to set a +password in a database created within an environment. +<p>The DB->set_encrypt interface may not be called after the <a href="../api_c/db_open.html">DB->open</a> +interface is called. +<p>The DB->set_encrypt function returns a non-zero error value on failure and 0 on success. +<h1>Errors</h1> +<p>The DB->set_encrypt function may fail and return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after +<a href="../api_c/db_open.html">DB->open</a> +was called. +</dl> +<p>The DB->set_encrypt function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB->set_encrypt function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/db_create.html">db_create</a>, +<a href="../api_c/db_set_alloc.html">DB->set_alloc</a>, +<a href="../api_c/db_associate.html">DB->associate</a>, +<a href="../api_c/db_close.html">DB->close</a>, +<a href="../api_c/db_cursor.html">DB->cursor</a>, +<a href="../api_c/db_del.html">DB->del</a>, +<a href="../api_c/db_err.html">DB->err</a>, +<a href="../api_c/db_err.html">DB->errx</a>, +<a href="../api_c/db_fd.html">DB->fd</a>, +<a href="../api_c/db_get.html">DB->get</a>, +<a href="../api_c/db_get_byteswapped.html">DB->get_byteswapped</a>, +<a href="../api_c/db_get_type.html">DB->get_type</a>, +<a href="../api_c/db_join.html">DB->join</a>, +<a href="../api_c/db_key_range.html">DB->key_range</a>, +<a href="../api_c/db_open.html">DB->open</a>, +<a href="../api_c/db_get.html">DB->pget</a>, +<a href="../api_c/db_put.html">DB->put</a>, +<a href="../api_c/db_remove.html">DB->remove</a>, +<a href="../api_c/db_rename.html">DB->rename</a>, +<a href="../api_c/db_set_append_recno.html">DB->set_append_recno</a>, +<a href="../api_c/db_set_bt_compare.html">DB->set_bt_compare</a>, +<a href="../api_c/db_set_bt_minkey.html">DB->set_bt_minkey</a>, +<a href="../api_c/db_set_bt_prefix.html">DB->set_bt_prefix</a>, +<a href="../api_c/db_set_cache_priority.html">DB->set_cache_priority</a>, +<a href="../api_c/db_set_cachesize.html">DB->set_cachesize</a>, +<a href="../api_c/db_set_dup_compare.html">DB->set_dup_compare</a>, +<a href="../api_c/db_set_encrypt.html">DB->set_encrypt</a>, +<a href="../api_c/db_set_errcall.html">DB->set_errcall</a>, +<a href="../api_c/db_set_errfile.html">DB->set_errfile</a>, +<a href="../api_c/db_set_errpfx.html">DB->set_errpfx</a>, +<a href="../api_c/db_set_feedback.html">DB->set_feedback</a>, +<a href="../api_c/db_set_flags.html">DB->set_flags</a>, +<a href="../api_c/db_set_h_ffactor.html">DB->set_h_ffactor</a>, +<a href="../api_c/db_set_h_hash.html">DB->set_h_hash</a>, +<a href="../api_c/db_set_h_nelem.html">DB->set_h_nelem</a>, +<a href="../api_c/db_set_lorder.html">DB->set_lorder</a>, +<a href="../api_c/db_set_pagesize.html">DB->set_pagesize</a>, +<a href="../api_c/db_set_paniccall.html">DB->set_paniccall</a>, +<a href="../api_c/db_set_q_extentsize.html">DB->set_q_extentsize</a>, +<a href="../api_c/db_set_re_delim.html">DB->set_re_delim</a>, +<a href="../api_c/db_set_re_len.html">DB->set_re_len</a>, +<a href="../api_c/db_set_re_pad.html">DB->set_re_pad</a>, +<a href="../api_c/db_set_re_source.html">DB->set_re_source</a>, +<a href="../api_c/db_stat.html">DB->stat</a>, +<a href="../api_c/db_sync.html">DB->sync</a>, +<a href="../api_c/db_truncate.html">DB->truncate</a>, +<a href="../api_c/db_upgrade.html">DB->upgrade</a> +and +<a href="../api_c/db_verify.html">DB->verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/env_dbremove.html b/db/docs/api_c/env_dbremove.html new file mode 100644 index 000000000..e4860c6d4 --- /dev/null +++ b/db/docs/api_c/env_dbremove.html @@ -0,0 +1,121 @@ +<!--Id: env_dbremove.so,v 10.31 2002/08/02 18:41:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB_ENV->dbremove</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB_ENV->dbremove</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB_ENV->dbremove(DB_ENV *dbenv, DB_TXN *txnid, + const char *file, const char *database, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The DB_ENV->dbremove function removes the database specified by the +<b>file</b> and <b>database</b> arguments. If no <b>database</b> is +specified, the underlying file represented by <b>file</b> is removed, +incidentally removing all databases that it contained. +<p>Applications should never remove databases with open <a href="../api_c/db_create.html">DB</a> handles, +or in the case of removing a file, when any database in the file has an +open handle. For example, some architectures do not permit the removal +of files with open system handles. On these architectures, attempts to +remove databases currently in use by any thread of control in the system +will fail. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_c/txn_begin.html">DB_ENV->txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the DB_ENV->dbremove call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The DB_ENV->dbremove function returns a non-zero error value on failure and 0 on success. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>The +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>DB_ENV->dbremove is affected by any database directory specified using the +<a href="../api_c/env_set_data_dir.html">DB_ENV->set_data_dir</a> function, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<h1>Errors</h1> +<p>The DB_ENV->dbremove function may fail and return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>DB_LOCK_DEADLOCK<dd>The operation was selected to resolve a deadlock. +</dl> +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>A database in the file is currently open. +<p>Called before <a href="../api_c/env_open.html">DB_ENV->open</a> was called. +</dl> +<p>The DB_ENV->dbremove function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB_ENV->dbremove function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/env_create.html">db_env_create</a>, +<a href="../api_c/env_close.html">DB_ENV->close</a>, +<a href="../api_c/env_dbremove.html">DB_ENV->dbremove</a>, +<a href="../api_c/env_dbrename.html">DB_ENV->dbrename</a>, +<a href="../api_c/env_err.html">DB_ENV->err</a>, +<a href="../api_c/env_err.html">DB_ENV->errx</a>, +<a href="../api_c/env_open.html">DB_ENV->open</a>, +<a href="../api_c/env_remove.html">DB_ENV->remove</a>, +<a href="../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>, +<a href="../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a>, +<a href="../api_c/env_set_cachesize.html">DB_ENV->set_cachesize</a>, +<a href="../api_c/env_set_data_dir.html">DB_ENV->set_data_dir</a>, +<a href="../api_c/env_set_encrypt.html">DB_ENV->set_encrypt</a>, +<a href="../api_c/env_set_errcall.html">DB_ENV->set_errcall</a>, +<a href="../api_c/env_set_errfile.html">DB_ENV->set_errfile</a>, +<a href="../api_c/env_set_errpfx.html">DB_ENV->set_errpfx</a>, +<a href="../api_c/env_set_feedback.html">DB_ENV->set_feedback</a>, +<a href="../api_c/env_set_flags.html">DB_ENV->set_flags</a>, +<a href="../api_c/env_set_lg_bsize.html">DB_ENV->set_lg_bsize</a>, +<a href="../api_c/env_set_lg_dir.html">DB_ENV->set_lg_dir</a>, +<a href="../api_c/env_set_lg_max.html">DB_ENV->set_lg_max</a>, +<a href="../api_c/env_set_lg_regionmax.html">DB_ENV->set_lg_regionmax</a>, +<a href="../api_c/env_set_lk_conflicts.html">DB_ENV->set_lk_conflicts</a>, +<a href="../api_c/env_set_lk_detect.html">DB_ENV->set_lk_detect</a>, +<a href="../api_c/env_set_lk_max_lockers.html">DB_ENV->set_lk_max_lockers</a>, +<a href="../api_c/env_set_lk_max_locks.html">DB_ENV->set_lk_max_locks</a>, +<a href="../api_c/env_set_lk_max_objects.html">DB_ENV->set_lk_max_objects</a>, +<a href="../api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a>, +<a href="../api_c/env_set_paniccall.html">DB_ENV->set_paniccall</a>, +<a href="../api_c/env_set_rpc_server.html">DB_ENV->set_rpc_server</a>, +<a href="../api_c/env_set_shm_key.html">DB_ENV->set_shm_key</a>, +<a href="../api_c/env_set_tas_spins.html">DB_ENV->set_tas_spins</a>, +<a href="../api_c/env_set_timeout.html">DB_ENV->set_timeout</a>, +<a href="../api_c/env_set_tmp_dir.html">DB_ENV->set_tmp_dir</a>, +<a href="../api_c/env_set_tx_max.html">DB_ENV->set_tx_max</a>, +<a href="../api_c/env_set_tx_timestamp.html">DB_ENV->set_tx_timestamp</a>, +<a href="../api_c/env_set_verbose.html">DB_ENV->set_verbose</a>, +<a href="../api_c/env_strerror.html">db_strerror</a> +and +<a href="../api_c/env_version.html">db_version</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/env_dbrename.html b/db/docs/api_c/env_dbrename.html new file mode 100644 index 000000000..ff2b5a547 --- /dev/null +++ b/db/docs/api_c/env_dbrename.html @@ -0,0 +1,132 @@ +<!--Id: env_dbrename.so,v 10.17 2002/08/02 18:41:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB_ENV->dbrename</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB_ENV->dbrename</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB_ENV->dbrename(DB_ENV *dbenv, DB_TXN *txnid, const char *file, + const char *database, const char *newname, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The DB_ENV->dbrename function renames the database specified by the +<b>file</b> and <b>database</b> arguments to <b>newname</b>. If no +<b>database</b> is specified, the underlying file represented by +<b>file</b> is renamed, incidentally renaming all databases that it +contained. +<p>Applications should not rename databases that are currently in use. If +an underlying file is being renamed and logging is currently enabled in +the database environment, no database in the file may be open when the +DB_ENV->dbrename function is called. In particular, some architectures do +not permit renaming files with open handles. On these architectures, +attempts to rename databases that are currently in use by any thread of +control in the system will fail. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_c/txn_begin.html">DB_ENV->txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the DB_ENV->dbrename call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The DB_ENV->dbrename function returns a non-zero error value on failure and 0 on success. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>The +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>DB_ENV->dbrename is affected by any database directory specified using the +<a href="../api_c/env_set_data_dir.html">DB_ENV->set_data_dir</a> function, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<h1>Errors</h1> +<p>The DB_ENV->dbrename function may fail and return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>DB_LOCK_DEADLOCK<dd>The operation was selected to resolve a deadlock. +</dl> +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>A database in the file is currently open. +<p>Called before <a href="../api_c/env_open.html">DB_ENV->open</a> was called. +</dl> +<p>The DB_ENV->dbrename function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB_ENV->dbrename function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/db_create.html">db_create</a>, +<a href="../api_c/db_set_alloc.html">DB->set_alloc</a>, +<a href="../api_c/db_associate.html">DB->associate</a>, +<a href="../api_c/db_close.html">DB->close</a>, +<a href="../api_c/db_cursor.html">DB->cursor</a>, +<a href="../api_c/db_del.html">DB->del</a>, +<a href="../api_c/db_err.html">DB->err</a>, +<a href="../api_c/db_err.html">DB->errx</a>, +<a href="../api_c/db_fd.html">DB->fd</a>, +<a href="../api_c/db_get.html">DB->get</a>, +<a href="../api_c/db_get_byteswapped.html">DB->get_byteswapped</a>, +<a href="../api_c/db_get_type.html">DB->get_type</a>, +<a href="../api_c/db_join.html">DB->join</a>, +<a href="../api_c/db_key_range.html">DB->key_range</a>, +<a href="../api_c/db_open.html">DB->open</a>, +<a href="../api_c/db_get.html">DB->pget</a>, +<a href="../api_c/db_put.html">DB->put</a>, +<a href="../api_c/db_remove.html">DB->remove</a>, +<a href="../api_c/db_rename.html">DB->rename</a>, +<a href="../api_c/db_set_append_recno.html">DB->set_append_recno</a>, +<a href="../api_c/db_set_bt_compare.html">DB->set_bt_compare</a>, +<a href="../api_c/db_set_bt_minkey.html">DB->set_bt_minkey</a>, +<a href="../api_c/db_set_bt_prefix.html">DB->set_bt_prefix</a>, +<a href="../api_c/db_set_cache_priority.html">DB->set_cache_priority</a>, +<a href="../api_c/db_set_cachesize.html">DB->set_cachesize</a>, +<a href="../api_c/db_set_dup_compare.html">DB->set_dup_compare</a>, +<a href="../api_c/db_set_encrypt.html">DB->set_encrypt</a>, +<a href="../api_c/db_set_errcall.html">DB->set_errcall</a>, +<a href="../api_c/db_set_errfile.html">DB->set_errfile</a>, +<a href="../api_c/db_set_errpfx.html">DB->set_errpfx</a>, +<a href="../api_c/db_set_feedback.html">DB->set_feedback</a>, +<a href="../api_c/db_set_flags.html">DB->set_flags</a>, +<a href="../api_c/db_set_h_ffactor.html">DB->set_h_ffactor</a>, +<a href="../api_c/db_set_h_hash.html">DB->set_h_hash</a>, +<a href="../api_c/db_set_h_nelem.html">DB->set_h_nelem</a>, +<a href="../api_c/db_set_lorder.html">DB->set_lorder</a>, +<a href="../api_c/db_set_pagesize.html">DB->set_pagesize</a>, +<a href="../api_c/db_set_paniccall.html">DB->set_paniccall</a>, +<a href="../api_c/db_set_q_extentsize.html">DB->set_q_extentsize</a>, +<a href="../api_c/db_set_re_delim.html">DB->set_re_delim</a>, +<a href="../api_c/db_set_re_len.html">DB->set_re_len</a>, +<a href="../api_c/db_set_re_pad.html">DB->set_re_pad</a>, +<a href="../api_c/db_set_re_source.html">DB->set_re_source</a>, +<a href="../api_c/db_stat.html">DB->stat</a>, +<a href="../api_c/db_sync.html">DB->sync</a>, +<a href="../api_c/db_truncate.html">DB->truncate</a>, +<a href="../api_c/db_upgrade.html">DB->upgrade</a> +and +<a href="../api_c/db_verify.html">DB->verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/env_set_app_dispatch.html b/db/docs/api_c/env_set_app_dispatch.html new file mode 100644 index 000000000..abf44c47f --- /dev/null +++ b/db/docs/api_c/env_set_app_dispatch.html @@ -0,0 +1,107 @@ +<!--Id: env_set_app_dispatch.so,v 10.36 2002/06/24 14:49:17 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB_ENV->set_app_dispatch</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB_ENV->set_app_dispatch</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB_ENV->set_app_dispatch(DB_ENV *dbenv, + int (*tx_recover)(DB_ENV *dbenv, + DBT *log_rec, DB_LSN *lsn, db_recops op)); +</pre></h3> +<h1>Description</h1> +<p>Set the application's function to be called during transaction abort +and recovery. This function must return 0 on success and either +<b>errno</b> or a value outside of the Berkeley DB error name space on +failure. It takes four arguments: +<p><dl compact> +<p><dt>dbenv <dd>A Berkeley DB environment. +<p><dt>log_rec<dd>A log record. +<p><dt>lsn<dd>A log sequence number. +<p><dt>op<dd>One of the following values: +<p><dl compact> +<p><dt><a name="DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a><dd>The log is being read backward to determine which transactions have been +committed and to abort those operations that were not; undo the operation +described by the log record. +<p><dt><a name="DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a><dd>The log is being played forward; redo the operation described by the log +record. +<p><dt><a name="DB_TXN_ABORT">DB_TXN_ABORT</a><dd>The log is being read backward during a transaction abort; undo the +operation described by the log record. +<p><dt><a name="DB_TXN_APPLY">DB_TXN_APPLY</a><dd>The log is being applied on a replica site; redo the operation +described by the log record. +<p><dt><a name="DB_TXN_PRINT">DB_TXN_PRINT</a><dd>The log is being printed for debugging purposes; print the contents of +this log record in the desired format. +</dl> +</dl> +<p>The DB_TXN_FORWARD_ROLL and DB_TXN_APPLY operations +frequently imply the same actions, redoing changes that appear in the +log record, although if a recovery function is to be used on a +replication client where reads may be taking place concurrently with +the processing of incoming messages, DB_TXN_APPLY operations +should also perform appropriate locking. The macro DB_REDO(op) checks +that the operation is one of DB_TXN_FORWARD_ROLL or +DB_TXN_APPLY, and should be used in the recovery code to refer +to the conditions under which operations should be redone. Similarly, +the macro DB_UNDO(op) checks if the operation is one of +DB_TXN_BACKWARD_ROLL or DB_TXN_ABORT. +<p>The DB_ENV->set_app_dispatch function configures operations performed using the specified +<a href="../api_c/env_create.html">DB_ENV</a> handle, not all operations performed on the underlying +database environment. +<p>The DB_ENV->set_app_dispatch interface may not be called after the <a href="../api_c/env_open.html">DB_ENV->open</a> +interface is called. +If the database environment already exists when +<a href="../api_c/env_open.html">DB_ENV->open</a> is called, the information specified to DB_ENV->set_app_dispatch +must be consistent with the existing environment or corruption can +occur. +<p>The DB_ENV->set_app_dispatch function returns a non-zero error value on failure and 0 on success. +<h1>Errors</h1> +<p>The DB_ENV->set_app_dispatch function may fail and return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after <a href="../api_c/env_open.html">DB_ENV->open</a> was called. +</dl> +<p>The DB_ENV->set_app_dispatch function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB_ENV->set_app_dispatch function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/env_set_tx_max.html">DB_ENV->set_tx_max</a>, +<a href="../api_c/env_set_tx_timestamp.html">DB_ENV->set_tx_timestamp</a>, +<a href="../api_c/txn_begin.html">DB_ENV->txn_begin</a>, +<a href="../api_c/txn_checkpoint.html">DB_ENV->txn_checkpoint</a>, +<a href="../api_c/txn_recover.html">DB_ENV->txn_recover</a> +and +<a href="../api_c/txn_stat.html">DB_ENV->txn_stat</a>. +<p> +<a href="../api_c/txn_abort.html">DB_TXN->abort</a>, +<a href="../api_c/txn_commit.html">DB_TXN->commit</a>, +<a href="../api_c/txn_discard.html">DB_TXN->discard</a>, +<a href="../api_c/txn_id.html">DB_TXN->id</a>, +<a href="../api_c/txn_prepare.html">DB_TXN->prepare</a> +and +<a href="../api_c/txn_set_timeout.html">DB_TXN->set_timeout</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/env_set_encrypt.html b/db/docs/api_c/env_set_encrypt.html new file mode 100644 index 000000000..113fdeae3 --- /dev/null +++ b/db/docs/api_c/env_set_encrypt.html @@ -0,0 +1,106 @@ +<!--Id: env_set_encrypt.so,v 10.3 2002/06/24 14:49:18 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB_ENV->set_encrypt</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB_ENV->set_encrypt</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB_ENV->set_encrypt(DB_ENV *dbenv, const char *passwd, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>Set the password used by the <a href="../api_c/env_create.html">DB_ENV</a> and <a href="../api_c/db_create.html">DB</a> methods to +perform encryption and decryption. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_ENCRYPT_AES">DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard +and Federal Information Processing Standard (FIPS) 197) algorithm for +encryption or decryption. +</dl> +<p>The DB_ENV->set_encrypt function configures a database environment, not only operations +performed using the specified <a href="../api_c/env_create.html">DB_ENV</a> handle. +<p>The DB_ENV->set_encrypt interface may not be called after the <a href="../api_c/env_open.html">DB_ENV->open</a> +interface is called. +If the database environment already exists when +<a href="../api_c/env_open.html">DB_ENV->open</a> is called, the information specified to DB_ENV->set_encrypt +must be consistent with the existing environment or an error will be +returned. +<p>The DB_ENV->set_encrypt function returns a non-zero error value on failure and 0 on success. +<h1>Errors</h1> +<p>The DB_ENV->set_encrypt function may fail and return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after +<a href="../api_c/env_open.html">DB_ENV->open</a> +was called. +</dl> +<p>The DB_ENV->set_encrypt function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB_ENV->set_encrypt function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/env_create.html">db_env_create</a>, +<a href="../api_c/env_close.html">DB_ENV->close</a>, +<a href="../api_c/env_dbremove.html">DB_ENV->dbremove</a>, +<a href="../api_c/env_dbrename.html">DB_ENV->dbrename</a>, +<a href="../api_c/env_err.html">DB_ENV->err</a>, +<a href="../api_c/env_err.html">DB_ENV->errx</a>, +<a href="../api_c/env_open.html">DB_ENV->open</a>, +<a href="../api_c/env_remove.html">DB_ENV->remove</a>, +<a href="../api_c/env_set_alloc.html">DB_ENV->set_alloc</a>, +<a href="../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a>, +<a href="../api_c/env_set_cachesize.html">DB_ENV->set_cachesize</a>, +<a href="../api_c/env_set_data_dir.html">DB_ENV->set_data_dir</a>, +<a href="../api_c/env_set_encrypt.html">DB_ENV->set_encrypt</a>, +<a href="../api_c/env_set_errcall.html">DB_ENV->set_errcall</a>, +<a href="../api_c/env_set_errfile.html">DB_ENV->set_errfile</a>, +<a href="../api_c/env_set_errpfx.html">DB_ENV->set_errpfx</a>, +<a href="../api_c/env_set_feedback.html">DB_ENV->set_feedback</a>, +<a href="../api_c/env_set_flags.html">DB_ENV->set_flags</a>, +<a href="../api_c/env_set_lg_bsize.html">DB_ENV->set_lg_bsize</a>, +<a href="../api_c/env_set_lg_dir.html">DB_ENV->set_lg_dir</a>, +<a href="../api_c/env_set_lg_max.html">DB_ENV->set_lg_max</a>, +<a href="../api_c/env_set_lg_regionmax.html">DB_ENV->set_lg_regionmax</a>, +<a href="../api_c/env_set_lk_conflicts.html">DB_ENV->set_lk_conflicts</a>, +<a href="../api_c/env_set_lk_detect.html">DB_ENV->set_lk_detect</a>, +<a href="../api_c/env_set_lk_max_lockers.html">DB_ENV->set_lk_max_lockers</a>, +<a href="../api_c/env_set_lk_max_locks.html">DB_ENV->set_lk_max_locks</a>, +<a href="../api_c/env_set_lk_max_objects.html">DB_ENV->set_lk_max_objects</a>, +<a href="../api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a>, +<a href="../api_c/env_set_paniccall.html">DB_ENV->set_paniccall</a>, +<a href="../api_c/env_set_rpc_server.html">DB_ENV->set_rpc_server</a>, +<a href="../api_c/env_set_shm_key.html">DB_ENV->set_shm_key</a>, +<a href="../api_c/env_set_tas_spins.html">DB_ENV->set_tas_spins</a>, +<a href="../api_c/env_set_timeout.html">DB_ENV->set_timeout</a>, +<a href="../api_c/env_set_tmp_dir.html">DB_ENV->set_tmp_dir</a>, +<a href="../api_c/env_set_tx_max.html">DB_ENV->set_tx_max</a>, +<a href="../api_c/env_set_tx_timestamp.html">DB_ENV->set_tx_timestamp</a>, +<a href="../api_c/env_set_verbose.html">DB_ENV->set_verbose</a>, +<a href="../api_c/env_strerror.html">db_strerror</a> +and +<a href="../api_c/env_version.html">db_version</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/rep_limit.html b/db/docs/api_c/rep_limit.html new file mode 100644 index 000000000..28ff1c1ee --- /dev/null +++ b/db/docs/api_c/rep_limit.html @@ -0,0 +1,57 @@ +<!--Id: rep_limit.so,v 1.2 2002/07/13 18:48:52 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB_ENV->set_rep_limit</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB_ENV->set_rep_limit</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB_ENV->set_rep_limit(DB_ENV *env, u_int32_t gbytes, u_int32_t bytes); +</pre></h3> +<h1>Description</h1> +<p>The DB_ENV->set_rep_limit function imposes a limit on the amount of data that will +be transmitted from a site during the course of a single call to +<a href="../api_c/rep_message.html">DB_ENV->rep_process_message</a> function. +<p>The <b>gbytes</b> and <b>bytes</b> parameters together represent the +maximum number of bytes that can be sent during a single call to +<a href="../api_c/rep_message.html">DB_ENV->rep_process_message</a> function. +<p>The DB_ENV->set_rep_limit function configures a database environment, not only operations +performed using the specified <a href="../api_c/env_create.html">DB_ENV</a> handle. +<p>The DB_ENV->set_rep_limit interface may be called at any time during the life of +the application. +<p>The DB_ENV->set_rep_limit function returns a non-zero error value on failure and 0 on success. +<h1>Errors</h1> +<p>The DB_ENV->set_rep_limit function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB_ENV->set_rep_limit function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/rep_start.html">DB_ENV->rep_start</a>, +<a href="../api_c/rep_elect.html">DB_ENV->rep_elect</a>, +<a href="../api_c/rep_message.html">DB_ENV->rep_process_message</a> +and +<a href="../api_c/rep_transport.html">DB_ENV->set_rep_transport</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_c/rep_stat.html b/db/docs/api_c/rep_stat.html new file mode 100644 index 000000000..cd2a83629 --- /dev/null +++ b/db/docs/api_c/rep_stat.html @@ -0,0 +1,108 @@ +<!--Id: rep_stat.so,v 10.7 2002/07/13 18:09:07 margo Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DB_ENV->rep_stat</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DB_ENV->rep_stat</h1> +</td> +<td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db.h> +<p> +int +DB_ENV->rep_stat(DB_ENV *env, DB_REP_STAT **statp, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The DB_ENV->rep_stat function returns the replication subsystem statistics. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a><dd>Reset statistics after returning their values. +</dl> +<p>The DB_ENV->rep_stat function creates a statistical structure of type +DB_REP_STAT and copies a pointer to it into a user-specified memory +location. +<p>Statistical structures are created in allocated memory. If application-specific allocation +routines have been declared (see <a href="../api_c/env_set_alloc.html">DB_ENV->set_alloc</a> for more +information), they are used to allocate the memory; otherwise, the +library <b>malloc</b>(3) interface is used. The caller is +responsible for deallocating the memory. To deallocate the memory, free +the memory reference; references inside the returned memory need not be +individually freed. +<p>The following DB_REP_STAT fields will be filled in: +<p><dl compact> +<dt>u_int32_t st_stat;<dd>The current replication mode. Set to <a href="../api_c/rep_start.html#DB_REP_MASTER">DB_REP_MASTER</a> if the +environment is a replication master, <a href="../api_c/rep_start.html#DB_REP_CLIENT">DB_REP_CLIENT</a> if the +environment is a replication client, <a href="../api_c/rep_start.html#DB_REP_LOGSONLY">DB_REP_LOGSONLY</a> if the +environment is a log-files-only replica, or 0 if replication is not +configured. +<dt>DB_LSN st_next_lsn;<dd>In replication environments configured as masters, the next LSN expected. +In replication environments configured as clients, the next LSN to be used. +<dt>DB_LSN st_waiting_lsn;<dd>The LSN of the first missed log record being waited for, or 0 if no log +records are currently missing. +<dt>u_int32_t st_dupmasters;<dd>The number of duplicate master conditions detected. +<dt>u_int32_t st_env_id;<dd>The current environment ID. +<dt>u_int32_t st_env_priority;<dd>The current environment priority. +<dt>u_int32_t st_gen;<dd>The current generation number. +<dt>u_int32_t st_log_duplicated;<dd>The number of duplicate log records received. +<dt>u_int32_t st_log_queued;<dd>The number of log records currently queued. +<dt>u_int32_t st_log_queued_max;<dd>The maximum number of log records ever queued at once. +<dt>u_int32_t st_log_queued_total;<dd>The total number of log records queued. +<dt>u_int32_t st_log_records;<dd>The number of log records received and appended to the log. +<dt>u_int32_t st_log_requested;<dd>The number of log records missed and requested. +<dt>u_int32_t st_master;<dd>The current master environment ID. +<dt>u_int32_t st_master_changes;<dd>The number of times the master has changed. +<dt>u_int32_t st_msgs_badgen;<dd>The number of messages received with a bad generation number. +<dt>u_int32_t st_msgs_processed;<dd>The number of messages received and processed. +<dt>u_int32_t st_msgs_recover;<dd>The number of messages ignored due to pending recovery. +<dt>u_int32_t st_msgs_send_failures;<dd>The number of failed message sends. +<dt>u_int32_t st_msgs_sent;<dd>The number of messages sent. +<dt>u_int32_t st_newsites;<dd>The number of new site messages received. +<dt>u_int32_t st_outdated;<dd>The number of outdated conditions detected. +<dt>u_int32_t st_txns_applied;<dd>The number of transactions applied. +<dt>u_int32_t st_elections;<dd>The number of elections held. +<dt>u_int32_t st_elections_won;<dd>The number of elections won. +<dt>u_int32_t st_election_status;<dd>The current election phase (0 if no election is in progress). +<dt>u_int32_t st_election_cur_winner;<dd>The election winner. +<dt>u_int32_t st_election_gen;<dd>The election generation number. +<dt>DB_LSN st_election_lsn;<dd>The maximum LSN of election winner. +<dt>u_int32_t st_election_nsites;<dd>The number sites expected to participate in elections. +<dt>u_int32_t st_nthrottles;<dd>Transmission limited. This indicates the number of times that data +transmission was stopped to limit the amount of data sent in response +to a single call to <a href="../api_c/rep_message.html">DB_ENV->rep_process_message</a>. +<dt>u_int32_t st_election_priority;<dd>The election priority. +<dt>u_int32_t st_election_tiebreaker;<dd>The election tiebreaker value. +<dt>u_int32_t st_election_votes;<dd>The votes received this election round. +</dl> +<p>The DB_ENV->rep_stat function returns a non-zero error value on failure and 0 on success. +<h1>Errors</h1> +<p>The DB_ENV->rep_stat function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. +If a catastrophic error has occurred, the DB_ENV->rep_stat function may fail and +return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_c/rep_start.html">DB_ENV->rep_start</a>, +<a href="../api_c/rep_elect.html">DB_ENV->rep_elect</a>, +<a href="../api_c/rep_message.html">DB_ENV->rep_process_message</a> +and +<a href="../api_c/rep_transport.html">DB_ENV->set_rep_transport</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/db_set_cache_priority.html b/db/docs/api_cxx/db_set_cache_priority.html new file mode 100644 index 000000000..971a9a2e2 --- /dev/null +++ b/db/docs/api_cxx/db_set_cache_priority.html @@ -0,0 +1,113 @@ +<!--Id: db_set_cache_priority.so,v 10.3 2002/06/24 14:49:09 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Db::set_cache_priority</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>Db::set_cache_priority</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +Db::set_cache_priority(DB_CACHE_PRIORITY priority); +</pre></h3> +<h1>Description</h1> +<p>Set the cache priority for pages from the specified database. The +priority of a page biases the replacement algorithm to be more or less +likely to discard a page when space is needed in the buffer pool. The +bias is temporary, and pages will eventually be discarded if they are +not referenced again. The Db::set_cache_priority interface is +only advisory, and does not guarantee pages will be treated in a specific +way. +<p>The <b>priority</b> argument must be set to one of the following values: +<p><dl compact> +<p><dt><a name="DB_PRIORITY_VERY_LOW">DB_PRIORITY_VERY_LOW</a><dd>The lowest priority: pages are the most likely to be discarded. +<dt><a name="DB_PRIORITY_LOW">DB_PRIORITY_LOW</a><dd>The next lowest priority. +<dt><a name="DB_PRIORITY_DEFAULT">DB_PRIORITY_DEFAULT</a><dd>The default priority. +<dt><a name="DB_PRIORITY_HIGH">DB_PRIORITY_HIGH</a><dd>The next highest priority. +<dt><a name="DB_PRIORITY_VERY_HIGH">DB_PRIORITY_VERY_HIGH</a><dd>The highest priority: pages are the least likely to be discarded. +</dl> +<p>The Db::set_cache_priority method configures a database, not only operations performed +using the specified <a href="../api_cxx/db_class.html">Db</a> handle. +<p>The Db::set_cache_priority interface may be called at any time during the life of +the application. +<p>The Db::set_cache_priority method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Errors</h1> +<p>The Db::set_cache_priority method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the Db::set_cache_priority method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_cxx/db_set_alloc.html">Db::set_alloc</a>, +<a href="../api_cxx/db_associate.html">Db::associate</a>, +<a href="../api_cxx/db_close.html">Db::close</a>, +<a href="../api_cxx/db_cursor.html">Db::cursor</a>, +<a href="../api_cxx/db_del.html">Db::del</a>, +<a href="../api_cxx/db_err.html">Db::err</a>, +<a href="../api_cxx/db_err.html">Db::errx</a>, +<a href="../api_cxx/db_fd.html">Db::fd</a>, +<a href="../api_cxx/db_get.html">Db::get</a>, +<a href="../api_cxx/db_get_byteswapped.html">Db::get_byteswapped</a>, +<a href="../api_cxx/db_get_type.html">Db::get_type</a>, +<a href="../api_cxx/db_join.html">Db::join</a>, +<a href="../api_cxx/db_key_range.html">Db::key_range</a>, +<a href="../api_cxx/db_open.html">Db::open</a>, +<a href="../api_cxx/db_get.html">Db::pget</a>, +<a href="../api_cxx/db_put.html">Db::put</a>, +<a href="../api_cxx/db_remove.html">Db::remove</a>, +<a href="../api_cxx/db_rename.html">Db::rename</a>, +<a href="../api_cxx/db_set_append_recno.html">Db::set_append_recno</a>, +<a href="../api_cxx/db_set_bt_compare.html">Db::set_bt_compare</a>, +<a href="../api_cxx/db_set_bt_minkey.html">Db::set_bt_minkey</a>, +<a href="../api_cxx/db_set_bt_prefix.html">Db::set_bt_prefix</a>, +<a href="../api_cxx/db_set_cache_priority.html">Db::set_cache_priority</a>, +<a href="../api_cxx/db_set_cachesize.html">Db::set_cachesize</a>, +<a href="../api_cxx/db_set_dup_compare.html">Db::set_dup_compare</a>, +<a href="../api_cxx/db_set_encrypt.html">Db::set_encrypt</a>, +<a href="../api_cxx/db_set_errcall.html">Db::set_errcall</a>, +<a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a>, +<a href="../api_cxx/db_set_errpfx.html">Db::set_errpfx</a>, +<a href="../api_cxx/db_set_feedback.html">Db::set_feedback</a>, +<a href="../api_cxx/db_set_flags.html">Db::set_flags</a>, +<a href="../api_cxx/db_set_h_ffactor.html">Db::set_h_ffactor</a>, +<a href="../api_cxx/db_set_h_hash.html">Db::set_h_hash</a>, +<a href="../api_cxx/db_set_h_nelem.html">Db::set_h_nelem</a>, +<a href="../api_cxx/db_set_lorder.html">Db::set_lorder</a>, +<a href="../api_cxx/db_set_pagesize.html">Db::set_pagesize</a>, +<a href="../api_cxx/db_set_paniccall.html">Db::set_paniccall</a>, +<a href="../api_cxx/db_set_q_extentsize.html">Db::set_q_extentsize</a>, +<a href="../api_cxx/db_set_re_delim.html">Db::set_re_delim</a>, +<a href="../api_cxx/db_set_re_len.html">Db::set_re_len</a>, +<a href="../api_cxx/db_set_re_pad.html">Db::set_re_pad</a>, +<a href="../api_cxx/db_set_re_source.html">Db::set_re_source</a>, +<a href="../api_cxx/db_stat.html">Db::stat</a>, +<a href="../api_cxx/db_sync.html">Db::sync</a>, +<a href="../api_cxx/db_truncate.html">Db::truncate</a>, +<a href="../api_cxx/db_upgrade.html">Db::upgrade</a> +and +<a href="../api_cxx/db_verify.html">Db::verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/db_set_encrypt.html b/db/docs/api_cxx/db_set_encrypt.html new file mode 100644 index 000000000..ea1501fbf --- /dev/null +++ b/db/docs/api_cxx/db_set_encrypt.html @@ -0,0 +1,116 @@ +<!--Id: db_set_encrypt.so,v 10.2 2002/06/24 14:49:10 bostic Exp --> +<!--Id: env_set_encrypt.so,v 10.3 2002/06/24 14:49:18 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Db::set_encrypt</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>Db::set_encrypt</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +Db::set_encrypt(const char *passwd, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>Set the password used by the <a href="../api_cxx/dbenv_class.html">DbEnv</a> and <a href="../api_cxx/db_class.html">Db</a> methods to +perform encryption and decryption. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_ENCRYPT_AES">DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard +and Federal Information Processing Standard (FIPS) 197) algorithm for +encryption or decryption. +</dl> +<p>Because databases opened within Berkeley DB environments use the password +specified to the environment, it is an error to attempt to set a +password in a database created within an environment. +<p>The Db::set_encrypt interface may not be called after the <a href="../api_cxx/db_open.html">Db::open</a> +interface is called. +<p>The Db::set_encrypt method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Errors</h1> +<p>The Db::set_encrypt method may fail and throw an exception or return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after +<a href="../api_cxx/db_open.html">Db::open</a> +was called. +</dl> +<p>The Db::set_encrypt method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the Db::set_encrypt method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_cxx/db_set_alloc.html">Db::set_alloc</a>, +<a href="../api_cxx/db_associate.html">Db::associate</a>, +<a href="../api_cxx/db_close.html">Db::close</a>, +<a href="../api_cxx/db_cursor.html">Db::cursor</a>, +<a href="../api_cxx/db_del.html">Db::del</a>, +<a href="../api_cxx/db_err.html">Db::err</a>, +<a href="../api_cxx/db_err.html">Db::errx</a>, +<a href="../api_cxx/db_fd.html">Db::fd</a>, +<a href="../api_cxx/db_get.html">Db::get</a>, +<a href="../api_cxx/db_get_byteswapped.html">Db::get_byteswapped</a>, +<a href="../api_cxx/db_get_type.html">Db::get_type</a>, +<a href="../api_cxx/db_join.html">Db::join</a>, +<a href="../api_cxx/db_key_range.html">Db::key_range</a>, +<a href="../api_cxx/db_open.html">Db::open</a>, +<a href="../api_cxx/db_get.html">Db::pget</a>, +<a href="../api_cxx/db_put.html">Db::put</a>, +<a href="../api_cxx/db_remove.html">Db::remove</a>, +<a href="../api_cxx/db_rename.html">Db::rename</a>, +<a href="../api_cxx/db_set_append_recno.html">Db::set_append_recno</a>, +<a href="../api_cxx/db_set_bt_compare.html">Db::set_bt_compare</a>, +<a href="../api_cxx/db_set_bt_minkey.html">Db::set_bt_minkey</a>, +<a href="../api_cxx/db_set_bt_prefix.html">Db::set_bt_prefix</a>, +<a href="../api_cxx/db_set_cache_priority.html">Db::set_cache_priority</a>, +<a href="../api_cxx/db_set_cachesize.html">Db::set_cachesize</a>, +<a href="../api_cxx/db_set_dup_compare.html">Db::set_dup_compare</a>, +<a href="../api_cxx/db_set_encrypt.html">Db::set_encrypt</a>, +<a href="../api_cxx/db_set_errcall.html">Db::set_errcall</a>, +<a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a>, +<a href="../api_cxx/db_set_errpfx.html">Db::set_errpfx</a>, +<a href="../api_cxx/db_set_feedback.html">Db::set_feedback</a>, +<a href="../api_cxx/db_set_flags.html">Db::set_flags</a>, +<a href="../api_cxx/db_set_h_ffactor.html">Db::set_h_ffactor</a>, +<a href="../api_cxx/db_set_h_hash.html">Db::set_h_hash</a>, +<a href="../api_cxx/db_set_h_nelem.html">Db::set_h_nelem</a>, +<a href="../api_cxx/db_set_lorder.html">Db::set_lorder</a>, +<a href="../api_cxx/db_set_pagesize.html">Db::set_pagesize</a>, +<a href="../api_cxx/db_set_paniccall.html">Db::set_paniccall</a>, +<a href="../api_cxx/db_set_q_extentsize.html">Db::set_q_extentsize</a>, +<a href="../api_cxx/db_set_re_delim.html">Db::set_re_delim</a>, +<a href="../api_cxx/db_set_re_len.html">Db::set_re_len</a>, +<a href="../api_cxx/db_set_re_pad.html">Db::set_re_pad</a>, +<a href="../api_cxx/db_set_re_source.html">Db::set_re_source</a>, +<a href="../api_cxx/db_stat.html">Db::stat</a>, +<a href="../api_cxx/db_sync.html">Db::sync</a>, +<a href="../api_cxx/db_truncate.html">Db::truncate</a>, +<a href="../api_cxx/db_upgrade.html">Db::upgrade</a> +and +<a href="../api_cxx/db_verify.html">Db::verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/deadlock_class.html b/db/docs/api_cxx/deadlock_class.html new file mode 100644 index 000000000..b796e8d3c --- /dev/null +++ b/db/docs/api_cxx/deadlock_class.html @@ -0,0 +1,47 @@ +<!--Id: deadlock_class.so,v 10.10 2002/07/29 00:43:13 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbDeadlockException</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbDeadlockException</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +class DbDeadlockException : public DbException { ... }; +</pre></h3> +<h1>Description</h1> +<p>This manual page describes the DbDeadlockException class and +how it is used by the various Db* classes. +<p>A DbDeadlockException is thrown when multiple threads competing +for a lock are deadlocked. One of the threads' transactions is selected +for termination, and a DbDeadlockException is thrown to that thread. +<p>See <a href="../api_cxx/env_set_lk_detect.html">DbEnv::set_lk_detect</a> for more information. +<h1>Class</h1> +<a href="../api_cxx/except_class.html">DbException</a> +<h1>See Also</h1> +<a href="../api_cxx/get_errno.html">DbException::get_errno</a>, +<a href="../api_cxx/what.html">DbException::what</a> +and +<a href="../api_cxx/mem_class.html">DbMemoryException</a> +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/env_dbremove.html b/db/docs/api_cxx/env_dbremove.html new file mode 100644 index 000000000..d5625bd2b --- /dev/null +++ b/db/docs/api_cxx/env_dbremove.html @@ -0,0 +1,126 @@ +<!--Id: env_dbremove.so,v 10.31 2002/08/02 18:41:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv::dbremove</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv::dbremove</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +DbEnv::dbremove(DbTxn *txnid, + const char *file, const char *database, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The DbEnv::dbremove method removes the database specified by the +<b>file</b> and <b>database</b> arguments. If no <b>database</b> is +specified, the underlying file represented by <b>file</b> is removed, +incidentally removing all databases that it contained. +<p>Applications should never remove databases with open <a href="../api_cxx/db_class.html">Db</a> handles, +or in the case of removing a file, when any database in the file has an +open handle. For example, some architectures do not permit the removal +of files with open system handles. On these architectures, attempts to +remove databases currently in use by any thread of control in the system +will fail. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the DbEnv::dbremove call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The DbEnv::dbremove method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>The +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>DbEnv::dbremove is affected by any database directory specified using the +<a href="../api_cxx/env_set_data_dir.html">DbEnv::set_data_dir</a> method, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<h1>Errors</h1> +<p>The DbEnv::dbremove method may fail and throw an exception or return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>A database in the file is currently open. +<p>Called before <a href="../api_cxx/env_open.html">DbEnv::open</a> was called. +</dl> +<p>If the file or directory does not exist, the DbEnv::dbremove method will +fail and +and either return ENOENT or +throw a FileNotFoundException exception. +<p>The DbEnv::dbremove method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv::dbremove method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/dbenv_class.html">DbEnv</a> +<h1>See Also</h1> +<a href="../api_cxx/env_close.html">DbEnv::close</a>, +<a href="../api_cxx/env_dbremove.html">DbEnv::dbremove</a>, +<a href="../api_cxx/env_dbrename.html">DbEnv::dbrename</a>, +<a href="../api_cxx/env_err.html">DbEnv::err</a>, +<a href="../api_cxx/env_err.html">DbEnv::errx</a>, +<a href="../api_cxx/env_open.html">DbEnv::open</a>, +<a href="../api_cxx/env_remove.html">DbEnv::remove</a>, +<a href="../api_cxx/env_set_alloc.html">DbEnv::set_alloc</a>, +<a href="../api_cxx/env_set_app_dispatch.html">DbEnv::set_app_dispatch</a>, +<a href="../api_cxx/env_set_cachesize.html">DbEnv::set_cachesize</a>, +<a href="../api_cxx/env_set_data_dir.html">DbEnv::set_data_dir</a>, +<a href="../api_cxx/env_set_encrypt.html">DbEnv::set_encrypt</a>, +<a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a>, +<a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a>, +<a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a>, +<a href="../api_cxx/env_set_errpfx.html">DbEnv::set_errpfx</a>, +<a href="../api_cxx/env_set_feedback.html">DbEnv::set_feedback</a>, +<a href="../api_cxx/env_set_flags.html">DbEnv::set_flags</a>, +<a href="../api_cxx/env_set_lg_bsize.html">DbEnv::set_lg_bsize</a>, +<a href="../api_cxx/env_set_lg_dir.html">DbEnv::set_lg_dir</a>, +<a href="../api_cxx/env_set_lg_max.html">DbEnv::set_lg_max</a>, +<a href="../api_cxx/env_set_lg_regionmax.html">DbEnv::set_lg_regionmax</a>, +<a href="../api_cxx/env_set_lk_conflicts.html">DbEnv::set_lk_conflicts</a>, +<a href="../api_cxx/env_set_lk_detect.html">DbEnv::set_lk_detect</a>, +<a href="../api_cxx/env_set_lk_max_lockers.html">DbEnv::set_lk_max_lockers</a>, +<a href="../api_cxx/env_set_lk_max_locks.html">DbEnv::set_lk_max_locks</a>, +<a href="../api_cxx/env_set_lk_max_objects.html">DbEnv::set_lk_max_objects</a>, +<a href="../api_cxx/env_set_mp_mmapsize.html">DbEnv::set_mp_mmapsize</a>, +<a href="../api_cxx/env_set_paniccall.html">DbEnv::set_paniccall</a>, +<a href="../api_cxx/env_set_rpc_server.html">DbEnv::set_rpc_server</a>, +<a href="../api_cxx/env_set_shm_key.html">DbEnv::set_shm_key</a>, +<a href="../api_cxx/env_set_tas_spins.html">DbEnv::set_tas_spins</a>, +<a href="../api_cxx/env_set_timeout.html">DbEnv::set_timeout</a>, +<a href="../api_cxx/env_set_tmp_dir.html">DbEnv::set_tmp_dir</a>, +<a href="../api_cxx/env_set_tx_max.html">DbEnv::set_tx_max</a>, +<a href="../api_cxx/env_set_tx_timestamp.html">DbEnv::set_tx_timestamp</a>, +<a href="../api_cxx/env_set_verbose.html">DbEnv::set_verbose</a>, +<a href="../api_cxx/env_strerror.html">DbEnv::strerror</a> +and +<a href="../api_cxx/env_version.html">DbEnv::version</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/env_dbrename.html b/db/docs/api_cxx/env_dbrename.html new file mode 100644 index 000000000..09edc1bbe --- /dev/null +++ b/db/docs/api_cxx/env_dbrename.html @@ -0,0 +1,136 @@ +<!--Id: env_dbrename.so,v 10.17 2002/08/02 18:41:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv::dbrename</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv::dbrename</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +DbEnv::dbrename(DbTxn *txnid, const char *file, + const char *database, const char *newname, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The DbEnv::dbrename method renames the database specified by the +<b>file</b> and <b>database</b> arguments to <b>newname</b>. If no +<b>database</b> is specified, the underlying file represented by +<b>file</b> is renamed, incidentally renaming all databases that it +contained. +<p>Applications should not rename databases that are currently in use. If +an underlying file is being renamed and logging is currently enabled in +the database environment, no database in the file may be open when the +DbEnv::dbrename method is called. In particular, some architectures do +not permit renaming files with open handles. On these architectures, +attempts to rename databases that are currently in use by any thread of +control in the system will fail. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the DbEnv::dbrename call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The DbEnv::dbrename method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>The +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>DbEnv::dbrename is affected by any database directory specified using the +<a href="../api_cxx/env_set_data_dir.html">DbEnv::set_data_dir</a> method, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<h1>Errors</h1> +<p>The DbEnv::dbrename method may fail and throw an exception or return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>A database in the file is currently open. +<p>Called before <a href="../api_cxx/env_open.html">DbEnv::open</a> was called. +</dl> +<p>If the file or directory does not exist, the DbEnv::dbrename method will +fail and +and either return ENOENT or +throw a FileNotFoundException exception. +<p>The DbEnv::dbrename method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv::dbrename method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_cxx/db_set_alloc.html">Db::set_alloc</a>, +<a href="../api_cxx/db_associate.html">Db::associate</a>, +<a href="../api_cxx/db_close.html">Db::close</a>, +<a href="../api_cxx/db_cursor.html">Db::cursor</a>, +<a href="../api_cxx/db_del.html">Db::del</a>, +<a href="../api_cxx/db_err.html">Db::err</a>, +<a href="../api_cxx/db_err.html">Db::errx</a>, +<a href="../api_cxx/db_fd.html">Db::fd</a>, +<a href="../api_cxx/db_get.html">Db::get</a>, +<a href="../api_cxx/db_get_byteswapped.html">Db::get_byteswapped</a>, +<a href="../api_cxx/db_get_type.html">Db::get_type</a>, +<a href="../api_cxx/db_join.html">Db::join</a>, +<a href="../api_cxx/db_key_range.html">Db::key_range</a>, +<a href="../api_cxx/db_open.html">Db::open</a>, +<a href="../api_cxx/db_get.html">Db::pget</a>, +<a href="../api_cxx/db_put.html">Db::put</a>, +<a href="../api_cxx/db_remove.html">Db::remove</a>, +<a href="../api_cxx/db_rename.html">Db::rename</a>, +<a href="../api_cxx/db_set_append_recno.html">Db::set_append_recno</a>, +<a href="../api_cxx/db_set_bt_compare.html">Db::set_bt_compare</a>, +<a href="../api_cxx/db_set_bt_minkey.html">Db::set_bt_minkey</a>, +<a href="../api_cxx/db_set_bt_prefix.html">Db::set_bt_prefix</a>, +<a href="../api_cxx/db_set_cache_priority.html">Db::set_cache_priority</a>, +<a href="../api_cxx/db_set_cachesize.html">Db::set_cachesize</a>, +<a href="../api_cxx/db_set_dup_compare.html">Db::set_dup_compare</a>, +<a href="../api_cxx/db_set_encrypt.html">Db::set_encrypt</a>, +<a href="../api_cxx/db_set_errcall.html">Db::set_errcall</a>, +<a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a>, +<a href="../api_cxx/db_set_errpfx.html">Db::set_errpfx</a>, +<a href="../api_cxx/db_set_feedback.html">Db::set_feedback</a>, +<a href="../api_cxx/db_set_flags.html">Db::set_flags</a>, +<a href="../api_cxx/db_set_h_ffactor.html">Db::set_h_ffactor</a>, +<a href="../api_cxx/db_set_h_hash.html">Db::set_h_hash</a>, +<a href="../api_cxx/db_set_h_nelem.html">Db::set_h_nelem</a>, +<a href="../api_cxx/db_set_lorder.html">Db::set_lorder</a>, +<a href="../api_cxx/db_set_pagesize.html">Db::set_pagesize</a>, +<a href="../api_cxx/db_set_paniccall.html">Db::set_paniccall</a>, +<a href="../api_cxx/db_set_q_extentsize.html">Db::set_q_extentsize</a>, +<a href="../api_cxx/db_set_re_delim.html">Db::set_re_delim</a>, +<a href="../api_cxx/db_set_re_len.html">Db::set_re_len</a>, +<a href="../api_cxx/db_set_re_pad.html">Db::set_re_pad</a>, +<a href="../api_cxx/db_set_re_source.html">Db::set_re_source</a>, +<a href="../api_cxx/db_stat.html">Db::stat</a>, +<a href="../api_cxx/db_sync.html">Db::sync</a>, +<a href="../api_cxx/db_truncate.html">Db::truncate</a>, +<a href="../api_cxx/db_upgrade.html">Db::upgrade</a> +and +<a href="../api_cxx/db_verify.html">Db::verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/env_set_app_dispatch.html b/db/docs/api_cxx/env_set_app_dispatch.html new file mode 100644 index 000000000..28efde342 --- /dev/null +++ b/db/docs/api_cxx/env_set_app_dispatch.html @@ -0,0 +1,110 @@ +<!--Id: env_set_app_dispatch.so,v 10.36 2002/06/24 14:49:17 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv::set_app_dispatch</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv::set_app_dispatch</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +DbEnv::set_app_dispatch(int (*)(DbEnv *dbenv, + Dbt *log_rec, DbLsn *lsn, db_recops op)); +</pre></h3> +<h1>Description</h1> +<p>Set the application's method to be called during transaction abort +and recovery. This method must return 0 on success and either +<b>errno</b> or a value outside of the Berkeley DB error name space on +failure. It takes four arguments: +<p><dl compact> +<p><dt>dbenv <dd>A Berkeley DB environment. +<p><dt>log_rec<dd>A log record. +<p><dt>lsn<dd>A log sequence number. +<p><dt>op<dd>One of the following values: +<p><dl compact> +<p><dt><a name="DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a><dd>The log is being read backward to determine which transactions have been +committed and to abort those operations that were not; undo the operation +described by the log record. +<p><dt><a name="DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a><dd>The log is being played forward; redo the operation described by the log +record. +<p><dt><a name="DB_TXN_ABORT">DB_TXN_ABORT</a><dd>The log is being read backward during a transaction abort; undo the +operation described by the log record. +<p><dt><a name="DB_TXN_APPLY">DB_TXN_APPLY</a><dd>The log is being applied on a replica site; redo the operation +described by the log record. +<p><dt><a name="DB_TXN_PRINT">DB_TXN_PRINT</a><dd>The log is being printed for debugging purposes; print the contents of +this log record in the desired format. +</dl> +</dl> +<p>The DB_TXN_FORWARD_ROLL and DB_TXN_APPLY operations +frequently imply the same actions, redoing changes that appear in the +log record, although if a recovery function is to be used on a +replication client where reads may be taking place concurrently with +the processing of incoming messages, DB_TXN_APPLY operations +should also perform appropriate locking. The macro DB_REDO(op) checks +that the operation is one of DB_TXN_FORWARD_ROLL or +DB_TXN_APPLY, and should be used in the recovery code to refer +to the conditions under which operations should be redone. Similarly, +the macro DB_UNDO(op) checks if the operation is one of +DB_TXN_BACKWARD_ROLL or DB_TXN_ABORT. +<p>The DbEnv::set_app_dispatch method configures operations performed using the specified +<a href="../api_cxx/dbenv_class.html">DbEnv</a> handle, not all operations performed on the underlying +database environment. +<p>The DbEnv::set_app_dispatch interface may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> +interface is called. +If the database environment already exists when +<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_app_dispatch +must be consistent with the existing environment or corruption can +occur. +<p>The DbEnv::set_app_dispatch method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Errors</h1> +<p>The DbEnv::set_app_dispatch method may fail and throw an exception or return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called. +</dl> +<p>The DbEnv::set_app_dispatch method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv::set_app_dispatch method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/dbenv_class.html">DbEnv</a>, <a href="../api_cxx/txn_class.html">DbTxn</a> +<h1>See Also</h1> +<a href="../api_cxx/env_set_tx_max.html">DbEnv::set_tx_max</a>, +<a href="../api_cxx/env_set_tx_timestamp.html">DbEnv::set_tx_timestamp</a>, +<a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>, +<a href="../api_cxx/txn_checkpoint.html">DbEnv::txn_checkpoint</a>, +<a href="../api_cxx/txn_recover.html">DbEnv::txn_recover</a> +and +<a href="../api_cxx/txn_stat.html">DbEnv::txn_stat</a>. +<p> +<a href="../api_cxx/txn_abort.html">DbTxn::abort</a>, +<a href="../api_cxx/txn_commit.html">DbTxn::commit</a>, +<a href="../api_cxx/txn_discard.html">DbTxn::discard</a>, +<a href="../api_cxx/txn_id.html">DbTxn::id</a>, +<a href="../api_cxx/txn_prepare.html">DbTxn::prepare</a> +and +<a href="../api_cxx/txn_set_timeout.html">DbTxn::set_timeout</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/env_set_encrypt.html b/db/docs/api_cxx/env_set_encrypt.html new file mode 100644 index 000000000..b0dbaf605 --- /dev/null +++ b/db/docs/api_cxx/env_set_encrypt.html @@ -0,0 +1,110 @@ +<!--Id: env_set_encrypt.so,v 10.3 2002/06/24 14:49:18 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv::set_encrypt</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv::set_encrypt</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +DbEnv::set_encrypt(const char *passwd, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>Set the password used by the <a href="../api_cxx/dbenv_class.html">DbEnv</a> and <a href="../api_cxx/db_class.html">Db</a> methods to +perform encryption and decryption. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_ENCRYPT_AES">DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard +and Federal Information Processing Standard (FIPS) 197) algorithm for +encryption or decryption. +</dl> +<p>The DbEnv::set_encrypt method configures a database environment, not only operations +performed using the specified <a href="../api_cxx/dbenv_class.html">DbEnv</a> handle. +<p>The DbEnv::set_encrypt interface may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> +interface is called. +If the database environment already exists when +<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_encrypt +must be consistent with the existing environment or an error will be +returned. +<p>The DbEnv::set_encrypt method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Errors</h1> +<p>The DbEnv::set_encrypt method may fail and throw an exception or return a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after +<a href="../api_cxx/env_open.html">DbEnv::open</a> +was called. +</dl> +<p>The DbEnv::set_encrypt method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv::set_encrypt method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/dbenv_class.html">DbEnv</a> +<h1>See Also</h1> +<a href="../api_cxx/env_close.html">DbEnv::close</a>, +<a href="../api_cxx/env_dbremove.html">DbEnv::dbremove</a>, +<a href="../api_cxx/env_dbrename.html">DbEnv::dbrename</a>, +<a href="../api_cxx/env_err.html">DbEnv::err</a>, +<a href="../api_cxx/env_err.html">DbEnv::errx</a>, +<a href="../api_cxx/env_open.html">DbEnv::open</a>, +<a href="../api_cxx/env_remove.html">DbEnv::remove</a>, +<a href="../api_cxx/env_set_alloc.html">DbEnv::set_alloc</a>, +<a href="../api_cxx/env_set_app_dispatch.html">DbEnv::set_app_dispatch</a>, +<a href="../api_cxx/env_set_cachesize.html">DbEnv::set_cachesize</a>, +<a href="../api_cxx/env_set_data_dir.html">DbEnv::set_data_dir</a>, +<a href="../api_cxx/env_set_encrypt.html">DbEnv::set_encrypt</a>, +<a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a>, +<a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a>, +<a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a>, +<a href="../api_cxx/env_set_errpfx.html">DbEnv::set_errpfx</a>, +<a href="../api_cxx/env_set_feedback.html">DbEnv::set_feedback</a>, +<a href="../api_cxx/env_set_flags.html">DbEnv::set_flags</a>, +<a href="../api_cxx/env_set_lg_bsize.html">DbEnv::set_lg_bsize</a>, +<a href="../api_cxx/env_set_lg_dir.html">DbEnv::set_lg_dir</a>, +<a href="../api_cxx/env_set_lg_max.html">DbEnv::set_lg_max</a>, +<a href="../api_cxx/env_set_lg_regionmax.html">DbEnv::set_lg_regionmax</a>, +<a href="../api_cxx/env_set_lk_conflicts.html">DbEnv::set_lk_conflicts</a>, +<a href="../api_cxx/env_set_lk_detect.html">DbEnv::set_lk_detect</a>, +<a href="../api_cxx/env_set_lk_max_lockers.html">DbEnv::set_lk_max_lockers</a>, +<a href="../api_cxx/env_set_lk_max_locks.html">DbEnv::set_lk_max_locks</a>, +<a href="../api_cxx/env_set_lk_max_objects.html">DbEnv::set_lk_max_objects</a>, +<a href="../api_cxx/env_set_mp_mmapsize.html">DbEnv::set_mp_mmapsize</a>, +<a href="../api_cxx/env_set_paniccall.html">DbEnv::set_paniccall</a>, +<a href="../api_cxx/env_set_rpc_server.html">DbEnv::set_rpc_server</a>, +<a href="../api_cxx/env_set_shm_key.html">DbEnv::set_shm_key</a>, +<a href="../api_cxx/env_set_tas_spins.html">DbEnv::set_tas_spins</a>, +<a href="../api_cxx/env_set_timeout.html">DbEnv::set_timeout</a>, +<a href="../api_cxx/env_set_tmp_dir.html">DbEnv::set_tmp_dir</a>, +<a href="../api_cxx/env_set_tx_max.html">DbEnv::set_tx_max</a>, +<a href="../api_cxx/env_set_tx_timestamp.html">DbEnv::set_tx_timestamp</a>, +<a href="../api_cxx/env_set_verbose.html">DbEnv::set_verbose</a>, +<a href="../api_cxx/env_strerror.html">DbEnv::strerror</a> +and +<a href="../api_cxx/env_version.html">DbEnv::version</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/lockng_class.html b/db/docs/api_cxx/lockng_class.html new file mode 100644 index 000000000..a9230f3d0 --- /dev/null +++ b/db/docs/api_cxx/lockng_class.html @@ -0,0 +1,73 @@ +<!--Id: lockng_class.so,v 1.5 2002/07/29 04:27:14 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbLockNotGrantedException</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbLockNotGrantedException</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +class DbLockNotGrantedException : public DbException { +public: + db_lockop_t get_op() const; + db_lockmode_t get_mode() const; + const Dbt* get_obj() const; + DbLock *get_lock() const; + int get_index() const; +}; +</pre></h3> +<h1>Description</h1> +<p>This manual page describes the DbLockNotGrantedException class and +how it is used by the various Db* classes. +<p>A DbLockNotGrantedException is thrown when a lock, requested +using the <a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> or <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> methods (where the +<a href="../api_cxx/lock_vec.html#DB_LOCK_NOWAIT">DB_LOCK_NOWAIT</a> option was specified), or by any Db +operation performed in the context of a transaction begun using the +<a href="../api_cxx/txn_begin.html#DB_TXN_NOWAIT">DB_TXN_NOWAIT</a> option, is unable to be granted immediately. +<p>The <b>get_op</b> method returns 0 when <a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> was called, +and returns the <b>op</b> for the failed DB_LOCKREQ when +<a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> was called. +<p>The <b>get_mode</b> method returns the <b>mode</b> argument when +<a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> was called, and returns the <b>mode</b> for the failed +DB_LOCKREQ when <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> was called. +<p>The <b>get_obj</b> method returns the <b>obj</b> argument when +<a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> was called, and returns the <b>obj</b> for the failed +DB_LOCKREQ when <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> was called. +The <a href="../api_cxx/dbt_class.html">Dbt</a> pointer may or may not refer to valid memory, depending on +whether the <a href="../api_cxx/dbt_class.html">Dbt</a> used in the call to the failed <a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> or +<a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> method is still in scope and has not been deleted. +<p>The <b>get_lock</b> method returns NULL when <a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> was +called, and returns the <b>lock</b> in the failed DB_LOCKREQ +when <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> was called. +<p>The <b>get_index</b> method returns -1 when <a href="../api_cxx/lock_get.html">DbEnv::lock_get</a> was +called, and returns the index of the failed DB_LOCKREQ +when <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> was called. +<h1>Class</h1> +<a href="../api_cxx/except_class.html">DbException</a> +<h1>See Also</h1> +<a href="../api_cxx/get_errno.html">DbException::get_errno</a>, +<a href="../api_cxx/what.html">DbException::what</a> +and +<a href="../api_cxx/mem_class.html">DbMemoryException</a> +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/rep_limit.html b/db/docs/api_cxx/rep_limit.html new file mode 100644 index 000000000..166840b7e --- /dev/null +++ b/db/docs/api_cxx/rep_limit.html @@ -0,0 +1,59 @@ +<!--Id: rep_limit.so,v 1.2 2002/07/13 18:48:52 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv::set_rep_limit</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv::set_rep_limit</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +DbEnv::set_rep_limit(u_int32_t gbytes, u_int32_t bytes); +</pre></h3> +<h1>Description</h1> +<p>The DbEnv::set_rep_limit method imposes a limit on the amount of data that will +be transmitted from a site during the course of a single call to +<a href="../api_cxx/rep_message.html">DbEnv::rep_process_message</a> method. +<p>The <b>gbytes</b> and <b>bytes</b> parameters together represent the +maximum number of bytes that can be sent during a single call to +<a href="../api_cxx/rep_message.html">DbEnv::rep_process_message</a> method. +<p>The DbEnv::set_rep_limit method configures a database environment, not only operations +performed using the specified <a href="../api_cxx/dbenv_class.html">DbEnv</a> handle. +<p>The DbEnv::set_rep_limit interface may be called at any time during the life of +the application. +<p>The DbEnv::set_rep_limit method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Errors</h1> +<p>The DbEnv::set_rep_limit method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv::set_rep_limit method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_cxx/rep_start.html">DbEnv::rep_start</a>, +<a href="../api_cxx/rep_elect.html">DbEnv::rep_elect</a>, +<a href="../api_cxx/rep_message.html">DbEnv::rep_process_message</a> +and +<a href="../api_cxx/rep_transport.html">DbEnv::set_rep_transport</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/rep_stat.html b/db/docs/api_cxx/rep_stat.html new file mode 100644 index 000000000..a686719cd --- /dev/null +++ b/db/docs/api_cxx/rep_stat.html @@ -0,0 +1,110 @@ +<!--Id: rep_stat.so,v 10.7 2002/07/13 18:09:07 margo Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv::rep_stat</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv::rep_stat</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +int +DbEnv::rep_stat(DB_REP_STAT **statp, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The DbEnv::rep_stat method returns the replication subsystem statistics. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a><dd>Reset statistics after returning their values. +</dl> +<p>The DbEnv::rep_stat method creates a statistical structure of type +DB_REP_STAT and copies a pointer to it into a user-specified memory +location. +<p>Statistical structures are created in allocated memory. If application-specific allocation +routines have been declared (see <a href="../api_cxx/env_set_alloc.html">DbEnv::set_alloc</a> for more +information), they are used to allocate the memory; otherwise, the +library <b>malloc</b>(3) interface is used. The caller is +responsible for deallocating the memory. To deallocate the memory, free +the memory reference; references inside the returned memory need not be +individually freed. +<p>The following DB_REP_STAT fields will be filled in: +<p><dl compact> +<dt>u_int32_t st_stat;<dd>The current replication mode. Set to <a href="../api_cxx/rep_start.html#DB_REP_MASTER">DB_REP_MASTER</a> if the +environment is a replication master, <a href="../api_cxx/rep_start.html#DB_REP_CLIENT">DB_REP_CLIENT</a> if the +environment is a replication client, <a href="../api_cxx/rep_start.html#DB_REP_LOGSONLY">DB_REP_LOGSONLY</a> if the +environment is a log-files-only replica, or 0 if replication is not +configured. +<dt>DB_LSN st_next_lsn;<dd>In replication environments configured as masters, the next LSN expected. +In replication environments configured as clients, the next LSN to be used. +<dt>DB_LSN st_waiting_lsn;<dd>The LSN of the first missed log record being waited for, or 0 if no log +records are currently missing. +<dt>u_int32_t st_dupmasters;<dd>The number of duplicate master conditions detected. +<dt>u_int32_t st_env_id;<dd>The current environment ID. +<dt>u_int32_t st_env_priority;<dd>The current environment priority. +<dt>u_int32_t st_gen;<dd>The current generation number. +<dt>u_int32_t st_log_duplicated;<dd>The number of duplicate log records received. +<dt>u_int32_t st_log_queued;<dd>The number of log records currently queued. +<dt>u_int32_t st_log_queued_max;<dd>The maximum number of log records ever queued at once. +<dt>u_int32_t st_log_queued_total;<dd>The total number of log records queued. +<dt>u_int32_t st_log_records;<dd>The number of log records received and appended to the log. +<dt>u_int32_t st_log_requested;<dd>The number of log records missed and requested. +<dt>u_int32_t st_master;<dd>The current master environment ID. +<dt>u_int32_t st_master_changes;<dd>The number of times the master has changed. +<dt>u_int32_t st_msgs_badgen;<dd>The number of messages received with a bad generation number. +<dt>u_int32_t st_msgs_processed;<dd>The number of messages received and processed. +<dt>u_int32_t st_msgs_recover;<dd>The number of messages ignored due to pending recovery. +<dt>u_int32_t st_msgs_send_failures;<dd>The number of failed message sends. +<dt>u_int32_t st_msgs_sent;<dd>The number of messages sent. +<dt>u_int32_t st_newsites;<dd>The number of new site messages received. +<dt>u_int32_t st_outdated;<dd>The number of outdated conditions detected. +<dt>u_int32_t st_txns_applied;<dd>The number of transactions applied. +<dt>u_int32_t st_elections;<dd>The number of elections held. +<dt>u_int32_t st_elections_won;<dd>The number of elections won. +<dt>u_int32_t st_election_status;<dd>The current election phase (0 if no election is in progress). +<dt>u_int32_t st_election_cur_winner;<dd>The election winner. +<dt>u_int32_t st_election_gen;<dd>The election generation number. +<dt>DB_LSN st_election_lsn;<dd>The maximum LSN of election winner. +<dt>u_int32_t st_election_nsites;<dd>The number sites expected to participate in elections. +<dt>u_int32_t st_nthrottles;<dd>Transmission limited. This indicates the number of times that data +transmission was stopped to limit the amount of data sent in response +to a single call to <a href="../api_cxx/rep_message.html">DbEnv::rep_process_message</a>. +<dt>u_int32_t st_election_priority;<dd>The election priority. +<dt>u_int32_t st_election_tiebreaker;<dd>The election tiebreaker value. +<dt>u_int32_t st_election_votes;<dd>The votes received this election round. +</dl> +<p>The DbEnv::rep_stat method either returns a non-zero error value or throws an exception that +encapsulates a non-zero error value on failure, and returns 0 on success. +<h1>Errors</h1> +<p>The DbEnv::rep_stat method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv::rep_stat method may fail and +either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a +<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_cxx/rep_start.html">DbEnv::rep_start</a>, +<a href="../api_cxx/rep_elect.html">DbEnv::rep_elect</a>, +<a href="../api_cxx/rep_message.html">DbEnv::rep_process_message</a> +and +<a href="../api_cxx/rep_transport.html">DbEnv::set_rep_transport</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/runrec_class.html b/db/docs/api_cxx/runrec_class.html new file mode 100644 index 000000000..2851cbaa0 --- /dev/null +++ b/db/docs/api_cxx/runrec_class.html @@ -0,0 +1,49 @@ +<!--Id: runrec_class.so,v 10.12 2002/07/29 00:43:14 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbRunRecoveryException</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbRunRecoveryException</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <db_cxx.h> +<p> +class DbRunRecoveryException : public DbException { ... }; +</pre></h3> +<h1>Description</h1> +<p>This manual page describes the DbRunRecoveryException class and +how it is used by the various Db* classes. +<p>Errors can occur in the Berkeley DB library where the only solution is to shut +down the application and run recovery (for example, if Berkeley DB is unable +to allocate heap memory). When a fatal error occurs in Berkeley DB, methods +will throw a DbRunRecoveryException, at which point all +subsequent database calls will also fail in the same way. When this +occurs, recovery should be performed. +<h1>Class</h1> +<a href="../api_cxx/except_class.html">DbException</a> +<h1>See Also</h1> +<a href="../api_cxx/get_errno.html">DbException::get_errno</a>, +<a href="../api_cxx/what.html">DbException::what</a> +and +<a href="../api_cxx/mem_class.html">DbMemoryException</a> +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_close.html b/db/docs/api_cxx/xml_close.html new file mode 100644 index 000000000..9ca24cb9c --- /dev/null +++ b/db/docs/api_cxx/xml_close.html @@ -0,0 +1,86 @@ +<!--Id: xml_close.so,v 10.5 2002/07/30 16:57:43 merrells Exp --> +<!--Id: m4.db_close,v 10.1 2002/06/19 19:31:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::close</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::close</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlContainer::close(u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::close method closes the specified container. +
+<p>The <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> must be in the open state for the
+call to succeed. The container is only open after a successful
+call to the <a href="../api_cxx/xml_open.html">XmlContainer::open</a> method. Note that it is allowable
+to re-open a container after it has been closed. +
+<p><dl compact> +
+<p><dt><a name="DB_NOSYNC">DB_NOSYNC</a><dd>Do not flush cached information to disk. The <a href="../api_cxx/db_close.html#DB_NOSYNC">DB_NOSYNC</a> flag is +a dangerous option. It should be set only if the application is doing +logging (with transactions) so that the database is recoverable after +a system or application crash, or if the database is always generated +from scratch after any system or application crash. +<p><b>It is important to understand that flushing cached information to disk +only minimizes the window of opportunity for corrupted data.</b> Although +unlikely, it is possible for database corruption to happen if a system +or application crash occurs while writing data to the database. To +ensure that database corruption never occurs, applications must either: +use transactions and logging with automatic recovery; use logging and +application-specific recovery; or edit a copy of the database, and once +all applications using the database have successfully called +UNREF==xm_close, atomically replace the original database with the +updated copy. +
+</dl>
+<p>When multiple threads are using the <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> concurrently,
+only a single thread may call the XmlContainer::close method. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_declare.html b/db/docs/api_cxx/xml_declare.html new file mode 100644 index 000000000..965f4a9a9 --- /dev/null +++ b/db/docs/api_cxx/xml_declare.html @@ -0,0 +1,121 @@ +<!--Id: xml_declare.so,v 10.8 2002/08/07 15:14:58 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::declareIndex</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::declareIndex</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlContainer::declareIndex(DbTxn *txnid, + const std::string &node, const std::string &index, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::declareIndex method declares the indexing required for a +particular node. The node may be an element or attribute. +<p>The <b>node</b> parameter provides the name of the node +to be indexed. Attribute node names are prefixed with the '@' character +to distinguish them from element node names. For example, within the +following XML document fragment the element name is 'fruit', and the +attribute name is '@color', +"<fruit color='red'>apple</fruit>". +<p>A fully qualified node name is a node name that includes its full +namespace specification. In the following fragment from the +<a href="http://www.w3.org/TR/1999/REC-xml-names-19990114/">W3C XML Namespaces specification</a>, the fully qualified name of +the "price units" element is "http://ecommerce.org/schema:price units": +<p><blockquote><pre><x xmlns:edi='http://ecommerce.org/schema'> + <!-- the 'price' element's namespace is http://ecommerce.org/schema --> + <edi:price units='Euro'>32.18</edi:price> +</x></pre></blockquote> +<p>The index string is a comma separated list of one or more of the +following indexing strategy names: +<p><ul type=disc> +<li>none-none-none-none +<li>node-element-presence +<li>node-attribute-presence +<li>node-element-equality-string +<li>node-element-equality-number +<li>node-element-substring-string +<li>node-attribute-equality-string +<li>node-attribute-equality-number +<li>node-attribute-substring-string +<li>edge-element-presence +<li>edge-attribute-presence +<li>edge-element-equality-string +<li>edge-element-equality-number +<li>edge-element-substring-string +<li>edge-attribute-equality-string +<li>edge-attribute-equality-number +<li>edge-attribute-substring-string +</ul> +<p>Indices may only be declared for empty containers. Once documents have +been added to a container the indexing specification for the container +may not be changed. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlContainer::declareIndex method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer::declareIndex method may fail and throw an UNREF==xmlexception_class +exception with the following exception code: +<p><dl compact> +<p><dt>CONTAINER_NOT_EMPTY<dd>Indexes may only be declared for empty containers. +</dl> +<p><dl compact> +<p><dt>CONTAINER_CLOSED<dd>Indexes may only be declared on open containers. +</dl> +<p><dl compact> +<p><dt>DATABASE_ERROR<dd>An error occurred in an underlying Berkeley DB database. +UNREF==xml_getdberror method returns the error code for the error. +</dl> +<p>The XmlContainer::declareIndex method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::declareIndex method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_del.html b/db/docs/api_cxx/xml_del.html new file mode 100644 index 000000000..97caf9aba --- /dev/null +++ b/db/docs/api_cxx/xml_del.html @@ -0,0 +1,81 @@ +<!--Id: xml_del.so,v 10.5 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::deleteDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::deleteDocument</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlContainer::deleteDocument(DbTxn *txnid, u_int32_t id, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::deleteDocument method removes the document identified by the <b>id</b> +parameter from the container. +<p>If the operation is to be transaction-protected (other than by specifying +the DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a +transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the XmlContainer::deleteDocument call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p> +If the specified document is not in the container, the XmlContainer::deleteDocument method will return DB_NOTFOUND. +Otherwise, the XmlContainer::deleteDocument method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the operation was selected to resolve a deadlock, the +XmlContainer::deleteDocument method will fail and +throw a <a href="../api_cxx/deadlock_class.html">DbDeadlockException</a> exception. +<p>The XmlContainer::deleteDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::deleteDocument method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_get.html b/db/docs/api_cxx/xml_get.html new file mode 100644 index 000000000..6ef4c0ba8 --- /dev/null +++ b/db/docs/api_cxx/xml_get.html @@ -0,0 +1,90 @@ +<!--Id: xml_get.so,v 10.5 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::getDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::getDocument</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +XmlDocument +XmlContainer::getDocument(DbTxn *txnid, u_int32_t id, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::getDocument method returns the document identified by the <b>id</b> +parameter. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or +more of the following values: +<p><dl compact> +<p><dt><a name="DB_DIRTY_READ">DB_DIRTY_READ</a><dd>Read modified but not yet committed data. Silently ignored if the +<a href="../api_cxx/db_open.html#DB_DIRTY_READ">DB_DIRTY_READ</a> flag was not specified when the underlying +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> was opened. +<p><dt><a name="DB_RMW">DB_RMW</a><dd>Acquire write locks instead of read locks when doing the retrieval. +Setting this flag can eliminate deadlock during a read-modify-write +cycle by acquiring the write lock during the read part of the cycle so +that another thread of control acquiring a read lock for the same item, +in its own read-modify-write cycle, will not result in deadlock. +<p>Because the XmlContainer::getDocument interface will not hold locks +across Berkeley DB interface calls in non-transactional environments, the +<a href="../api_cxx/dbc_get.html#DB_RMW">DB_RMW</a> flag to the XmlContainer::getDocument call is meaningful only in +the presence of transactions. +</dl> +<p> +If the specified document is not in the container, the XmlContainer::getDocument method will return DB_NOTFOUND. +Otherwise, the XmlContainer::getDocument method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the operation was selected to resolve a deadlock, the +XmlContainer::getDocument method will fail and +throw a <a href="../api_cxx/deadlock_class.html">DbDeadlockException</a> exception. +<p>The XmlContainer::getDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::getDocument method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_getname.html b/db/docs/api_cxx/xml_getname.html new file mode 100644 index 000000000..721e60741 --- /dev/null +++ b/db/docs/api_cxx/xml_getname.html @@ -0,0 +1,73 @@ +<!--Id: xml_getname.so,v 10.4 2002/06/24 14:49:37 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::getName</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::getName</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +std::string +XmlContainer::getName() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::getName method returns the name of the container. +<p>The XmlContainer::getName method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer::getName method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The container has not yet been opened. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlContainer::getName method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlContainer::getName method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::getName method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_index.html b/db/docs/api_cxx/xml_index.html new file mode 100644 index 000000000..68d9c6282 --- /dev/null +++ b/db/docs/api_cxx/xml_index.html @@ -0,0 +1,56 @@ +<!--Id: xml_index.so,v 10.5 2002/06/25 17:17:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Berkeley DB XML: C++ Interface</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<h1 align=center>Berkeley DB XML: C++ Interface</h1> +<p><table border=1 align=center> +<tr><th>Section</th><th>Class/Method</th><th>Description</th></tr> +<tr><td><b>DbXML Operations</b></td><td><a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a></td><td>Create a XML container handle</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_close.html">XmlContainer::close</a></td><td>Close a XML container</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a></td><td>Declare an index</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a></td><td>Delete a document from a container</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a></td><td>Retrieve a document from a container</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_getname.html">XmlContainer::getName</a></td><td>Return a container name</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_open.html">XmlContainer::open</a></td><td>Open a XML container</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_xparse.html">XmlContainer::parseXPathExpression</a></td><td>Parse an XPath 1.0 expression</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a></td><td>Store a document in a container</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a></td><td>Query a container using XPath 1.0</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldocument_class.html">XmlDocument</a></td><td>Create a XML document handle</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a></td><td>Get the document annotation attributes</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a></td><td>Get the document content</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getcontlen.html">XmlDocument::getContentLength</a></td><td>Return the document's length</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getdom.html">XmlDocument::getDOM</a></td><td>Return the document as a DOM</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getenc.html">XmlDocument::getEncoding</a></td><td>Return the document's encoding</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a></td><td>Get the document ID</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a></td><td>Get the document name</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a></td><td>Get the document type</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_setattr.html">XmlDocument::setAttributeValue</a></td><td>Set the document annotation attributes</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a></td><td>Set the document content</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a></td><td>Set the document name</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a></td><td>Set the document type</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a></td><td>Create a XPath query context</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_clearname.html">XmlQueryContext::clearNamespaces</a></td><td>Delete all namespace mappings</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_getname.html">XmlQueryContext::getNamespace</a></td><td>Return the namespace URI</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_getvar.html">XmlQueryContext::getVariableValue</a></td><td>Return the value bound to a variable</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_remname.html">XmlQueryContext::removeNamespace</a></td><td>Delete the namespace URI</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_seteval.html">XmlQueryContext::setEvaluationType</a></td><td>Set the query evaluation type</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_setname.html">XmlQueryContext::setNamespace</a></td><td>Set the namespace URI</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_setret.html">XmlQueryContext::setReturnType</a></td><td>Set the query return type</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlq_setvar.html">XmlQueryContext::setVariableValue</a></td><td>Bind a value to a variable</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlresults_class.html">XmlResults</a></td><td>Encapsulate XPath query results</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlr_next.html">XmlResults::next</a></td><td>Return the next result</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlr_reset.html">XmlResults::reset</a></td><td>Reset the results iterator</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlvalue_class.html">XmlValue</a></td><td>Encapsulate the value of a document node</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlxpathexp_class.html">XPathExpression</a></td><td>Encapsulate a parsed XPath expression</td></tr> +<tr><td><br></td><td><a href="../api_cxx/xmlxpe_get.html">XPathExpression::getXPathQuery</a></td><td>Return the XPath query</td></tr> +</table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_open.html b/db/docs/api_cxx/xml_open.html new file mode 100644 index 000000000..baa9b2704 --- /dev/null +++ b/db/docs/api_cxx/xml_open.html @@ -0,0 +1,145 @@ +<!--Id: xml_open.so,v 10.5 2002/07/30 16:57:43 merrells Exp --> +<!--Id: m4.db_open,v 10.2 2002/06/20 03:47:44 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::open</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::open</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlContainer::open(DbTxn *txnid, + u_int32_t flags, int mode); +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::open method opens the <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> +for both reading and writing. The container name, passed
+through the constructor, is used as the base name for a set of +underlying Berkeley DB databases that are used to back the
+container. +
+<p>The XmlContainer::open method may only be called on a closed
+container. A container is in the closed state after construction,
+and after the <a href="../api_cxx/xml_close.html">XmlContainer::close</a> method has been called. Note
+that it is allowable to re-open a container after it has been
+closed.
+
+<p>An open <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> must be closed, by calling the
+<a href="../api_cxx/xml_close.html">XmlContainer::close</a> method, before the <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>
+object is destroyed. Otherwise the underlying database
+resources will not be released. +<p>If the operation is to be transaction-protected (other than by specifying +the DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a +transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; otherwise, NULL. +<p>The <b>flags</b> and <b>mode</b> arguments specify how files will be opened +and/or created if they do not already exist. +<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or +more of the following values: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the XmlContainer::open call within a transaction. If the call succeeds, +the open operation will be recoverable. If the call fails, no container will +have been created. +<p><dt><a name="DB_CREATE">DB_CREATE</a><dd>Create the container. If the container does not already exist and the DB_CREATE +flag is not specified, the XmlContainer::open will fail. +<p><dt><a name="DB_DIRTY_READ">DB_DIRTY_READ</a><dd>Support dirty reads; that is, read operations on the container may request the +return of modified but not yet committed data. +<p><dt><a name="DB_EXCL">DB_EXCL</a><dd>Return an error if the container already exists. The <a href="../api_cxx/db_open.html#DB_EXCL">DB_EXCL</a> flag is +only meaningful when specified with the <a href="../api_cxx/env_open.html#DB_CREATE">DB_CREATE</a> flag. +<p><dt><a name="DB_NOMMAP">DB_NOMMAP</a><dd>Do not map this container into process memory (see the description of the +<a href="../api_cxx/env_set_mp_mmapsize.html">DbEnv::set_mp_mmapsize</a> method for further information). +<p><dt><a name="DB_RDONLY">DB_RDONLY</a><dd>Open the container for reading only. Any attempt to modify items in the container +will fail, regardless of the actual permissions of any underlying files. +<p><dt><a name="DB_THREAD">DB_THREAD</a><dd>Cause the <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> handle returned by XmlContainer::open to be +<i>free-threaded</i>; that is, usable by multiple threads within a +single address space. +</dl> +<p>On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, all files created by +the container open are created with mode <b>mode</b> (as described in <b>chmod</b>(2)) and modified by the process' umask value at the time of creation +(see <b>umask</b>(2)). If <b>mode</b> is 0, the container open will use a default +mode of readable and writable by both owner and group. On Windows +systems, the mode argument is ignored. The group ownership of created +files is based on the system and directory defaults, and is not further +specified by Berkeley DB. +<p>Calling XmlContainer::open is a reasonably expensive operation, and maintaining +a set of open containers will normally be preferable to repeatedly opening +and closing the container for each new query. +<p>The XmlContainer::open method throws an exception that encapsulates a non-zero error value on +failure. +If XmlContainer::open fails, the <a href="../api_cxx/xml_close.html">XmlContainer::close</a> method should be called to discard the +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> handle. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>If a <b>dbenv</b> argument to <a href="../api_c/db_create.html">db_create</a> was specified, the +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>XmlContainer::open is affected by any database directory specified using the +<a href="../api_cxx/env_set_data_dir.html">DbEnv::set_data_dir</a> method, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<p><dl compact> +<p><dt>TMPDIR<dd>If the <b>file</b> and <b>dbenv</b> arguments to XmlContainer::open are +NULL, the environment variable <b>TMPDIR</b> may be used as a +directory in which to create temporary backing files +</dl> +<h1>Errors</h1> +<p>The XmlContainer::open method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt><a name="DB_OLD_VERSION">DB_OLD_VERSION</a><dd>The container cannot be opened without being first upgraded. +<p><dt>EEXIST<dd>DB_CREATE and DB_EXCL were specified and the container exists. +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p> +The <a href="../api_cxx/env_open.html#DB_THREAD">DB_THREAD</a> flag was specified and fast mutexes are not +available for this architecture. +<p>The <a href="../api_cxx/env_open.html#DB_THREAD">DB_THREAD</a> flag was specified to XmlContainer::open, but was not +specified to the <a href="../api_cxx/env_open.html">DbEnv::open</a> call for the environment in which the +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> handle was created. +</dl> +<p>The XmlContainer::open method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::open method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_put.html b/db/docs/api_cxx/xml_put.html new file mode 100644 index 000000000..9e48a3824 --- /dev/null +++ b/db/docs/api_cxx/xml_put.html @@ -0,0 +1,90 @@ +<!--Id: xml_put.so,v 10.6 2002/06/24 14:49:37 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::putDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::putDocument</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +u_int32_t +XmlContainer::putDocument(DbTxn *txnid, XmlDocument &xmldoc, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer::putDocument method stores a XML document into the container and +returns the document ID. The contents of an <a href="../api_cxx/xmldocument_class.html">XmlDocument</a> may be +of type <a href="../api_cxx/xmldoc_settype.html#XmlDocument::BYTES">XmlDocument::BYTES</a> or <a href="../api_cxx/xmldoc_settype.html#XmlDocument::XML">XmlDocument::XML</a>. XML +content is parsed and indexed as per the container indexing +specification. Non-XML (<a href="../api_cxx/xmldoc_settype.html#XmlDocument::BYTES">XmlDocument::BYTES</a>) content is not +indexed. +<p>Regardless of the content type the document annotation attributes +are always indexed.] +<p>The XML indexer expects XML content to be encoded as UTF-8. The indexer +also expects the XML content to be +<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html#dt-wellformed">well-formed</a>, but the content need not be +<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html#dt-valid">valid</a>. +<p>If the operation is to be transaction-protected (other than by specifying +the DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a +transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the XmlContainer::putDocument call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The XmlContainer::putDocument method returns a document ID on success. +Otherwise, the XmlContainer::putDocument method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the operation was selected to resolve a deadlock, the +XmlContainer::putDocument method will fail and +throw a <a href="../api_cxx/deadlock_class.html">DbDeadlockException</a> exception. +<p>The XmlContainer::putDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::putDocument method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_xparse.html b/db/docs/api_cxx/xml_xparse.html new file mode 100644 index 000000000..8300f9a78 --- /dev/null +++ b/db/docs/api_cxx/xml_xparse.html @@ -0,0 +1,77 @@ +<!--Id: xml_xparse.so,v 10.5 2002/06/24 14:49:38 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::parseXPathExpression</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::parseXPathExpression</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +XPathExpression +XmlContainer::parseXPathExpression( + const std::string &xpath, XmlQueryContext *context, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>Return a pre-parsed XPath 1.0 version query for later use with the +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a> method. The query is provided as a string and is expected +to be in the syntax defined in the +<a href="http://www.w3c.org/TR/xpath">W3C XPath 1.0 +specification</a>. +<p>The query may optionally be done within the execution context +<b>context</b>, which describes how the query is to be performed. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlContainer::parseXPathExpression method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer::parseXPathExpression method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlContainer::parseXPathExpression method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::parseXPathExpression method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xml_xpath.html b/db/docs/api_cxx/xml_xpath.html new file mode 100644 index 000000000..12cdc2b55 --- /dev/null +++ b/db/docs/api_cxx/xml_xpath.html @@ -0,0 +1,102 @@ +<!--Id: xml_xpath.so,v 10.5 2002/06/24 14:49:38 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer::queryWithXPath</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer::queryWithXPath</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +XmlResults +XmlContainer::queryWithXPath(DbTxn *txnid, + XPathExpression &expression, u_int32_t flags) const; +<p> +XmlResults +XmlContainer::queryWithXPath(DbTxn *txnid, + const std::string &query, XmlQueryContext *context, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>Return the results of an XPath 1.0 version query against the container. +In the first variant, <b>expression</b> is provided as the results of +a call to the <a href="../api_cxx/xml_xparse.html">XmlContainer::parseXPathExpression</a> method. +<p>In the second variant, <b>query</b> is provided as a string (expected +to be in the syntax defined in the +<a href="http://www.w3c.org/TR/xpath">W3C XPath 1.0 specification</a>). +In this case, the query may optionally be done within the execution +context <b>context</b>, which describes how the query is to be +performed. If no context is specified, the query will retrieve the set +of <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>s matching the XPath expression. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; +otherwise, NULL. +<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or +more of the following values: +<p><dl compact> +<p><dt><a name="DB_DIRTY_READ">DB_DIRTY_READ</a><dd>Read modified but not yet committed data. Silently ignored if the +<a href="../api_cxx/db_open.html#DB_DIRTY_READ">DB_DIRTY_READ</a> flag was not specified when the underlying +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> was opened. +<p><dt><a name="DB_RMW">DB_RMW</a><dd>Acquire write locks instead of read locks when doing the retrieval. +Setting this flag can eliminate deadlock during a read-modify-write +cycle by acquiring the write lock during the read part of the cycle so +that another thread of control acquiring a read lock for the same item, +in its own read-modify-write cycle, will not result in deadlock. +<p>Because the <a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a> interface will not hold locks +across Berkeley DB interface calls in non-transactional environments, the +<a href="../api_cxx/dbc_get.html#DB_RMW">DB_RMW</a> flag to the <a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a> call is meaningful only in +the presence of transactions. +</dl> +<p>The XmlContainer::queryWithXPath method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer::queryWithXPath method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlContainer::queryWithXPath method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer::queryWithXPath method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlcontainer_class.html b/db/docs/api_cxx/xmlcontainer_class.html new file mode 100644 index 000000000..c26d3a58d --- /dev/null +++ b/db/docs/api_cxx/xmlcontainer_class.html @@ -0,0 +1,85 @@ +<!--Id: xmlcontainer_class.so,v 1.8 2002/07/30 16:57:44 merrells Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +class DbXml::XmlContainer { +public: + XmlContainer(DbEnv *dbenv, const string &name, u_int32_t flags); + ~XmlContainer(); + ... +}; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer class provides methods for managing the storage and +retrieval of XmlDocuments. The constructor creates an XmlContainer +object that is the handle for an XML Container. +<p>If no <b>dbenv</b> value is specified, the container is standalone; that +is, it is not part of any Berkeley DB environment. +<p>If a <b>dbenv</b> value is specified, the container is created within +the specified Berkeley DB environment and all operations are performed within +the context of that environment. The container methods automatically +make calls to the other subsystems in Berkeley DB based on the enclosing +environment. For example, if the environment has been configured to use +locking, the container methods will automatically acquire the correct +locks when reading and writing pages of the underlying databases that +support the container. The user is expected to suitably configure the +environment for their particular application. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_XA_CREATE">DB_XA_CREATE</a><dd>Instead of creating a standalone database, create a database intended to +be accessed via applications running under a X/Open conformant Transaction +Manager. The database will be opened in the environment specified by the +OPENINFO parameter of the GROUPS section of the ubbconfig file. See the +<a href="../ref/xa/intro.html">XA Resource Manager</a> chapter in the +Reference Guide for more information. +</dl> +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getattr.html b/db/docs/api_cxx/xmldoc_getattr.html new file mode 100644 index 000000000..6ce082d71 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getattr.html @@ -0,0 +1,72 @@ +<!--Id: xmldoc_getattr.so,v 10.6 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getAttributeValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getAttributeValue</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +XmlValue +XmlDocument::getAttributeValue(const std::string &attr) const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getAttributeValue method returns the value of the <b>attr</b> +annotation attribute. +<p> +If the specified attribute is not in the document, the XmlDocument::getAttributeValue method will return DB_NOTFOUND. +Otherwise, the XmlDocument::getAttributeValue method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getAttributeValue method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument::getAttributeValue method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument::getAttributeValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getAttributeValue method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getcont.html b/db/docs/api_cxx/xmldoc_getcont.html new file mode 100644 index 000000000..b5fc3a10d --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getcont.html @@ -0,0 +1,70 @@ +<!--Id: xmldoc_getcont.so,v 10.5 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getContent</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getContent</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +const char * +XmlDocument::getContent() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getContent method returns the document content. +<p>The XmlDocument::getContent method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getContent method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>The XmlDocument::getContent method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getContent method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getcontlen.html b/db/docs/api_cxx/xmldoc_getcontlen.html new file mode 100644 index 000000000..1a84fd948 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getcontlen.html @@ -0,0 +1,71 @@ +<!--Id: xmldoc_getcontlen.so,v 10.4 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getContentLength</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getContentLength</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +size_t +XmlDocument::getContentLength() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getContentLength method returns the length of the document's +content, in bytes. +<p>The XmlDocument::getContentLength method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getContentLength method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>The XmlDocument::getContentLength method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getContentLength method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getdom.html b/db/docs/api_cxx/xmldoc_getdom.html new file mode 100644 index 000000000..e668b801f --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getdom.html @@ -0,0 +1,78 @@ +<!--Id: xmldoc_getdom.so,v 10.6 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getDOM</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getDOM</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void * +XmlDocument::getDOM(bool withAnnotationAttributes) const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getDOM method returns the document as a +Xerces +Document Object Model (DOM). +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="DB_WITHATTRIBUTES">DB_WITHATTRIBUTES</a><dd>The document annotation attributes are added as attributes of the +document's root element. +</dl> +<p>The XmlDocument::getDOM method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getDOM method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>The XmlDocument::getDOM method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getDOM method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getenc.html b/db/docs/api_cxx/xmldoc_getenc.html new file mode 100644 index 000000000..9e3996021 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getenc.html @@ -0,0 +1,86 @@ +<!--Id: xmldoc_getenc.so,v 10.6 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getEncoding</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getEncoding</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +Encoding +XmlDocument::getEncoding() const; +<p> +std::string +XmlDocument::getEncodingName() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getEncoding method returns the document encoding as one of the +following types: +<p><ul type=disc> +<li><a name="XmlDocument::EBCDIC">XmlDocument::EBCDIC</a> +<li><a name="XmlDocument::NONE">XmlDocument::NONE</a> +<li><a name="XmlDocument::UCS4">XmlDocument::UCS4</a> +<li><a name="XmlDocument::UCS4_ASCII">XmlDocument::UCS4_ASCII</a> +<li><a name="XmlDocument::UTF16">XmlDocument::UTF16</a> +<li><a name="XmlDocument::UTF8">XmlDocument::UTF8</a> +</ul> +<p>The <a href="../api_cxx/xmldoc_getenc.html">XmlDocument::getEncodingName</a> method returns the document encoding as a string. +<p>The XmlDocument::getEncoding method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getEncoding method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument::getEncoding method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument::getEncoding method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getEncoding method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getid.html b/db/docs/api_cxx/xmldoc_getid.html new file mode 100644 index 000000000..fe7831997 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getid.html @@ -0,0 +1,73 @@ +<!--Id: xmldoc_getid.so,v 10.5 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getID</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getID</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +u_int32_t +XmlDocument::getID() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getID method returns the document ID. The document ID will +be zero if the document has not yet been assigned any content, or the +document has not yet been added to a container. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlDocument::getID method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getID method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document does not have an ID. +</dl> +<p>The XmlDocument::getID method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getID method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_getname.html b/db/docs/api_cxx/xmldoc_getname.html new file mode 100644 index 000000000..c799e8ecb --- /dev/null +++ b/db/docs/api_cxx/xmldoc_getname.html @@ -0,0 +1,73 @@ +<!--Id: xmldoc_getname.so,v 10.5 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getName</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getName</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +std::string +XmlDocument::getName() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getName method returns the document name. +<p>The XmlDocument::getName method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getName method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document does not have a name. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument::getName method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument::getName method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getName method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_gettype.html b/db/docs/api_cxx/xmldoc_gettype.html new file mode 100644 index 000000000..a2c690b62 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_gettype.html @@ -0,0 +1,72 @@ +<!--Id: xmldoc_gettype.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::getType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::getType</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +Type +XmlDocument::getType() const; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::getType method returns the document type, either +<a href="../api_cxx/xmldoc_settype.html#XmlDocument::BYTES">XmlDocument::BYTES</a>, <a href="../api_cxx/xmldoc_gettype.html#XmlDocument::UNKNOWN">XmlDocument::UNKNOWN</a>, or +<a href="../api_cxx/xmldoc_settype.html#XmlDocument::XML">XmlDocument::XML</a>. +<p>The XmlDocument::getType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::getType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document does not have a type. +</dl> +<p>The XmlDocument::getType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::getType method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_setattr.html b/db/docs/api_cxx/xmldoc_setattr.html new file mode 100644 index 000000000..53bc5a639 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_setattr.html @@ -0,0 +1,75 @@ +<!--Id: xmldoc_setattr.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::setAttributeValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::setAttributeValue</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlDocument::setAttributeValue(const std::string &attr, + const std::string &value, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::setAttributeValue method sets the value of the specified <b>attr</b> +annotation attribute. The only values supported are Strings. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlDocument::setAttributeValue method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::setAttributeValue method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument::setAttributeValue method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument::setAttributeValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::setAttributeValue method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_setcont.html b/db/docs/api_cxx/xmldoc_setcont.html new file mode 100644 index 000000000..187c8dcc5 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_setcont.html @@ -0,0 +1,70 @@ +<!--Id: xmldoc_setcont.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::setContent</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::setContent</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlDocument::setContent(const void *content, size_t len, u_int32_t flags); +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::setContent method sets the document content. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlDocument::setContent method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::setContent method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlDocument::setContent method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::setContent method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_setname.html b/db/docs/api_cxx/xmldoc_setname.html new file mode 100644 index 000000000..09dbe10d0 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_setname.html @@ -0,0 +1,69 @@ +<!--Id: xmldoc_setname.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::setName</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::setName</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlDocument::setName(const std::string &name); +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::setName method sets the name of the document. +<p>The XmlDocument::setName method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::setName method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument::setName method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument::setName method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::setName method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldoc_settype.html b/db/docs/api_cxx/xmldoc_settype.html new file mode 100644 index 000000000..11b8e4674 --- /dev/null +++ b/db/docs/api_cxx/xmldoc_settype.html @@ -0,0 +1,71 @@ +<!--Id: xmldoc_settype.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument::setType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument::setType</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlDocument::setType(Type type); +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument::setType method sets the document type. The document type +must be set to one of the following values: +<p><dl compact> +<p><dt>XmlDocument::BYTES<dd>Untyped input, which cannot be indexed. +<p><dt>XmlDocument::XML<dd>XML input. +</dl> +<p>The XmlDocument::setType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument::setType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>The XmlDocument::setType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument::setType method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmldocument_class.html b/db/docs/api_cxx/xmldocument_class.html new file mode 100644 index 000000000..7487562e7 --- /dev/null +++ b/db/docs/api_cxx/xmldocument_class.html @@ -0,0 +1,75 @@ +<!--Id: xmldocument_class.so,v 1.9 2002/07/29 04:20:27 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +class DbXml::XmlDocument { +public: + XmlDocument(); + XmlDocument(const XmlDocument &); + ~XmlDocument(); + XmlDocument &operator = (const XmlDocument &) + ... +}; +</pre></h3> +<h1>Description</h1> +<p>An XmlDocument is the unit of storage within a <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>. +<p>A XmlDocument contains a stream of bytes that may be of type +XML or BYTES. The <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a> will only index the content of +XmlDocuments that contain XML. The BYTES type is supported to +allow the storage of arbitrary content along with XML content. +<p>All documents objects stored within a container are assigned a document +ID, at 32-bit unsigned integral value. This ID uniquely identifies a +document within a container. The ID is assigned by the container when +the document is first added to the container. +<p>The XmlDocument class supports annotation attributes. The user +may annotate their documents with meta-information to be stored with +their document, but not within their document. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_clearname.html b/db/docs/api_cxx/xmlq_clearname.html new file mode 100644 index 000000000..2ce9f095a --- /dev/null +++ b/db/docs/api_cxx/xmlq_clearname.html @@ -0,0 +1,66 @@ +<!--Id: xmlq_clearname.so,v 10.3 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::clearNamespaces</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::clearNamespaces</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlQueryContext::clearNamespaces(); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::clearNamespaces method removes all current namespace prefix to URI +mappings. +<p>The XmlQueryContext::clearNamespaces method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::clearNamespaces method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::clearNamespaces method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_getname.html b/db/docs/api_cxx/xmlq_getname.html new file mode 100644 index 000000000..c28884082 --- /dev/null +++ b/db/docs/api_cxx/xmlq_getname.html @@ -0,0 +1,75 @@ +<!--Id: xmlq_getname.so,v 10.5 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::getNamespace</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::getNamespace</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +std::string +XmlQueryContext::getNamespace(const std::string &prefix); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::getNamespace method returns the namespace prefix to URI mapping +for <b>prefix</b>. +<p> +If no mapping is found, the XmlQueryContext::getNamespace method will return DB_NOTFOUND. +Otherwise, the XmlQueryContext::getNamespace method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::getNamespace method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlQueryContext::getNamespace method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlQueryContext::getNamespace method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::getNamespace method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_getvar.html b/db/docs/api_cxx/xmlq_getvar.html new file mode 100644 index 000000000..2aa7f2ab7 --- /dev/null +++ b/db/docs/api_cxx/xmlq_getvar.html @@ -0,0 +1,72 @@ +<!--Id: xmlq_getvar.so,v 10.5 2002/07/01 16:46:16 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::getVariableValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::getVariableValue</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +XmlValue +XmlQueryContext::getVariableValue(const std::string &name); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::getVariableValue method returns the value bound to the variable +<b>name</b>. +<p> +If there is no value, the XmlQueryContext::getVariableValue method will return DB_NOTFOUND. +Otherwise, the XmlQueryContext::getVariableValue method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::getVariableValue method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlQueryContext::getVariableValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::getVariableValue method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_remname.html b/db/docs/api_cxx/xmlq_remname.html new file mode 100644 index 000000000..5d9b457da --- /dev/null +++ b/db/docs/api_cxx/xmlq_remname.html @@ -0,0 +1,67 @@ +<!--Id: xmlq_remname.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::removeNamespace</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::removeNamespace</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlQueryContext::removeNamespace(const std::string &prefix); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::removeNamespace method removes the namespace prefix to URI mapping +for <b>prefix</b>. A prefix with no mapping is ignored. +<p>The XmlQueryContext::removeNamespace method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::removeNamespace method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>The XmlQueryContext::removeNamespace method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::removeNamespace method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_seteval.html b/db/docs/api_cxx/xmlq_seteval.html new file mode 100644 index 000000000..e02977224 --- /dev/null +++ b/db/docs/api_cxx/xmlq_seteval.html @@ -0,0 +1,80 @@ +<!--Id: xmlq_seteval.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::setEvaluationType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::setEvaluationType</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlQueryContext::setEvaluationType(EvaluationType type); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::setEvaluationType method sets the query evaluation type. This option +is provided as large result sets could consume large amounts of memory. +By electing lazy evaluation the caller can read documents into memory +as needed. The <b>type</b> must be set to one of the following +values: +<p><dl compact> +<p><dt>XmlQueryContext::Eager<dd>The whole query is executed and its restultant values derived and stored +in-memory before the call to <a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a> returns. +<p><dt>XmlQueryContext::Lazy<dd>Perform as little up-front processing as possible, deferring all +processing to results iteration. This means that as each call to +<a href="../api_cxx/xmlr_next.html">XmlResults::next</a> is called the next resultant value is determined. +</dl> +<p>The XmlQueryContext::setEvaluationType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::setEvaluationType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlQueryContext::setEvaluationType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::setEvaluationType method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_setname.html b/db/docs/api_cxx/xmlq_setname.html new file mode 100644 index 000000000..7195577fb --- /dev/null +++ b/db/docs/api_cxx/xmlq_setname.html @@ -0,0 +1,67 @@ +<!--Id: xmlq_setname.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::setNamespace</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::setNamespace</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlQueryContext::setNamespace( + const std::string &prefix, const std::string &uri); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::setNamespace method defines the namespace prefix to URI mapping +for <b>prefix</b> and <b>uri</b>. +<p>The XmlQueryContext::setNamespace method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::setNamespace method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::setNamespace method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_setret.html b/db/docs/api_cxx/xmlq_setret.html new file mode 100644 index 000000000..938f340f2 --- /dev/null +++ b/db/docs/api_cxx/xmlq_setret.html @@ -0,0 +1,86 @@ +<!--Id: xmlq_setret.so,v 10.4 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::setReturnType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::setReturnType</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlQueryContext::setReturnType(ReturnType type); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::setReturnType method sets the query return type. The query can +return candidate documents, result documents, or result values. A +candidate document is a document that may match the XPath expression, +a result document is a document that does match the XPath expression, +and a result value is the result of executing the XPath expression +against the result document. +<p>For some expressions it might be known that the candidate set is in fact +equivalent to the result set. For these expressions there is no need to +pass the candidate documents through a filter to eliminate false +positives. The query processor can detect some expressions of this +nature, but not all. The user application may know better, or may want +to do its own false positive elimination. +<p>The <b>type</b> must be set to one of the following values: +<p><dl compact> +<p><dt>XmlQueryContext::CandidateDocuments<dd>Return documents that may match the XPath expression. +<p><dt>XmlQueryContext::ResultDocuments<dd>Return documents that match the XPath expression. +<p><dt>XmlQueryContext::ResultValues<dd>Project the XPath expression over the matching document. +</dl> +<p>The XmlQueryContext::setReturnType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext::setReturnType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlQueryContext::setReturnType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::setReturnType method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlq_setvar.html b/db/docs/api_cxx/xmlq_setvar.html new file mode 100644 index 000000000..0d605d32e --- /dev/null +++ b/db/docs/api_cxx/xmlq_setvar.html @@ -0,0 +1,65 @@ +<!--Id: xmlq_setvar.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext::setVariableValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext::setVariableValue</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlQueryContext::setVariableValue( + const std::string &name, const XmlValue &value); +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext::setVariableValue method binds the variable <b>name</b> to the value +<b>value</b>. +<h1>Errors</h1> +<p>The XmlQueryContext::setVariableValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext::setVariableValue method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlquery_class.html b/db/docs/api_cxx/xmlquery_class.html new file mode 100644 index 000000000..f88096e1b --- /dev/null +++ b/db/docs/api_cxx/xmlquery_class.html @@ -0,0 +1,74 @@ +<!--Id: xmlquery_class.so,v 1.9 2002/07/29 04:20:27 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +class DbXml::XmlQueryContext { +public: + XmlQueryContext(); + XmlQueryContext(const XmlQueryContext &); + ~XmlQueryContext(); + XmlQueryContext &operator = (const XmlQueryContext &) + ... +}; +</pre></h3> +<h1>Description</h1> +<p>An XmlQueryContext is the context within which a query is +performed against an <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>. This context includes a +namespace mapping, variable bindings, and flags that determine how the +query result set should be determined and returned to the caller. +<p>The XPath syntax permits expressions to refer to namespace prefixes, +but not to define them. The XmlQueryContext class provides +namespace management methods so the caller may manage the namespace +prefix to URI mapping. The XPath syntax also permits expressions to +refer to variables, but not to define them. The XmlQueryContext class +provides methods so the caller may manage the variable to value +bindings. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlr_next.html b/db/docs/api_cxx/xmlr_next.html new file mode 100644 index 000000000..498e3390a --- /dev/null +++ b/db/docs/api_cxx/xmlr_next.html @@ -0,0 +1,71 @@ +<!--Id: xmlr_next.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlResults::next</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlResults::next</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlResults::next(DbTxn *txnid, XmlValue &value); +</pre></h3> +<h1>Description</h1> +<p>The XmlResults::next method returns the next value in the results into the +memory referenced by <b>value</b>. When no more values remain in the +result set, XmlResults::next will return a value with an empty pointer, +so that UNREF==xmlv_get will return 0. +<p>The XmlResults::next method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the requested item could not be returned due to insufficient memory, +the XmlResults::next method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlResults::next method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlResults::next method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlr_reset.html b/db/docs/api_cxx/xmlr_reset.html new file mode 100644 index 000000000..a1cffe91c --- /dev/null +++ b/db/docs/api_cxx/xmlr_reset.html @@ -0,0 +1,72 @@ +<!--Id: xmlr_reset.so,v 10.2 2002/06/24 14:49:42 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlResults::reset</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlResults::reset</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +void +XmlResults::reset() +</pre></h3> +<h1>Description</h1> +<p>The XmlResults::reset method reset the results iterator, for eager +evaluation. If the query was processed with eager evaluation then reset +will reset the iterator so a subsequent call to <a href="../api_cxx/xmlr_next.html">XmlResults::next</a> method will +return the first value in the result set. If the query was processed +with lazy evaluation then XmlResults::reset will have no effect. +<p>The XmlResults::reset method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the requested item could not be returned due to insufficient memory, +the XmlResults::reset method will fail and +throw a <a href="../api_cxx/mem_class.html">DbMemoryException</a> exception. +<p>The XmlResults::reset method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlResults::reset method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlresults_class.html b/db/docs/api_cxx/xmlresults_class.html new file mode 100644 index 000000000..3e7d95b3e --- /dev/null +++ b/db/docs/api_cxx/xmlresults_class.html @@ -0,0 +1,79 @@ +<!--Id: xmlresults_class.so,v 1.8 2002/07/29 04:20:27 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlResults</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlResults</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +class DbXml::XmlResults { +public: + XmlResults(const XmlResults &); + ~XmlResults(); + XmlResults &operator = (const XmlResults &) + ... +}; +</pre></h3> +<h1>Description</h1> +<p>The XmlResults class encapsulates the results of a query against +an <a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>. +<p>The results of a query are a collection of <a href="../api_cxx/xmlvalue_class.html">XmlValue</a>s. The +<a href="../api_cxx/xmlvalue_class.html">XmlValue</a>s may be either documents or nodesets. If the query +context selected a return type of <a href="../api_cxx/xmlq_setret.html#XmlQueryContext::ResultValues">XmlQueryContext::ResultValues</a> +then the values will be of type NodeListValue, otherwise they will be +of type DocumentValue. +<p>An XmlResults object is created by calling <a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +If the query context called for lazy expression evaluation then the +resultant values will be computed as needed. If eager evaluation was +selected the resultant values are stored within the XmlResults +object. +<p>XmlResults provides an iteration interface through its next() +method. When there are no more values available the passed back value +pointer will be zero. If eager evaluation was selected then the reset +method can be called to reset the iterator, and the next call to next() +will return the first value of the results. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlvalue_class.html b/db/docs/api_cxx/xmlvalue_class.html new file mode 100644 index 000000000..981a59c72 --- /dev/null +++ b/db/docs/api_cxx/xmlvalue_class.html @@ -0,0 +1,97 @@ +<!--Id: xmlvalue_class.so,v 1.4 2002/07/29 04:20:28 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlValue</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +class DbXml::XmlValue { +public: + XmlValue () + XmlValue (const std::string &v) + XmlValue (const char *v) + XmlValue (double v) + XmlValue (bool v) + XmlValue (XmlDocument &v) + XmlValue (DOM_NodeList &v) + XmlValue (Type type, const std::string &v) + virtual ~XmlValue () + XmlValue (const XmlValue &) + XmlValue & operator= (const XmlValue &) + ... +}; +</pre></h3> +<h1>Description</h1> +<p>An XmlValue is the value of a node in an XML document. +<p>The value types XmlValue::BOOLEAN, XmlValue::NUMBER, and +XmlValue::STRING are defined in the W3C XPath 1.0 specification. +This implementation adds the value types XmlValue::DOCUMENT, +XmlValue::NODELIST, and XmlValue::VARIABLE. +<p>The query context is passed though each of the XmlValue methods as the +value of an XmlValue object of type Variable is taken from the context. +If no context is provided and a lookup is performed then +XmlException::NO_VARIABLE_BINDING will be thrown. This exception is also +thrown if a context is provided, but a value is not bound to the +variable referred to in the XmlValue object. +<p><dl compact> +<p><dt>DOM_NodeList asNodeList (const XmlQueryContext *context) const<dd>Return the value as a NodeList. +<dt>XmlDocument asDocument (const XmlQueryContext *context) const<dd>Return the value as a Document. +<dt>XmlValue::Type getType (const XmlQueryContext *context) const<dd>Return the type of the value. +<dt>bool asBoolean (const XmlQueryContext *context) const<dd>Return the value as a Boolean. +<dt>bool equals (const XmlValue &v, const XmlQueryContext *context) const<dd>Compare two values for equality. +<dt>bool isBoolean (const XmlQueryContext *context) const<dd>Return if the value is a Boolean. +<dt>bool isDocument (const XmlQueryContext *context) const<dd>Return if the value is a Document. +<dt>bool isNull () const<dd>Return if the value has no value. +<dt>bool isNumber (const XmlQueryContext *context) const<dd>Return if the value is a Number. +<dt>bool isString (const XmlQueryContext *context) const<dd>Return if the value is a String. +<dt>bool isVariable (const XmlQueryContext *context) const<dd>Return if the value is a Variable. +<dt>double asNumber (const XmlQueryContext *context) const<dd>Return the value as a Number. +<dt>isNodeList (const XmlQueryContext *context) const<dd>Return if the value is a NodeList. +<dt>std::string asString (const XmlQueryContext *context) const<dd>Return the value as a String. +</dl> +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlxpathexp_class.html b/db/docs/api_cxx/xmlxpathexp_class.html new file mode 100644 index 000000000..c8f528d9b --- /dev/null +++ b/db/docs/api_cxx/xmlxpathexp_class.html @@ -0,0 +1,67 @@ +<!--Id: xmlxpathexp_class.so,v 1.3 2002/07/29 04:20:28 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XPathExpression</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XPathExpression</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +class DbXml::XPathExpression { +public: + XPathExpression () + virtual ~XPathExpression () + XPathExpression (const XPathExpression &) + XPathExpression & operator= (const XPathExpression &) + ... +}; +</pre></h3> +<h1>Description</h1> +<p>An XPathExpression represents a parsed XPath expression. They +are created with <a href="../api_cxx/xml_xparse.html">XmlContainer::parseXPathExpression</a> and evaluated with <a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p>Parsed XPath expressions are useful as the cost of the expression +parsing and optimization can be amortized over many evaluations. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_cxx/xmlxpe_get.html b/db/docs/api_cxx/xmlxpe_get.html new file mode 100644 index 000000000..7c8d5c989 --- /dev/null +++ b/db/docs/api_cxx/xmlxpe_get.html @@ -0,0 +1,65 @@ +<!--Id: xmlxpe_get.so,v 10.1 2002/06/25 17:17:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XPathExpression::getXPathQuery</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XPathExpression::getXPathQuery</h1> +</td> +<td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +#include <DbXml.hpp> +<p> +std::string +XPathExpression::getXPathQuery() const +</pre></h3> +<h1>Description</h1> +<p>The XPathExpression::getXPathQuery method returns the Xpath query as a string. +<p>The XPathExpression::getXPathQuery method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XPathExpression::getXPathQuery method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XPathExpression::getXPathQuery method may fail and +throw a <a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_cxx/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_cxx/xmldocument_class.html">XmlDocument</a>, <a href="../api_cxx/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_cxx/xml_close.html">XmlContainer::close</a>, +<a href="../api_cxx/xml_declare.html">XmlContainer::declareIndex</a>, +<a href="../api_cxx/xml_del.html">XmlContainer::deleteDocument</a>, +<a href="../api_cxx/xml_get.html">XmlContainer::getDocument</a>, +<a href="../api_cxx/xml_getname.html">XmlContainer::getName</a>, +<a href="../api_cxx/xml_open.html">XmlContainer::open</a>, +<a href="../api_cxx/xml_put.html">XmlContainer::putDocument</a> +and +<a href="../api_cxx/xml_xpath.html">XmlContainer::queryWithXPath</a>. +<p> +<a href="../api_cxx/xmldoc_getattr.html">XmlDocument::getAttributeValue</a>, +<a href="../api_cxx/xmldoc_getcont.html">XmlDocument::getContent</a>, +<a href="../api_cxx/xmldoc_getid.html">XmlDocument::getID</a>, +<a href="../api_cxx/xmldoc_getname.html">XmlDocument::getName</a>, +<a href="../api_cxx/xmldoc_gettype.html">XmlDocument::getType</a>, +<a href="../api_cxx/xmldoc_setcont.html">XmlDocument::setContent</a>, +<a href="../api_cxx/xmldoc_setname.html">XmlDocument::setName</a>, +and +<a href="../api_cxx/xmldoc_settype.html">XmlDocument::setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/db_err.html b/db/docs/api_java/db_err.html new file mode 100644 index 000000000..4bbbd7143 --- /dev/null +++ b/db/docs/api_java/db_err.html @@ -0,0 +1,113 @@ +<!--Id: db_err.so,v 1.2 2002/06/24 14:49:05 bostic Exp --> +<!--Id: env_err.so,v 10.20 2002/06/24 14:49:16 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Db.err</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>Db.err</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public void err(int errcode, String message) +<p> +public void errx(String message) +</pre></h3> +<h1>Description</h1> +<p>The <a href="../api_java/env_err.html">DbEnv.err</a>, <a href="../api_java/env_err.html">DbEnv.errx</a>, Db.err and +Db.errx methods provide error-messaging functionality for +applications written using the Berkeley DB library. +<p>The <a href="../api_java/env_err.html">DbEnv.err</a> method constructs an error message consisting of the +following elements: +<p><blockquote><p><dl compact> +<p><dt>An optional prefix string<dd>If no error callback method has been set using the +<a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a> method, any prefix string specified using the +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a> method, followed by two separating characters: a colon +and a <space> character. +<p><dt>The supplied message string <b>message</b>.<dd> +<p><dt>A separator<dd>Two separating characters: a colon and a <space> character. +<p><dt>A standard error string<dd>The standard system or Berkeley DB library error string associated with the +<b>error</b> value, as returned by the <a href="../api_java/env_strerror.html">DbEnv.strerror</a> method. +</dl> +</blockquote> +<p>This constructed error message is then handled as follows: +<p><blockquote> +<p>If an error callback method has been set (see <a href="../api_java/db_set_errcall.html">Db.set_errcall</a> +and <a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a>), that method is called with two +arguments: any prefix string specified (see <a href="../api_java/db_set_errpfx.html">Db.set_errpfx</a> and +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a>) and the error message. +<p>If a OutputStream has been set +(see <a href="../api_java/env_set_error_stream.html">DbEnv.set_error_stream</a>), the error message is written to that +stream. +<p>If none of these output options has been configured, the error message +is written to System.err, the standard +error output stream.</blockquote> +<p>The <a href="../api_java/env_err.html">DbEnv.errx</a> and Db.errx methods perform identically to the +<a href="../api_java/env_err.html">DbEnv.err</a> and Db.err methods, except that they do not append +the final separator characters and standard error string to the error +message. +<h1>Class</h1> +<a href="../api_java/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_java/db_associate.html">Db.associate</a>, +<a href="../api_java/db_close.html">Db.close</a>, +<a href="../api_java/db_cursor.html">Db.cursor</a>, +<a href="../api_java/db_del.html">Db.del</a>, +<a href="../api_java/db_err.html">Db.err</a>, +<a href="../api_java/db_err.html">Db.errx</a>, +<a href="../api_java/db_fd.html">Db.fd</a>, +<a href="../api_java/db_get.html">Db.get</a>, +<a href="../api_java/db_get_byteswapped.html">Db.get_byteswapped</a>, +<a href="../api_java/db_get_type.html">Db.get_type</a>, +<a href="../api_java/db_join.html">Db.join</a>, +<a href="../api_java/db_key_range.html">Db.key_range</a>, +<a href="../api_java/db_open.html">Db.open</a>, +<a href="../api_java/db_get.html">Db.pget</a>, +<a href="../api_java/db_put.html">Db.put</a>, +<a href="../api_java/db_remove.html">Db.remove</a>, +<a href="../api_java/db_rename.html">Db.rename</a>, +<a href="../api_java/db_set_append_recno.html">Db.set_append_recno</a>, +<a href="../api_java/db_set_bt_minkey.html">Db.set_bt_minkey</a>, +<a href="../api_java/db_set_cache_priority.html">Db.set_cache_priority</a>, +<a href="../api_java/db_set_cachesize.html">Db.set_cachesize</a>, +<a href="../api_java/db_set_encrypt.html">Db.set_encrypt</a>, +<a href="../api_java/db_set_errcall.html">Db.set_errcall</a>, +<a href="../api_java/db_set_errpfx.html">Db.set_errpfx</a>, +<a href="../api_java/db_set_feedback.html">Db.set_feedback</a>, +<a href="../api_java/db_set_flags.html">Db.set_flags</a>, +<a href="../api_java/db_set_h_ffactor.html">Db.set_h_ffactor</a>, +<a href="../api_java/db_set_h_nelem.html">Db.set_h_nelem</a>, +<a href="../api_java/db_set_lorder.html">Db.set_lorder</a>, +<a href="../api_java/db_set_pagesize.html">Db.set_pagesize</a>, +<a href="../api_java/db_set_q_extentsize.html">Db.set_q_extentsize</a>, +<a href="../api_java/db_set_re_delim.html">Db.set_re_delim</a>, +<a href="../api_java/db_set_re_len.html">Db.set_re_len</a>, +<a href="../api_java/db_set_re_pad.html">Db.set_re_pad</a>, +<a href="../api_java/db_set_re_source.html">Db.set_re_source</a>, +<a href="../api_java/db_stat.html">Db.stat</a>, +<a href="../api_java/db_sync.html">Db.sync</a>, +<a href="../api_java/db_truncate.html">Db.truncate</a>, +<a href="../api_java/db_upgrade.html">Db.upgrade</a> +and +<a href="../api_java/db_verify.html">Db.verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/db_set_cache_priority.html b/db/docs/api_java/db_set_cache_priority.html new file mode 100644 index 000000000..4915b958f --- /dev/null +++ b/db/docs/api_java/db_set_cache_priority.html @@ -0,0 +1,105 @@ +<!--Id: db_set_cache_priority.so,v 10.3 2002/06/24 14:49:09 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Db.set_cache_priority</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>Db.set_cache_priority</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public void set_cache_priority(int priority) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>Set the cache priority for pages from the specified database. The +priority of a page biases the replacement algorithm to be more or less +likely to discard a page when space is needed in the buffer pool. The +bias is temporary, and pages will eventually be discarded if they are +not referenced again. The Db.set_cache_priority interface is +only advisory, and does not guarantee pages will be treated in a specific +way. +<p>The <b>priority</b> argument must be set to one of the following values: +<p><dl compact> +<p><dt><a name="Db.DB_PRIORITY_VERY_LOW">Db.DB_PRIORITY_VERY_LOW</a><dd>The lowest priority: pages are the most likely to be discarded. +<dt><a name="Db.DB_PRIORITY_LOW">Db.DB_PRIORITY_LOW</a><dd>The next lowest priority. +<dt><a name="Db.DB_PRIORITY_DEFAULT">Db.DB_PRIORITY_DEFAULT</a><dd>The default priority. +<dt><a name="Db.DB_PRIORITY_HIGH">Db.DB_PRIORITY_HIGH</a><dd>The next highest priority. +<dt><a name="Db.DB_PRIORITY_VERY_HIGH">Db.DB_PRIORITY_VERY_HIGH</a><dd>The highest priority: pages are the least likely to be discarded. +</dl> +<p>The Db.set_cache_priority method configures a database, not only operations performed +using the specified <a href="../api_java/db_class.html">Db</a> handle. +<p>The Db.set_cache_priority interface may be called at any time during the life of +the application. +<p>The Db.set_cache_priority method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The Db.set_cache_priority method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the Db.set_cache_priority method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_java/db_associate.html">Db.associate</a>, +<a href="../api_java/db_close.html">Db.close</a>, +<a href="../api_java/db_cursor.html">Db.cursor</a>, +<a href="../api_java/db_del.html">Db.del</a>, +<a href="../api_java/db_err.html">Db.err</a>, +<a href="../api_java/db_err.html">Db.errx</a>, +<a href="../api_java/db_fd.html">Db.fd</a>, +<a href="../api_java/db_get.html">Db.get</a>, +<a href="../api_java/db_get_byteswapped.html">Db.get_byteswapped</a>, +<a href="../api_java/db_get_type.html">Db.get_type</a>, +<a href="../api_java/db_join.html">Db.join</a>, +<a href="../api_java/db_key_range.html">Db.key_range</a>, +<a href="../api_java/db_open.html">Db.open</a>, +<a href="../api_java/db_get.html">Db.pget</a>, +<a href="../api_java/db_put.html">Db.put</a>, +<a href="../api_java/db_remove.html">Db.remove</a>, +<a href="../api_java/db_rename.html">Db.rename</a>, +<a href="../api_java/db_set_append_recno.html">Db.set_append_recno</a>, +<a href="../api_java/db_set_bt_minkey.html">Db.set_bt_minkey</a>, +<a href="../api_java/db_set_cache_priority.html">Db.set_cache_priority</a>, +<a href="../api_java/db_set_cachesize.html">Db.set_cachesize</a>, +<a href="../api_java/db_set_encrypt.html">Db.set_encrypt</a>, +<a href="../api_java/db_set_errcall.html">Db.set_errcall</a>, +<a href="../api_java/db_set_errpfx.html">Db.set_errpfx</a>, +<a href="../api_java/db_set_feedback.html">Db.set_feedback</a>, +<a href="../api_java/db_set_flags.html">Db.set_flags</a>, +<a href="../api_java/db_set_h_ffactor.html">Db.set_h_ffactor</a>, +<a href="../api_java/db_set_h_nelem.html">Db.set_h_nelem</a>, +<a href="../api_java/db_set_lorder.html">Db.set_lorder</a>, +<a href="../api_java/db_set_pagesize.html">Db.set_pagesize</a>, +<a href="../api_java/db_set_q_extentsize.html">Db.set_q_extentsize</a>, +<a href="../api_java/db_set_re_delim.html">Db.set_re_delim</a>, +<a href="../api_java/db_set_re_len.html">Db.set_re_len</a>, +<a href="../api_java/db_set_re_pad.html">Db.set_re_pad</a>, +<a href="../api_java/db_set_re_source.html">Db.set_re_source</a>, +<a href="../api_java/db_stat.html">Db.stat</a>, +<a href="../api_java/db_sync.html">Db.sync</a>, +<a href="../api_java/db_truncate.html">Db.truncate</a>, +<a href="../api_java/db_upgrade.html">Db.upgrade</a> +and +<a href="../api_java/db_verify.html">Db.verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/db_set_encrypt.html b/db/docs/api_java/db_set_encrypt.html new file mode 100644 index 000000000..46cca0da1 --- /dev/null +++ b/db/docs/api_java/db_set_encrypt.html @@ -0,0 +1,108 @@ +<!--Id: db_set_encrypt.so,v 10.2 2002/06/24 14:49:10 bostic Exp --> +<!--Id: env_set_encrypt.so,v 10.3 2002/06/24 14:49:18 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Db.set_encrypt</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>Db.set_encrypt</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public void set_encrypt(String passwd, int flags) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>Set the password used by the <a href="../api_java/dbenv_class.html">DbEnv</a> and <a href="../api_java/db_class.html">Db</a> methods to +perform encryption and decryption. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_ENCRYPT_AES">Db.DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard +and Federal Information Processing Standard (FIPS) 197) algorithm for +encryption or decryption. +</dl> +<p>Because databases opened within Berkeley DB environments use the password +specified to the environment, it is an error to attempt to set a +password in a database created within an environment. +<p>The Db.set_encrypt interface may not be called after the <a href="../api_java/db_open.html">Db.open</a> +interface is called. +<p>The Db.set_encrypt method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The Db.set_encrypt method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after +<a href="../api_java/db_open.html">Db.open</a> +was called. +</dl> +<p>The Db.set_encrypt method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the Db.set_encrypt method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_java/db_associate.html">Db.associate</a>, +<a href="../api_java/db_close.html">Db.close</a>, +<a href="../api_java/db_cursor.html">Db.cursor</a>, +<a href="../api_java/db_del.html">Db.del</a>, +<a href="../api_java/db_err.html">Db.err</a>, +<a href="../api_java/db_err.html">Db.errx</a>, +<a href="../api_java/db_fd.html">Db.fd</a>, +<a href="../api_java/db_get.html">Db.get</a>, +<a href="../api_java/db_get_byteswapped.html">Db.get_byteswapped</a>, +<a href="../api_java/db_get_type.html">Db.get_type</a>, +<a href="../api_java/db_join.html">Db.join</a>, +<a href="../api_java/db_key_range.html">Db.key_range</a>, +<a href="../api_java/db_open.html">Db.open</a>, +<a href="../api_java/db_get.html">Db.pget</a>, +<a href="../api_java/db_put.html">Db.put</a>, +<a href="../api_java/db_remove.html">Db.remove</a>, +<a href="../api_java/db_rename.html">Db.rename</a>, +<a href="../api_java/db_set_append_recno.html">Db.set_append_recno</a>, +<a href="../api_java/db_set_bt_minkey.html">Db.set_bt_minkey</a>, +<a href="../api_java/db_set_cache_priority.html">Db.set_cache_priority</a>, +<a href="../api_java/db_set_cachesize.html">Db.set_cachesize</a>, +<a href="../api_java/db_set_encrypt.html">Db.set_encrypt</a>, +<a href="../api_java/db_set_errcall.html">Db.set_errcall</a>, +<a href="../api_java/db_set_errpfx.html">Db.set_errpfx</a>, +<a href="../api_java/db_set_feedback.html">Db.set_feedback</a>, +<a href="../api_java/db_set_flags.html">Db.set_flags</a>, +<a href="../api_java/db_set_h_ffactor.html">Db.set_h_ffactor</a>, +<a href="../api_java/db_set_h_nelem.html">Db.set_h_nelem</a>, +<a href="../api_java/db_set_lorder.html">Db.set_lorder</a>, +<a href="../api_java/db_set_pagesize.html">Db.set_pagesize</a>, +<a href="../api_java/db_set_q_extentsize.html">Db.set_q_extentsize</a>, +<a href="../api_java/db_set_re_delim.html">Db.set_re_delim</a>, +<a href="../api_java/db_set_re_len.html">Db.set_re_len</a>, +<a href="../api_java/db_set_re_pad.html">Db.set_re_pad</a>, +<a href="../api_java/db_set_re_source.html">Db.set_re_source</a>, +<a href="../api_java/db_stat.html">Db.stat</a>, +<a href="../api_java/db_sync.html">Db.sync</a>, +<a href="../api_java/db_truncate.html">Db.truncate</a>, +<a href="../api_java/db_upgrade.html">Db.upgrade</a> +and +<a href="../api_java/db_verify.html">Db.verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/env_dbremove.html b/db/docs/api_java/env_dbremove.html new file mode 100644 index 000000000..3acf714ca --- /dev/null +++ b/db/docs/api_java/env_dbremove.html @@ -0,0 +1,121 @@ +<!--Id: env_dbremove.so,v 10.31 2002/08/02 18:41:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.dbremove</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.dbremove</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +import java.io.FileNotFoundException; +<p> +public void dbremove(DbTxn txnid, String file, String database, int flags) + throws DbException, FileNotFoundException; +</pre></h3> +<h1>Description</h1> +<p>The DbEnv.dbremove method removes the database specified by the +<b>file</b> and <b>database</b> arguments. If no <b>database</b> is +specified, the underlying file represented by <b>file</b> is removed, +incidentally removing all databases that it contained. +<p>Applications should never remove databases with open <a href="../api_java/db_class.html">Db</a> handles, +or in the case of removing a file, when any database in the file has an +open handle. For example, some architectures do not permit the removal +of files with open system handles. On these architectures, attempts to +remove databases currently in use by any thread of control in the system +will fail. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; +otherwise, null. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_AUTO_COMMIT">Db.DB_AUTO_COMMIT</a><dd>Enclose the DbEnv.dbremove call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The DbEnv.dbremove method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>The +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>DbEnv.dbremove is affected by any database directory specified using the +<a href="../api_java/env_set_data_dir.html">DbEnv.set_data_dir</a> method, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<h1>Errors</h1> +<p>The DbEnv.dbremove method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>A database in the file is currently open. +<p>Called before <a href="../api_java/env_open.html">DbEnv.open</a> was called. +</dl> +<p>If the file or directory does not exist, the DbEnv.dbremove method will +fail and +throw a FileNotFoundException exception. +<p>The DbEnv.dbremove method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv.dbremove method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/dbenv_class.html">DbEnv</a> +<h1>See Also</h1> +<a href="../api_java/env_close.html">DbEnv.close</a>, +<a href="../api_java/env_dbremove.html">DbEnv.dbremove</a>, +<a href="../api_java/env_dbrename.html">DbEnv.dbrename</a>, +<a href="../api_java/env_err.html">DbEnv.err</a>, +<a href="../api_java/env_err.html">DbEnv.errx</a>, +<a href="../api_java/env_version.html">DbEnv.get_version_string</a>, +<a href="../api_java/env_open.html">DbEnv.open</a>, +<a href="../api_java/env_remove.html">DbEnv.remove</a>, +<a href="../api_java/env_set_app_dispatch.html">DbEnv.set_app_dispatch</a>, +<a href="../api_java/env_set_cachesize.html">DbEnv.set_cachesize</a>, +<a href="../api_java/env_set_data_dir.html">DbEnv.set_data_dir</a>, +<a href="../api_java/env_set_encrypt.html">DbEnv.set_encrypt</a>, +<a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a>, +<a href="../api_java/env_set_error_stream.html">DbEnv.set_error_stream</a>, +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a>, +<a href="../api_java/env_set_feedback.html">DbEnv.set_feedback</a>, +<a href="../api_java/env_set_flags.html">DbEnv.set_flags</a>, +<a href="../api_java/env_set_lg_bsize.html">DbEnv.set_lg_bsize</a>, +<a href="../api_java/env_set_lg_dir.html">DbEnv.set_lg_dir</a>, +<a href="../api_java/env_set_lg_max.html">DbEnv.set_lg_max</a>, +<a href="../api_java/env_set_lg_regionmax.html">DbEnv.set_lg_regionmax</a>, +<a href="../api_java/env_set_lk_conflicts.html">DbEnv.set_lk_conflicts</a>, +<a href="../api_java/env_set_lk_detect.html">DbEnv.set_lk_detect</a>, +<a href="../api_java/env_set_lk_max_lockers.html">DbEnv.set_lk_max_lockers</a>, +<a href="../api_java/env_set_lk_max_locks.html">DbEnv.set_lk_max_locks</a>, +<a href="../api_java/env_set_lk_max_objects.html">DbEnv.set_lk_max_objects</a>, +<a href="../api_java/env_set_mp_mmapsize.html">DbEnv.set_mp_mmapsize</a>, +<a href="../api_java/env_set_rpc_server.html">DbEnv.set_rpc_server</a>, +<a href="../api_java/env_set_shm_key.html">DbEnv.set_shm_key</a>, +<a href="../api_java/env_set_tas_spins.html">DbEnv.set_tas_spins</a>, +<a href="../api_java/env_set_timeout.html">DbEnv.set_timeout</a>, +<a href="../api_java/env_set_tmp_dir.html">DbEnv.set_tmp_dir</a>, +<a href="../api_java/env_set_tx_max.html">DbEnv.set_tx_max</a>, +<a href="../api_java/env_set_tx_timestamp.html">DbEnv.set_tx_timestamp</a>, +<a href="../api_java/env_set_verbose.html">DbEnv.set_verbose</a> +and +<a href="../api_java/env_strerror.html">DbEnv.strerror</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/env_dbrename.html b/db/docs/api_java/env_dbrename.html new file mode 100644 index 000000000..a36578679 --- /dev/null +++ b/db/docs/api_java/env_dbrename.html @@ -0,0 +1,128 @@ +<!--Id: env_dbrename.so,v 10.17 2002/08/02 18:41:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.dbrename</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.dbrename</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +import java.io.FileNotFoundException; +<p> +public void dbrename(DbTxn txnid, + String file, String database, String newname, int flags) + throws DbException, FileNotFoundException; +</pre></h3> +<h1>Description</h1> +<p>The DbEnv.dbrename method renames the database specified by the +<b>file</b> and <b>database</b> arguments to <b>newname</b>. If no +<b>database</b> is specified, the underlying file represented by +<b>file</b> is renamed, incidentally renaming all databases that it +contained. +<p>Applications should not rename databases that are currently in use. If +an underlying file is being renamed and logging is currently enabled in +the database environment, no database in the file may be open when the +DbEnv.dbrename method is called. In particular, some architectures do +not permit renaming files with open handles. On these architectures, +attempts to rename databases that are currently in use by any thread of +control in the system will fail. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; +otherwise, null. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_AUTO_COMMIT">Db.DB_AUTO_COMMIT</a><dd>Enclose the DbEnv.dbrename call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The DbEnv.dbrename method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>The +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>DbEnv.dbrename is affected by any database directory specified using the +<a href="../api_java/env_set_data_dir.html">DbEnv.set_data_dir</a> method, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<h1>Errors</h1> +<p>The DbEnv.dbrename method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>A database in the file is currently open. +<p>Called before <a href="../api_java/env_open.html">DbEnv.open</a> was called. +</dl> +<p>If the file or directory does not exist, the DbEnv.dbrename method will +fail and +throw a FileNotFoundException exception. +<p>The DbEnv.dbrename method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv.dbrename method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/db_class.html">Db</a> +<h1>See Also</h1> +<a href="../api_java/db_associate.html">Db.associate</a>, +<a href="../api_java/db_close.html">Db.close</a>, +<a href="../api_java/db_cursor.html">Db.cursor</a>, +<a href="../api_java/db_del.html">Db.del</a>, +<a href="../api_java/db_err.html">Db.err</a>, +<a href="../api_java/db_err.html">Db.errx</a>, +<a href="../api_java/db_fd.html">Db.fd</a>, +<a href="../api_java/db_get.html">Db.get</a>, +<a href="../api_java/db_get_byteswapped.html">Db.get_byteswapped</a>, +<a href="../api_java/db_get_type.html">Db.get_type</a>, +<a href="../api_java/db_join.html">Db.join</a>, +<a href="../api_java/db_key_range.html">Db.key_range</a>, +<a href="../api_java/db_open.html">Db.open</a>, +<a href="../api_java/db_get.html">Db.pget</a>, +<a href="../api_java/db_put.html">Db.put</a>, +<a href="../api_java/db_remove.html">Db.remove</a>, +<a href="../api_java/db_rename.html">Db.rename</a>, +<a href="../api_java/db_set_append_recno.html">Db.set_append_recno</a>, +<a href="../api_java/db_set_bt_minkey.html">Db.set_bt_minkey</a>, +<a href="../api_java/db_set_cache_priority.html">Db.set_cache_priority</a>, +<a href="../api_java/db_set_cachesize.html">Db.set_cachesize</a>, +<a href="../api_java/db_set_encrypt.html">Db.set_encrypt</a>, +<a href="../api_java/db_set_errcall.html">Db.set_errcall</a>, +<a href="../api_java/db_set_errpfx.html">Db.set_errpfx</a>, +<a href="../api_java/db_set_feedback.html">Db.set_feedback</a>, +<a href="../api_java/db_set_flags.html">Db.set_flags</a>, +<a href="../api_java/db_set_h_ffactor.html">Db.set_h_ffactor</a>, +<a href="../api_java/db_set_h_nelem.html">Db.set_h_nelem</a>, +<a href="../api_java/db_set_lorder.html">Db.set_lorder</a>, +<a href="../api_java/db_set_pagesize.html">Db.set_pagesize</a>, +<a href="../api_java/db_set_q_extentsize.html">Db.set_q_extentsize</a>, +<a href="../api_java/db_set_re_delim.html">Db.set_re_delim</a>, +<a href="../api_java/db_set_re_len.html">Db.set_re_len</a>, +<a href="../api_java/db_set_re_pad.html">Db.set_re_pad</a>, +<a href="../api_java/db_set_re_source.html">Db.set_re_source</a>, +<a href="../api_java/db_stat.html">Db.stat</a>, +<a href="../api_java/db_sync.html">Db.sync</a>, +<a href="../api_java/db_truncate.html">Db.truncate</a>, +<a href="../api_java/db_upgrade.html">Db.upgrade</a> +and +<a href="../api_java/db_verify.html">Db.verify</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/env_err.html b/db/docs/api_java/env_err.html new file mode 100644 index 000000000..edd37b47e --- /dev/null +++ b/db/docs/api_java/env_err.html @@ -0,0 +1,108 @@ +<!--Id: env_err.so,v 10.20 2002/06/24 14:49:16 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.err</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.err</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public void err(int errcode, String message) +<p> +public void errx(String message) +</pre></h3> +<h1>Description</h1> +<p>The DbEnv.err, DbEnv.errx, <a href="../api_java/db_err.html">Db.err</a> and +<a href="../api_java/db_err.html">Db.errx</a> methods provide error-messaging functionality for +applications written using the Berkeley DB library. +<p>The DbEnv.err method constructs an error message consisting of the +following elements: +<p><blockquote><p><dl compact> +<p><dt>An optional prefix string<dd>If no error callback method has been set using the +<a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a> method, any prefix string specified using the +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a> method, followed by two separating characters: a colon +and a <space> character. +<p><dt>The supplied message string <b>message</b>.<dd> +<p><dt>A separator<dd>Two separating characters: a colon and a <space> character. +<p><dt>A standard error string<dd>The standard system or Berkeley DB library error string associated with the +<b>error</b> value, as returned by the <a href="../api_java/env_strerror.html">DbEnv.strerror</a> method. +</dl> +</blockquote> +<p>This constructed error message is then handled as follows: +<p><blockquote> +<p>If an error callback method has been set (see <a href="../api_java/db_set_errcall.html">Db.set_errcall</a> +and <a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a>), that method is called with two +arguments: any prefix string specified (see <a href="../api_java/db_set_errpfx.html">Db.set_errpfx</a> and +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a>) and the error message. +<p>If a OutputStream has been set +(see <a href="../api_java/env_set_error_stream.html">DbEnv.set_error_stream</a>), the error message is written to that +stream. +<p>If none of these output options has been configured, the error message +is written to System.err, the standard +error output stream.</blockquote> +<p>The DbEnv.errx and <a href="../api_java/db_err.html">Db.errx</a> methods perform identically to the +DbEnv.err and <a href="../api_java/db_err.html">Db.err</a> methods, except that they do not append +the final separator characters and standard error string to the error +message. +<h1>Class</h1> +<a href="../api_java/dbenv_class.html">DbEnv</a> +<h1>See Also</h1> +<a href="../api_java/env_close.html">DbEnv.close</a>, +<a href="../api_java/env_dbremove.html">DbEnv.dbremove</a>, +<a href="../api_java/env_dbrename.html">DbEnv.dbrename</a>, +<a href="../api_java/env_err.html">DbEnv.err</a>, +<a href="../api_java/env_err.html">DbEnv.errx</a>, +<a href="../api_java/env_version.html">DbEnv.get_version_string</a>, +<a href="../api_java/env_open.html">DbEnv.open</a>, +<a href="../api_java/env_remove.html">DbEnv.remove</a>, +<a href="../api_java/env_set_app_dispatch.html">DbEnv.set_app_dispatch</a>, +<a href="../api_java/env_set_cachesize.html">DbEnv.set_cachesize</a>, +<a href="../api_java/env_set_data_dir.html">DbEnv.set_data_dir</a>, +<a href="../api_java/env_set_encrypt.html">DbEnv.set_encrypt</a>, +<a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a>, +<a href="../api_java/env_set_error_stream.html">DbEnv.set_error_stream</a>, +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a>, +<a href="../api_java/env_set_feedback.html">DbEnv.set_feedback</a>, +<a href="../api_java/env_set_flags.html">DbEnv.set_flags</a>, +<a href="../api_java/env_set_lg_bsize.html">DbEnv.set_lg_bsize</a>, +<a href="../api_java/env_set_lg_dir.html">DbEnv.set_lg_dir</a>, +<a href="../api_java/env_set_lg_max.html">DbEnv.set_lg_max</a>, +<a href="../api_java/env_set_lg_regionmax.html">DbEnv.set_lg_regionmax</a>, +<a href="../api_java/env_set_lk_conflicts.html">DbEnv.set_lk_conflicts</a>, +<a href="../api_java/env_set_lk_detect.html">DbEnv.set_lk_detect</a>, +<a href="../api_java/env_set_lk_max_lockers.html">DbEnv.set_lk_max_lockers</a>, +<a href="../api_java/env_set_lk_max_locks.html">DbEnv.set_lk_max_locks</a>, +<a href="../api_java/env_set_lk_max_objects.html">DbEnv.set_lk_max_objects</a>, +<a href="../api_java/env_set_mp_mmapsize.html">DbEnv.set_mp_mmapsize</a>, +<a href="../api_java/env_set_rpc_server.html">DbEnv.set_rpc_server</a>, +<a href="../api_java/env_set_shm_key.html">DbEnv.set_shm_key</a>, +<a href="../api_java/env_set_tas_spins.html">DbEnv.set_tas_spins</a>, +<a href="../api_java/env_set_timeout.html">DbEnv.set_timeout</a>, +<a href="../api_java/env_set_tmp_dir.html">DbEnv.set_tmp_dir</a>, +<a href="../api_java/env_set_tx_max.html">DbEnv.set_tx_max</a>, +<a href="../api_java/env_set_tx_timestamp.html">DbEnv.set_tx_timestamp</a>, +<a href="../api_java/env_set_verbose.html">DbEnv.set_verbose</a> +and +<a href="../api_java/env_strerror.html">DbEnv.strerror</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/env_set_app_dispatch.html b/db/docs/api_java/env_set_app_dispatch.html new file mode 100644 index 000000000..8bf96d1d0 --- /dev/null +++ b/db/docs/api_java/env_set_app_dispatch.html @@ -0,0 +1,117 @@ +<!--Id: env_set_app_dispatch.so,v 10.36 2002/06/24 14:49:17 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.set_app_dispatch</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.set_app_dispatch</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public interface DbTxnRecover +{ + public abstract int + tx_recover(DbEnv dbenv, Dbt log_rec, DbLsn lsn, int op); +} +public class DbEnv +{ + public void set_app_dispatch(DbTxnRecover tx_recover) + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>Set the application's method to be called during transaction abort +and recovery. This method must return 0 on success and either +<b>errno</b> or a value outside of the Berkeley DB error name space on +failure. It takes four arguments: +<p><dl compact> +<p><dt>dbenv <dd>A Berkeley DB environment. +<p><dt>log_rec<dd>A log record. +<p><dt>lsn<dd>A log sequence number. +<p><dt>op<dd>One of the following values: +<p><dl compact> +<p><dt><a name="Db.DB_TXN_BACKWARD_ROLL">Db.DB_TXN_BACKWARD_ROLL</a><dd>The log is being read backward to determine which transactions have been +committed and to abort those operations that were not; undo the operation +described by the log record. +<p><dt><a name="Db.DB_TXN_FORWARD_ROLL">Db.DB_TXN_FORWARD_ROLL</a><dd>The log is being played forward; redo the operation described by the log +record. +<p><dt><a name="Db.DB_TXN_ABORT">Db.DB_TXN_ABORT</a><dd>The log is being read backward during a transaction abort; undo the +operation described by the log record. +<p><dt><a name="Db.DB_TXN_APPLY">Db.DB_TXN_APPLY</a><dd>The log is being applied on a replica site; redo the operation +described by the log record. +<p><dt><a name="Db.DB_TXN_PRINT">Db.DB_TXN_PRINT</a><dd>The log is being printed for debugging purposes; print the contents of +this log record in the desired format. +</dl> +</dl> +<p>The Db.DB_TXN_FORWARD_ROLL and Db.DB_TXN_APPLY operations +frequently imply the same actions, redoing changes that appear in the +log record, although if a recovery function is to be used on a +replication client where reads may be taking place concurrently with +the processing of incoming messages, Db.DB_TXN_APPLY operations +should also perform appropriate locking. The macro DB_REDO(op) checks +that the operation is one of Db.DB_TXN_FORWARD_ROLL or +Db.DB_TXN_APPLY, and should be used in the recovery code to refer +to the conditions under which operations should be redone. Similarly, +the macro DB_UNDO(op) checks if the operation is one of +Db.DB_TXN_BACKWARD_ROLL or Db.DB_TXN_ABORT. +<p>The DbEnv.set_app_dispatch method configures operations performed using the specified +<a href="../api_java/dbenv_class.html">DbEnv</a> handle, not all operations performed on the underlying +database environment. +<p>The DbEnv.set_app_dispatch interface may not be called after the <a href="../api_java/env_open.html">DbEnv.open</a> +interface is called. +If the database environment already exists when +<a href="../api_java/env_open.html">DbEnv.open</a> is called, the information specified to DbEnv.set_app_dispatch +must be consistent with the existing environment or corruption can +occur. +<p>The DbEnv.set_app_dispatch method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The DbEnv.set_app_dispatch method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after <a href="../api_java/env_open.html">DbEnv.open</a> was called. +</dl> +<p>The DbEnv.set_app_dispatch method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv.set_app_dispatch method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/dbenv_class.html">DbEnv</a>, <a href="../api_java/txn_class.html">DbTxn</a> +<h1>See Also</h1> +<a href="../api_java/env_set_tx_max.html">DbEnv.set_tx_max</a>, +<a href="../api_java/env_set_tx_timestamp.html">DbEnv.set_tx_timestamp</a>, +<a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>, +<a href="../api_java/txn_checkpoint.html">DbEnv.txn_checkpoint</a>, +<a href="../api_java/txn_recover.html">DbEnv.txn_recover</a> +and +<a href="../api_java/txn_stat.html">DbEnv.txn_stat</a>. +<p> +<a href="../api_java/txn_abort.html">DbTxn.abort</a>, +<a href="../api_java/txn_commit.html">DbTxn.commit</a>, +<a href="../api_java/txn_discard.html">DbTxn.discard</a>, +<a href="../api_java/txn_id.html">DbTxn.id</a>, +<a href="../api_java/txn_prepare.html">DbTxn.prepare</a> +and +<a href="../api_java/txn_set_timeout.html">DbTxn.set_timeout</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/env_set_encrypt.html b/db/docs/api_java/env_set_encrypt.html new file mode 100644 index 000000000..5a6ca0364 --- /dev/null +++ b/db/docs/api_java/env_set_encrypt.html @@ -0,0 +1,106 @@ +<!--Id: env_set_encrypt.so,v 10.3 2002/06/24 14:49:18 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.set_encrypt</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.set_encrypt</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public void set_encrypt(String passwd, int flags) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>Set the password used by the <a href="../api_java/dbenv_class.html">DbEnv</a> and <a href="../api_java/db_class.html">Db</a> methods to +perform encryption and decryption. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_ENCRYPT_AES">Db.DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard +and Federal Information Processing Standard (FIPS) 197) algorithm for +encryption or decryption. +</dl> +<p>The DbEnv.set_encrypt method configures a database environment, not only operations +performed using the specified <a href="../api_java/dbenv_class.html">DbEnv</a> handle. +<p>The DbEnv.set_encrypt interface may not be called after the <a href="../api_java/env_open.html">DbEnv.open</a> +interface is called. +If the database environment already exists when +<a href="../api_java/env_open.html">DbEnv.open</a> is called, the information specified to DbEnv.set_encrypt +must be consistent with the existing environment or an error will be +returned. +<p>The DbEnv.set_encrypt method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The DbEnv.set_encrypt method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>Called after +<a href="../api_java/env_open.html">DbEnv.open</a> +was called. +</dl> +<p>The DbEnv.set_encrypt method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv.set_encrypt method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/dbenv_class.html">DbEnv</a> +<h1>See Also</h1> +<a href="../api_java/env_close.html">DbEnv.close</a>, +<a href="../api_java/env_dbremove.html">DbEnv.dbremove</a>, +<a href="../api_java/env_dbrename.html">DbEnv.dbrename</a>, +<a href="../api_java/env_err.html">DbEnv.err</a>, +<a href="../api_java/env_err.html">DbEnv.errx</a>, +<a href="../api_java/env_version.html">DbEnv.get_version_string</a>, +<a href="../api_java/env_open.html">DbEnv.open</a>, +<a href="../api_java/env_remove.html">DbEnv.remove</a>, +<a href="../api_java/env_set_app_dispatch.html">DbEnv.set_app_dispatch</a>, +<a href="../api_java/env_set_cachesize.html">DbEnv.set_cachesize</a>, +<a href="../api_java/env_set_data_dir.html">DbEnv.set_data_dir</a>, +<a href="../api_java/env_set_encrypt.html">DbEnv.set_encrypt</a>, +<a href="../api_java/env_set_errcall.html">DbEnv.set_errcall</a>, +<a href="../api_java/env_set_error_stream.html">DbEnv.set_error_stream</a>, +<a href="../api_java/env_set_errpfx.html">DbEnv.set_errpfx</a>, +<a href="../api_java/env_set_feedback.html">DbEnv.set_feedback</a>, +<a href="../api_java/env_set_flags.html">DbEnv.set_flags</a>, +<a href="../api_java/env_set_lg_bsize.html">DbEnv.set_lg_bsize</a>, +<a href="../api_java/env_set_lg_dir.html">DbEnv.set_lg_dir</a>, +<a href="../api_java/env_set_lg_max.html">DbEnv.set_lg_max</a>, +<a href="../api_java/env_set_lg_regionmax.html">DbEnv.set_lg_regionmax</a>, +<a href="../api_java/env_set_lk_conflicts.html">DbEnv.set_lk_conflicts</a>, +<a href="../api_java/env_set_lk_detect.html">DbEnv.set_lk_detect</a>, +<a href="../api_java/env_set_lk_max_lockers.html">DbEnv.set_lk_max_lockers</a>, +<a href="../api_java/env_set_lk_max_locks.html">DbEnv.set_lk_max_locks</a>, +<a href="../api_java/env_set_lk_max_objects.html">DbEnv.set_lk_max_objects</a>, +<a href="../api_java/env_set_mp_mmapsize.html">DbEnv.set_mp_mmapsize</a>, +<a href="../api_java/env_set_rpc_server.html">DbEnv.set_rpc_server</a>, +<a href="../api_java/env_set_shm_key.html">DbEnv.set_shm_key</a>, +<a href="../api_java/env_set_tas_spins.html">DbEnv.set_tas_spins</a>, +<a href="../api_java/env_set_timeout.html">DbEnv.set_timeout</a>, +<a href="../api_java/env_set_tmp_dir.html">DbEnv.set_tmp_dir</a>, +<a href="../api_java/env_set_tx_max.html">DbEnv.set_tx_max</a>, +<a href="../api_java/env_set_tx_timestamp.html">DbEnv.set_tx_timestamp</a>, +<a href="../api_java/env_set_verbose.html">DbEnv.set_verbose</a> +and +<a href="../api_java/env_strerror.html">DbEnv.strerror</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/lockng_class.html b/db/docs/api_java/lockng_class.html new file mode 100644 index 000000000..ffa205800 --- /dev/null +++ b/db/docs/api_java/lockng_class.html @@ -0,0 +1,71 @@ +<!--Id: lockng_class.so,v 1.5 2002/07/29 04:27:14 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbLockNotGrantedException</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbLockNotGrantedException</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public class DbLockNotGrantedException extends DbException { + public int get_op(); + public int get_mode(); + public Dbt get_obj(); + public DbLock get_lock(); + public int get_index(); +} +</pre></h3> +<h1>Description</h1> +<p>This manual page describes the DbLockNotGrantedException class and +how it is used by the various Db* classes. +<p>A DbLockNotGrantedException is thrown when a lock, requested +using the <a href="../api_java/lock_get.html">DbEnv.lock_get</a> or <a href="../api_java/lock_vec.html">DbEnv.lock_vec</a> methods (where the +<a href="../api_java/lock_vec.html#DB_LOCK_NOWAIT">Db.DB_LOCK_NOWAIT</a> option was specified), or by any Db +operation performed in the context of a transaction begun using the +<a href="../api_java/txn_begin.html#DB_TXN_NOWAIT">Db.DB_TXN_NOWAIT</a> option, is unable to be granted immediately. +<p>The <b>get_op</b> method returns 0 when <a href="../api_java/lock_get.html">DbEnv.lock_get</a> was called, +and returns the <b>op</b> for the failed DbLockRequest when +<a href="../api_java/lock_vec.html">DbEnv.lock_vec</a> was called. +<p>The <b>get_mode</b> method returns the <b>mode</b> argument when +<a href="../api_java/lock_get.html">DbEnv.lock_get</a> was called, and returns the <b>mode</b> for the failed +DbLockRequest when <a href="../api_java/lock_vec.html">DbEnv.lock_vec</a> was called. +<p>The <b>get_obj</b> method returns the <b>obj</b> argument when +<a href="../api_java/lock_get.html">DbEnv.lock_get</a> was called, and returns the <b>obj</b> for the failed +DbLockRequest when <a href="../api_java/lock_vec.html">DbEnv.lock_vec</a> was called. +<p>The <b>get_lock</b> method returns null when <a href="../api_java/lock_get.html">DbEnv.lock_get</a> was +called, and returns the <b>lock</b> in the failed DbLockRequest +when <a href="../api_java/lock_vec.html">DbEnv.lock_vec</a> was called. +<p>The <b>get_index</b> method returns -1 when <a href="../api_java/lock_get.html">DbEnv.lock_get</a> was +called, and returns the index of the failed DbLockRequest +when <a href="../api_java/lock_vec.html">DbEnv.lock_vec</a> was called. +<h1>Class</h1> +<a href="../api_java/except_class.html">DbException</a> +<h1>See Also</h1> +<a href="../api_java/get_errno.html">DbException.get_errno</a>, +<a href="../api_java/deadlock_class.html">DbDeadlockException</a>, +<a href="../api_java/lockng_class.html">DbLockNotGrantedException</a> +<a href="../api_java/mem_class.html">DbMemoryException</a> +and +<a href="../api_java/runrec_class.html">DbRunRecoveryException</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/rep_limit.html b/db/docs/api_java/rep_limit.html new file mode 100644 index 000000000..46136a7c7 --- /dev/null +++ b/db/docs/api_java/rep_limit.html @@ -0,0 +1,62 @@ +<!--Id: rep_limit.so,v 1.2 2002/07/13 18:48:52 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.set_rep_limit</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.set_rep_limit</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public class DbEnv +{ + public int set_rep_limit(int gbytes, int bytes) + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>The DbEnv.set_rep_limit method imposes a limit on the amount of data that will +be transmitted from a site during the course of a single call to +<a href="../api_java/rep_message.html">DbEnv.rep_process_message</a> method. +<p>The <b>gbytes</b> and <b>bytes</b> parameters together represent the +maximum number of bytes that can be sent during a single call to +<a href="../api_java/rep_message.html">DbEnv.rep_process_message</a> method. +<p>The DbEnv.set_rep_limit method configures a database environment, not only operations +performed using the specified <a href="../api_java/dbenv_class.html">DbEnv</a> handle. +<p>The DbEnv.set_rep_limit interface may be called at any time during the life of +the application. +<p>The DbEnv.set_rep_limit method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The DbEnv.set_rep_limit method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv.set_rep_limit method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_java/rep_start.html">DbEnv.rep_start</a>, +<a href="../api_java/rep_elect.html">DbEnv.rep_elect</a>, +<a href="../api_java/rep_message.html">DbEnv.rep_process_message</a> +and +<a href="../api_java/rep_transport.html">DbEnv.set_rep_transport</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/rep_stat.html b/db/docs/api_java/rep_stat.html new file mode 100644 index 000000000..47e64c25d --- /dev/null +++ b/db/docs/api_java/rep_stat.html @@ -0,0 +1,101 @@ +<!--Id: rep_stat.so,v 10.7 2002/07/13 18:09:07 margo Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: DbEnv.rep_stat</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>DbEnv.rep_stat</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +<p> +public DbRepStat rep_stat(int flags) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>The DbEnv.rep_stat method returns the replication subsystem statistics. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_STAT_CLEAR">Db.DB_STAT_CLEAR</a><dd>Reset statistics after returning their values. +</dl> +<p>The DbEnv.rep_stat method creates a DbRepStat object encapsulating the +replication subsystem statistics. The following data fields are +available from the DbRepStat object: +<p><dl compact> +<dt>public int st_stat;<dd>The current replication mode. Set to <a href="../api_java/rep_start.html#DB_REP_MASTER">Db.DB_REP_MASTER</a> if the +environment is a replication master, <a href="../api_java/rep_start.html#DB_REP_CLIENT">Db.DB_REP_CLIENT</a> if the +environment is a replication client, <a href="../api_java/rep_start.html#DB_REP_LOGSONLY">Db.DB_REP_LOGSONLY</a> if the +environment is a log-files-only replica, or 0 if replication is not +configured. +<dt>public DbLsn st_next_lsn;<dd>In replication environments configured as masters, the next LSN expected. +In replication environments configured as clients, the next LSN to be used. +<dt>public DbLsn st_waiting_lsn;<dd>The LSN of the first missed log record being waited for, or 0 if no log +records are currently missing. +<dt>public int st_dupmasters;<dd>The number of duplicate master conditions detected. +<dt>public int st_env_id;<dd>The current environment ID. +<dt>public int st_env_priority;<dd>The current environment priority. +<dt>public int st_gen;<dd>The current generation number. +<dt>public int st_log_duplicated;<dd>The number of duplicate log records received. +<dt>public int st_log_queued;<dd>The number of log records currently queued. +<dt>public int st_log_queued_max;<dd>The maximum number of log records ever queued at once. +<dt>public int st_log_queued_total;<dd>The total number of log records queued. +<dt>public int st_log_records;<dd>The number of log records received and appended to the log. +<dt>public int st_log_requested;<dd>The number of log records missed and requested. +<dt>public int st_master;<dd>The current master environment ID. +<dt>public int st_master_changes;<dd>The number of times the master has changed. +<dt>public int st_msgs_badgen;<dd>The number of messages received with a bad generation number. +<dt>public int st_msgs_processed;<dd>The number of messages received and processed. +<dt>public int st_msgs_recover;<dd>The number of messages ignored due to pending recovery. +<dt>public int st_msgs_send_failures;<dd>The number of failed message sends. +<dt>public int st_msgs_sent;<dd>The number of messages sent. +<dt>public int st_newsites;<dd>The number of new site messages received. +<dt>public int st_outdated;<dd>The number of outdated conditions detected. +<dt>public int st_txns_applied;<dd>The number of transactions applied. +<dt>public int st_elections;<dd>The number of elections held. +<dt>public int st_elections_won;<dd>The number of elections won. +<dt>public int st_election_status;<dd>The current election phase (0 if no election is in progress). +<dt>public int st_election_cur_winner;<dd>The election winner. +<dt>public int st_election_gen;<dd>The election generation number. +<dt>public DbLsn st_election_lsn;<dd>The maximum LSN of election winner. +<dt>public int st_election_nsites;<dd>The number sites expected to participate in elections. +<dt>public int st_nthrottles;<dd>Transmission limited. This indicates the number of times that data +transmission was stopped to limit the amount of data sent in response +to a single call to <a href="../api_java/rep_message.html">DbEnv.rep_process_message</a>. +<dt>public int st_election_priority;<dd>The election priority. +<dt>public int st_election_tiebreaker;<dd>The election tiebreaker value. +<dt>public int st_election_votes;<dd>The votes received this election round. +</dl> +<p>The DbEnv.rep_stat method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The DbEnv.rep_stat method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the DbEnv.rep_stat method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>See Also</h1> +<a href="../api_java/rep_start.html">DbEnv.rep_start</a>, +<a href="../api_java/rep_elect.html">DbEnv.rep_elect</a>, +<a href="../api_java/rep_message.html">DbEnv.rep_process_message</a> +and +<a href="../api_java/rep_transport.html">DbEnv.set_rep_transport</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_close.html b/db/docs/api_java/xml_close.html new file mode 100644 index 000000000..f391866a0 --- /dev/null +++ b/db/docs/api_java/xml_close.html @@ -0,0 +1,86 @@ +<!--Id: xml_close.so,v 10.5 2002/07/30 16:57:43 merrells Exp --> +<!--Id: m4.db_close,v 10.1 2002/06/19 19:31:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.close</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.close</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void close(int flags) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.close method closes the specified container. +
+<p>The <a href="../api_java/xmlcontainer_class.html">XmlContainer</a> must be in the open state for the
+call to succeed. The container is only open after a successful
+call to the <a href="../api_java/xml_open.html">XmlContainer.open</a> method. Note that it is allowable
+to re-open a container after it has been closed. +
+<p><dl compact> +
+<p><dt><a name="Db.DB_NOSYNC">Db.DB_NOSYNC</a><dd>Do not flush cached information to disk. The <a href="../api_java/db_close.html#DB_NOSYNC">Db.DB_NOSYNC</a> flag is +a dangerous option. It should be set only if the application is doing +logging (with transactions) so that the database is recoverable after +a system or application crash, or if the database is always generated +from scratch after any system or application crash. +<p><b>It is important to understand that flushing cached information to disk +only minimizes the window of opportunity for corrupted data.</b> Although +unlikely, it is possible for database corruption to happen if a system +or application crash occurs while writing data to the database. To +ensure that database corruption never occurs, applications must either: +use transactions and logging with automatic recovery; use logging and +application-specific recovery; or edit a copy of the database, and once +all applications using the database have successfully called +UNREF==xm_close, atomically replace the original database with the +updated copy. +
+</dl>
+<p>When multiple threads are using the <a href="../api_java/xmlcontainer_class.html">XmlContainer</a> concurrently,
+only a single thread may call the XmlContainer.close method. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_declare.html b/db/docs/api_java/xml_declare.html new file mode 100644 index 000000000..bae121b5b --- /dev/null +++ b/db/docs/api_java/xml_declare.html @@ -0,0 +1,121 @@ +<!--Id: xml_declare.so,v 10.8 2002/08/07 15:14:58 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.declareIndex</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.declareIndex</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void declareIndex(DbTxn txnid, + String node, String index, int flags) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.declareIndex method declares the indexing required for a +particular node. The node may be an element or attribute. +<p>The <b>node</b> parameter provides the name of the node +to be indexed. Attribute node names are prefixed with the '@' character +to distinguish them from element node names. For example, within the +following XML document fragment the element name is 'fruit', and the +attribute name is '@color', +"<fruit color='red'>apple</fruit>". +<p>A fully qualified node name is a node name that includes its full +namespace specification. In the following fragment from the +<a href="http://www.w3.org/TR/1999/REC-xml-names-19990114/">W3C XML Namespaces specification</a>, the fully qualified name of +the "price units" element is "http://ecommerce.org/schema:price units": +<p><blockquote><pre><x xmlns:edi='http://ecommerce.org/schema'> + <!-- the 'price' element's namespace is http://ecommerce.org/schema --> + <edi:price units='Euro'>32.18</edi:price> +</x></pre></blockquote> +<p>The index string is a comma separated list of one or more of the +following indexing strategy names: +<p><ul type=disc> +<li>none-none-none-none +<li>node-element-presence +<li>node-attribute-presence +<li>node-element-equality-string +<li>node-element-equality-number +<li>node-element-substring-string +<li>node-attribute-equality-string +<li>node-attribute-equality-number +<li>node-attribute-substring-string +<li>edge-element-presence +<li>edge-attribute-presence +<li>edge-element-equality-string +<li>edge-element-equality-number +<li>edge-element-substring-string +<li>edge-attribute-equality-string +<li>edge-attribute-equality-number +<li>edge-attribute-substring-string +</ul> +<p>Indices may only be declared for empty containers. Once documents have +been added to a container the indexing specification for the container +may not be changed. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; +otherwise, null. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlContainer.declareIndex method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer.declareIndex method may fail and throw an UNREF==xmlexception_class +exception with the following exception code: +<p><dl compact> +<p><dt>CONTAINER_NOT_EMPTY<dd>Indexes may only be declared for empty containers. +</dl> +<p><dl compact> +<p><dt>CONTAINER_CLOSED<dd>Indexes may only be declared on open containers. +</dl> +<p><dl compact> +<p><dt>DATABASE_ERROR<dd>An error occurred in an underlying Berkeley DB database. +UNREF==xml_getdberror method returns the error code for the error. +</dl> +<p>The XmlContainer.declareIndex method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.declareIndex method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_del.html b/db/docs/api_java/xml_del.html new file mode 100644 index 000000000..13356586a --- /dev/null +++ b/db/docs/api_java/xml_del.html @@ -0,0 +1,81 @@ +<!--Id: xml_del.so,v 10.5 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.deleteDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.deleteDocument</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void deleteDocument(DbTxn txnid, int id, int flags) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.deleteDocument method removes the document identified by the <b>id</b> +parameter from the container. +<p>If the operation is to be transaction-protected (other than by specifying +the Db.DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a +transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; otherwise, null. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_AUTO_COMMIT">Db.DB_AUTO_COMMIT</a><dd>Enclose the XmlContainer.deleteDocument call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p> +If the specified document is not in the container, the XmlContainer.deleteDocument method will return Db.DB_NOTFOUND. +Otherwise, the XmlContainer.deleteDocument method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the operation was selected to resolve a deadlock, the +XmlContainer.deleteDocument method will fail and +throw a <a href="../api_java/deadlock_class.html">DbDeadlockException</a> exception. +<p>The XmlContainer.deleteDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.deleteDocument method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_get.html b/db/docs/api_java/xml_get.html new file mode 100644 index 000000000..fc7c6656b --- /dev/null +++ b/db/docs/api_java/xml_get.html @@ -0,0 +1,90 @@ +<!--Id: xml_get.so,v 10.5 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.getDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.getDocument</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public XmlDocument getDocument(DbTxn txnid, int id, int flags) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.getDocument method returns the document identified by the <b>id</b> +parameter. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; +otherwise, null. +<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or +more of the following values: +<p><dl compact> +<p><dt><a name="Db.DB_DIRTY_READ">Db.DB_DIRTY_READ</a><dd>Read modified but not yet committed data. Silently ignored if the +<a href="../api_java/db_open.html#DB_DIRTY_READ">Db.DB_DIRTY_READ</a> flag was not specified when the underlying +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a> was opened. +<p><dt><a name="Db.DB_RMW">Db.DB_RMW</a><dd>Acquire write locks instead of read locks when doing the retrieval. +Setting this flag can eliminate deadlock during a read-modify-write +cycle by acquiring the write lock during the read part of the cycle so +that another thread of control acquiring a read lock for the same item, +in its own read-modify-write cycle, will not result in deadlock. +<p>Because the XmlContainer.getDocument interface will not hold locks +across Berkeley DB interface calls in non-transactional environments, the +<a href="../api_java/dbc_get.html#DB_RMW">Db.DB_RMW</a> flag to the XmlContainer.getDocument call is meaningful only in +the presence of transactions. +</dl> +<p> +If the specified document is not in the container, the XmlContainer.getDocument method will return Db.DB_NOTFOUND. +Otherwise, the XmlContainer.getDocument method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the operation was selected to resolve a deadlock, the +XmlContainer.getDocument method will fail and +throw a <a href="../api_java/deadlock_class.html">DbDeadlockException</a> exception. +<p>The XmlContainer.getDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.getDocument method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_getname.html b/db/docs/api_java/xml_getname.html new file mode 100644 index 000000000..821bd543a --- /dev/null +++ b/db/docs/api_java/xml_getname.html @@ -0,0 +1,73 @@ +<!--Id: xml_getname.so,v 10.4 2002/06/24 14:49:37 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.getName</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.getName</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public String getName() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.getName method returns the name of the container. +<p>The XmlContainer.getName method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer.getName method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The container has not yet been opened. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlContainer.getName method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlContainer.getName method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.getName method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_index.html b/db/docs/api_java/xml_index.html new file mode 100644 index 000000000..0867ad133 --- /dev/null +++ b/db/docs/api_java/xml_index.html @@ -0,0 +1,56 @@ +<!--Id: xml_index.so,v 10.5 2002/06/25 17:17:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: Berkeley DB XML: Java Interface</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<h1 align=center>Berkeley DB XML: Java Interface</h1> +<p><table border=1 align=center> +<tr><th>Section</th><th>Class/Method</th><th>Description</th></tr> +<tr><td><b>DbXML Operations</b></td><td><a href="../api_java/xmlcontainer_class.html">XmlContainer</a></td><td>Create a XML container handle</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_close.html">XmlContainer.close</a></td><td>Close a XML container</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a></td><td>Declare an index</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a></td><td>Delete a document from a container</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_get.html">XmlContainer.getDocument</a></td><td>Retrieve a document from a container</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_getname.html">XmlContainer.getName</a></td><td>Return a container name</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_open.html">XmlContainer.open</a></td><td>Open a XML container</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_xparse.html">XmlContainer.parseXPathExpression</a></td><td>Parse an XPath 1.0 expression</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_put.html">XmlContainer.putDocument</a></td><td>Store a document in a container</td></tr> +<tr><td><br></td><td><a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a></td><td>Query a container using XPath 1.0</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldocument_class.html">XmlDocument</a></td><td>Create a XML document handle</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a></td><td>Get the document annotation attributes</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a></td><td>Get the document content</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getcontlen.html">XmlDocument.getContentLength</a></td><td>Return the document's length</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getdom.html">XmlDocument.getDOM</a></td><td>Return the document as a DOM</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getenc.html">XmlDocument.getEncoding</a></td><td>Return the document's encoding</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a></td><td>Get the document ID</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a></td><td>Get the document name</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a></td><td>Get the document type</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_setattr.html">XmlDocument.setAttributeValue</a></td><td>Set the document annotation attributes</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a></td><td>Set the document content</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a></td><td>Set the document name</td></tr> +<tr><td><br></td><td><a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a></td><td>Set the document type</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlquery_class.html">XmlQueryContext</a></td><td>Create a XPath query context</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_clearname.html">XmlQueryContext.clearNamespaces</a></td><td>Delete all namespace mappings</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_getname.html">XmlQueryContext.getNamespace</a></td><td>Return the namespace URI</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_getvar.html">XmlQueryContext.getVariableValue</a></td><td>Return the value bound to a variable</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_remname.html">XmlQueryContext.removeNamespace</a></td><td>Delete the namespace URI</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_seteval.html">XmlQueryContext.setEvaluationType</a></td><td>Set the query evaluation type</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_setname.html">XmlQueryContext.setNamespace</a></td><td>Set the namespace URI</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_setret.html">XmlQueryContext.setReturnType</a></td><td>Set the query return type</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlq_setvar.html">XmlQueryContext.setVariableValue</a></td><td>Bind a value to a variable</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlresults_class.html">XmlResults</a></td><td>Encapsulate XPath query results</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlr_next.html">XmlResults.next</a></td><td>Return the next result</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlr_reset.html">XmlResults.reset</a></td><td>Reset the results iterator</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlvalue_class.html">XmlValue</a></td><td>Encapsulate the value of a document node</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlxpathexp_class.html">XPathExpression</a></td><td>Encapsulate a parsed XPath expression</td></tr> +<tr><td><br></td><td><a href="../api_java/xmlxpe_get.html">XPathExpression.getXPathQuery</a></td><td>Return the XPath query</td></tr> +</table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_open.html b/db/docs/api_java/xml_open.html new file mode 100644 index 000000000..474da8e95 --- /dev/null +++ b/db/docs/api_java/xml_open.html @@ -0,0 +1,148 @@ +<!--Id: xml_open.so,v 10.5 2002/07/30 16:57:43 merrells Exp --> +<!--Id: m4.db_open,v 10.2 2002/06/20 03:47:44 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.open</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.open</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.db.*; +import java.io.FileNotFoundException; +<p> +public void open(DbTxn txnid, int flags, int mode) + throws DbException, FileNotFoundException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.open method opens the <a href="../api_java/xmlcontainer_class.html">XmlContainer</a> +for both reading and writing. The container name, passed
+through the constructor, is used as the base name for a set of +underlying Berkeley DB databases that are used to back the
+container. +
+<p>The XmlContainer.open method may only be called on a closed
+container. A container is in the closed state after construction,
+and after the <a href="../api_java/xml_close.html">XmlContainer.close</a> method has been called. Note
+that it is allowable to re-open a container after it has been
+closed.
+
+<p>An open <a href="../api_java/xmlcontainer_class.html">XmlContainer</a> must be closed, by calling the
+<a href="../api_java/xml_close.html">XmlContainer.close</a> method, before the <a href="../api_java/xmlcontainer_class.html">XmlContainer</a>
+object is destroyed. Otherwise the underlying database
+resources will not be released. +<p>If the operation is to be transaction-protected (other than by specifying +the Db.DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a +transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; otherwise, null. +<p>The <b>flags</b> and <b>mode</b> arguments specify how files will be opened +and/or created if they do not already exist. +<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or +more of the following values: +<p><dl compact> +<p><dt><a name="Db.DB_AUTO_COMMIT">Db.DB_AUTO_COMMIT</a><dd>Enclose the XmlContainer.open call within a transaction. If the call succeeds, +the open operation will be recoverable. If the call fails, no container will +have been created. +<p><dt><a name="Db.DB_CREATE">Db.DB_CREATE</a><dd>Create the container. If the container does not already exist and the Db.DB_CREATE +flag is not specified, the XmlContainer.open will fail. +<p><dt><a name="Db.DB_DIRTY_READ">Db.DB_DIRTY_READ</a><dd>Support dirty reads; that is, read operations on the container may request the +return of modified but not yet committed data. +<p><dt><a name="Db.DB_EXCL">Db.DB_EXCL</a><dd>Return an error if the container already exists. The <a href="../api_java/db_open.html#DB_EXCL">Db.DB_EXCL</a> flag is +only meaningful when specified with the <a href="../api_java/env_open.html#DB_CREATE">Db.DB_CREATE</a> flag. +<p><dt><a name="Db.DB_NOMMAP">Db.DB_NOMMAP</a><dd>Do not map this container into process memory (see the description of the +<a href="../api_java/env_set_mp_mmapsize.html">DbEnv.set_mp_mmapsize</a> method for further information). +<p><dt><a name="Db.DB_RDONLY">Db.DB_RDONLY</a><dd>Open the container for reading only. Any attempt to modify items in the container +will fail, regardless of the actual permissions of any underlying files. +<p><dt><a name="Db.DB_THREAD">Db.DB_THREAD</a><dd>Cause the <a href="../api_java/xmlcontainer_class.html">XmlContainer</a> handle returned by XmlContainer.open to be +<i>free-threaded</i>; that is, usable by multiple threads within a +single address space. +<p>Threading is always assumed in the Java API, so no special flags are +required, and Berkeley DB functions will always behave as if the +<a href="../api_java/env_open.html#DB_THREAD">Db.DB_THREAD</a> flag was specified. +</dl> +<p>On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, all files created by +the container open are created with mode <b>mode</b> (as described in <b>chmod</b>(2)) and modified by the process' umask value at the time of creation +(see <b>umask</b>(2)). If <b>mode</b> is 0, the container open will use a default +mode of readable and writable by both owner and group. On Windows +systems, the mode argument is ignored. The group ownership of created +files is based on the system and directory defaults, and is not further +specified by Berkeley DB. +<p>Calling XmlContainer.open is a reasonably expensive operation, and maintaining +a set of open containers will normally be preferable to repeatedly opening +and closing the container for each new query. +<p>The XmlContainer.open method throws an exception that encapsulates a non-zero error value on +failure. +If XmlContainer.open fails, the <a href="../api_java/xml_close.html">XmlContainer.close</a> method should be called to discard the +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a> handle. +<h1>Environment Variables</h1> +<p><dl compact> +<p><dt>DB_HOME<dd>If a <b>dbenv</b> argument to <a href="../api_c/db_create.html">db_create</a> was specified, the +environment variable <b>DB_HOME</b> may be used as the path of the +database environment home. +<p>XmlContainer.open is affected by any database directory specified using the +<a href="../api_java/env_set_data_dir.html">DbEnv.set_data_dir</a> method, or by setting the "set_data_dir" string +in the environment's <b>DB_CONFIG</b> file. +</dl> +<p><dl compact> +<p><dt>TMPDIR<dd>If the <b>file</b> and <b>dbenv</b> arguments to XmlContainer.open are +null, the environment variable <b>TMPDIR</b> may be used as a +directory in which to create temporary backing files +</dl> +<h1>Errors</h1> +<p>The XmlContainer.open method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt><a name="Db.DB_OLD_VERSION">Db.DB_OLD_VERSION</a><dd>The container cannot be opened without being first upgraded. +<p><dt>EEXIST<dd>DB_CREATE and DB_EXCL were specified and the container exists. +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p> +The <a href="../api_java/env_open.html#DB_THREAD">Db.DB_THREAD</a> flag was specified and fast mutexes are not +available for this architecture. +<p>The <a href="../api_java/env_open.html#DB_THREAD">Db.DB_THREAD</a> flag was specified to XmlContainer.open, but was not +specified to the <a href="../api_java/env_open.html">DbEnv.open</a> call for the environment in which the +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a> handle was created. +</dl> +<p>The XmlContainer.open method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.open method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_put.html b/db/docs/api_java/xml_put.html new file mode 100644 index 000000000..5a7b16cd0 --- /dev/null +++ b/db/docs/api_java/xml_put.html @@ -0,0 +1,90 @@ +<!--Id: xml_put.so,v 10.6 2002/06/24 14:49:37 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.putDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.putDocument</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public int putDocument(DbTxn txnid, XmlDocument xmldoc, int flags) + throws DbException; +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer.putDocument method stores a XML document into the container and +returns the document ID. The contents of an <a href="../api_java/xmldocument_class.html">XmlDocument</a> may be +of type <a href="../api_java/xmldoc_settype.html#XmlDocument::BYTES">Db.XmlDocument::BYTES</a> or <a href="../api_java/xmldoc_settype.html#XmlDocument::XML">Db.XmlDocument::XML</a>. XML +content is parsed and indexed as per the container indexing +specification. Non-XML (<a href="../api_java/xmldoc_settype.html#XmlDocument::BYTES">Db.XmlDocument::BYTES</a>) content is not +indexed. +<p>Regardless of the content type the document annotation attributes +are always indexed.] +<p>The XML indexer expects XML content to be encoded as UTF-8. The indexer +also expects the XML content to be +<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html#dt-wellformed">well-formed</a>, but the content need not be +<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html#dt-valid">valid</a>. +<p>If the operation is to be transaction-protected (other than by specifying +the Db.DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a +transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; otherwise, null. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_AUTO_COMMIT">Db.DB_AUTO_COMMIT</a><dd>Enclose the XmlContainer.putDocument call within a transaction. If the call succeeds, +changes made by the operation will be recoverable. If the call fails, +the operation will have made no changes. +</dl> +<p>The XmlContainer.putDocument method returns a document ID on success. +Otherwise, the XmlContainer.putDocument method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the operation was selected to resolve a deadlock, the +XmlContainer.putDocument method will fail and +throw a <a href="../api_java/deadlock_class.html">DbDeadlockException</a> exception. +<p>The XmlContainer.putDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.putDocument method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_xparse.html b/db/docs/api_java/xml_xparse.html new file mode 100644 index 000000000..ad8091b74 --- /dev/null +++ b/db/docs/api_java/xml_xparse.html @@ -0,0 +1,77 @@ +<!--Id: xml_xparse.so,v 10.5 2002/06/24 14:49:38 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.parseXPathExpression</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.parseXPathExpression</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public XPathExpression parseXPathExpression( + String xpath, XmlQueryContext context, int flags) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>Return a pre-parsed XPath 1.0 version query for later use with the +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a> method. The query is provided as a string and is expected +to be in the syntax defined in the +<a href="http://www.w3c.org/TR/xpath">W3C XPath 1.0 +specification</a>. +<p>The query may optionally be done within the execution context +<b>context</b>, which describes how the query is to be performed. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlContainer.parseXPathExpression method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer.parseXPathExpression method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlContainer.parseXPathExpression method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.parseXPathExpression method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xml_xpath.html b/db/docs/api_java/xml_xpath.html new file mode 100644 index 000000000..f998cab9b --- /dev/null +++ b/db/docs/api_java/xml_xpath.html @@ -0,0 +1,102 @@ +<!--Id: xml_xpath.so,v 10.5 2002/06/24 14:49:38 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer.queryWithXPath</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer.queryWithXPath</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public XmlResults queryWithXPath(DbTxn txnid, + XPathExpression expression, int flags) + throws XmlException; +<p> +public XmlResults queryWithXPath(DbTxn txnid, + String query, XmlQueryContext context, int flags) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>Return the results of an XPath 1.0 version query against the container. +In the first variant, <b>expression</b> is provided as the results of +a call to the <a href="../api_java/xml_xparse.html">XmlContainer.parseXPathExpression</a> method. +<p>In the second variant, <b>query</b> is provided as a string (expected +to be in the syntax defined in the +<a href="http://www.w3c.org/TR/xpath">W3C XPath 1.0 specification</a>). +In this case, the query may optionally be done within the execution +context <b>context</b>, which describes how the query is to be +performed. If no context is specified, the query will retrieve the set +of <a href="../api_java/xmldocument_class.html">XmlDocument</a>s matching the XPath expression. +<p>If the operation is to be transaction-protected, the <b>txnid</b> +parameter is a transaction handle returned from <a href="../api_java/txn_begin.html">DbEnv.txn_begin</a>; +otherwise, null. +<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or +more of the following values: +<p><dl compact> +<p><dt><a name="Db.DB_DIRTY_READ">Db.DB_DIRTY_READ</a><dd>Read modified but not yet committed data. Silently ignored if the +<a href="../api_java/db_open.html#DB_DIRTY_READ">Db.DB_DIRTY_READ</a> flag was not specified when the underlying +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a> was opened. +<p><dt><a name="Db.DB_RMW">Db.DB_RMW</a><dd>Acquire write locks instead of read locks when doing the retrieval. +Setting this flag can eliminate deadlock during a read-modify-write +cycle by acquiring the write lock during the read part of the cycle so +that another thread of control acquiring a read lock for the same item, +in its own read-modify-write cycle, will not result in deadlock. +<p>Because the <a href="../api_java/xml_get.html">XmlContainer.getDocument</a> interface will not hold locks +across Berkeley DB interface calls in non-transactional environments, the +<a href="../api_java/dbc_get.html#DB_RMW">Db.DB_RMW</a> flag to the <a href="../api_java/xml_get.html">XmlContainer.getDocument</a> call is meaningful only in +the presence of transactions. +</dl> +<p>The XmlContainer.queryWithXPath method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlContainer.queryWithXPath method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlContainer.queryWithXPath method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlContainer.queryWithXPath method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlcontainer_class.html b/db/docs/api_java/xmlcontainer_class.html new file mode 100644 index 000000000..8a02ded46 --- /dev/null +++ b/db/docs/api_java/xmlcontainer_class.html @@ -0,0 +1,85 @@ +<!--Id: xmlcontainer_class.so,v 1.8 2002/07/30 16:57:44 merrells Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlContainer</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlContainer</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public class XmlContainer extends Object +{ + XmlContainer(DbEnv dbenv, String name, int flags) + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>The XmlContainer class provides methods for managing the storage and +retrieval of XmlDocuments. The constructor creates an XmlContainer +object that is the handle for an XML Container. +<p>If no <b>dbenv</b> value is specified, the container is standalone; that +is, it is not part of any Berkeley DB environment. +<p>If a <b>dbenv</b> value is specified, the container is created within +the specified Berkeley DB environment and all operations are performed within +the context of that environment. The container methods automatically +make calls to the other subsystems in Berkeley DB based on the enclosing +environment. For example, if the environment has been configured to use +locking, the container methods will automatically acquire the correct +locks when reading and writing pages of the underlying databases that +support the container. The user is expected to suitably configure the +environment for their particular application. +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_XA_CREATE">Db.DB_XA_CREATE</a><dd>Instead of creating a standalone database, create a database intended to +be accessed via applications running under a X/Open conformant Transaction +Manager. The database will be opened in the environment specified by the +OPENINFO parameter of the GROUPS section of the ubbconfig file. See the +<a href="../ref/xa/intro.html">XA Resource Manager</a> chapter in the +Reference Guide for more information. +</dl> +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getattr.html b/db/docs/api_java/xmldoc_getattr.html new file mode 100644 index 000000000..f3e0127f4 --- /dev/null +++ b/db/docs/api_java/xmldoc_getattr.html @@ -0,0 +1,72 @@ +<!--Id: xmldoc_getattr.so,v 10.6 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getAttributeValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getAttributeValue</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public XmlValue getAttributeValue(String attr) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getAttributeValue method returns the value of the <b>attr</b> +annotation attribute. +<p> +If the specified attribute is not in the document, the XmlDocument.getAttributeValue method will return Db.DB_NOTFOUND. +Otherwise, the XmlDocument.getAttributeValue method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getAttributeValue method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument.getAttributeValue method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument.getAttributeValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getAttributeValue method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getcont.html b/db/docs/api_java/xmldoc_getcont.html new file mode 100644 index 000000000..eb62821e2 --- /dev/null +++ b/db/docs/api_java/xmldoc_getcont.html @@ -0,0 +1,70 @@ +<!--Id: xmldoc_getcont.so,v 10.5 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getContent</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getContent</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public String getContent() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getContent method returns the document content. +<p>The XmlDocument.getContent method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getContent method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>The XmlDocument.getContent method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getContent method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getcontlen.html b/db/docs/api_java/xmldoc_getcontlen.html new file mode 100644 index 000000000..745e7f5a8 --- /dev/null +++ b/db/docs/api_java/xmldoc_getcontlen.html @@ -0,0 +1,71 @@ +<!--Id: xmldoc_getcontlen.so,v 10.4 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getContentLength</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getContentLength</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public size_t getContentLength() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getContentLength method returns the length of the document's +content, in bytes. +<p>The XmlDocument.getContentLength method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getContentLength method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>The XmlDocument.getContentLength method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getContentLength method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getdom.html b/db/docs/api_java/xmldoc_getdom.html new file mode 100644 index 000000000..98483a903 --- /dev/null +++ b/db/docs/api_java/xmldoc_getdom.html @@ -0,0 +1,78 @@ +<!--Id: xmldoc_getdom.so,v 10.6 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getDOM</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getDOM</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void * getDOM(bool withAnnotationAttributes) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getDOM method returns the document as a +W3C Level 3 +Document Object Model (DOM). +<p>The <b>flags</b> value must be set to 0 or +the following value: +<p><dl compact> +<p><dt><a name="Db.DB_WITHATTRIBUTES">Db.DB_WITHATTRIBUTES</a><dd>The document annotation attributes are added as attributes of the +document's root element. +</dl> +<p>The XmlDocument.getDOM method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getDOM method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>The XmlDocument.getDOM method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getDOM method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getenc.html b/db/docs/api_java/xmldoc_getenc.html new file mode 100644 index 000000000..430bbb4b5 --- /dev/null +++ b/db/docs/api_java/xmldoc_getenc.html @@ -0,0 +1,86 @@ +<!--Id: xmldoc_getenc.so,v 10.6 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getEncoding</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getEncoding</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public int getEncoding() + throws XmlException; +<p> +public String getEncodingName() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getEncoding method returns the document encoding as one of the +following types: +<p><ul type=disc> +<li><a name="Db.XmlDocument::EBCDIC">Db.XmlDocument::EBCDIC</a> +<li><a name="Db.XmlDocument::NONE">Db.XmlDocument::NONE</a> +<li><a name="Db.XmlDocument::UCS4">Db.XmlDocument::UCS4</a> +<li><a name="Db.XmlDocument::UCS4_ASCII">Db.XmlDocument::UCS4_ASCII</a> +<li><a name="Db.XmlDocument::UTF16">Db.XmlDocument::UTF16</a> +<li><a name="Db.XmlDocument::UTF8">Db.XmlDocument::UTF8</a> +</ul> +<p>The <a href="../api_java/xmldoc_getenc.html">XmlDocument.getEncodingName</a> method returns the document encoding as a string. +<p>The XmlDocument.getEncoding method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getEncoding method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document has no content stored in it. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument.getEncoding method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument.getEncoding method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getEncoding method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getid.html b/db/docs/api_java/xmldoc_getid.html new file mode 100644 index 000000000..f2c7b811e --- /dev/null +++ b/db/docs/api_java/xmldoc_getid.html @@ -0,0 +1,73 @@ +<!--Id: xmldoc_getid.so,v 10.5 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getID</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getID</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public u_int32_t getID() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getID method returns the document ID. The document ID will +be zero if the document has not yet been assigned any content, or the +document has not yet been added to a container. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlDocument.getID method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getID method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document does not have an ID. +</dl> +<p>The XmlDocument.getID method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getID method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_getname.html b/db/docs/api_java/xmldoc_getname.html new file mode 100644 index 000000000..7f10c7ec7 --- /dev/null +++ b/db/docs/api_java/xmldoc_getname.html @@ -0,0 +1,73 @@ +<!--Id: xmldoc_getname.so,v 10.5 2002/06/24 14:49:39 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getName</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getName</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public String getName() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getName method returns the document name. +<p>The XmlDocument.getName method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getName method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document does not have a name. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument.getName method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument.getName method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getName method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_gettype.html b/db/docs/api_java/xmldoc_gettype.html new file mode 100644 index 000000000..e5e680c87 --- /dev/null +++ b/db/docs/api_java/xmldoc_gettype.html @@ -0,0 +1,72 @@ +<!--Id: xmldoc_gettype.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.getType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.getType</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public Type getType() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.getType method returns the document type, either +<a href="../api_java/xmldoc_settype.html#XmlDocument::BYTES">Db.XmlDocument::BYTES</a>, <a href="../api_java/xmldoc_gettype.html#XmlDocument::UNKNOWN">Db.XmlDocument::UNKNOWN</a>, or +<a href="../api_java/xmldoc_settype.html#XmlDocument::XML">Db.XmlDocument::XML</a>. +<p>The XmlDocument.getType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.getType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +<p>The document does not have a type. +</dl> +<p>The XmlDocument.getType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.getType method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_setattr.html b/db/docs/api_java/xmldoc_setattr.html new file mode 100644 index 000000000..f9de10c8e --- /dev/null +++ b/db/docs/api_java/xmldoc_setattr.html @@ -0,0 +1,74 @@ +<!--Id: xmldoc_setattr.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.setAttributeValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.setAttributeValue</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setAttributeValue(String attr, String value, int flags) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.setAttributeValue method sets the value of the specified <b>attr</b> +annotation attribute. The only values supported are Strings. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlDocument.setAttributeValue method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.setAttributeValue method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument.setAttributeValue method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument.setAttributeValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.setAttributeValue method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_setcont.html b/db/docs/api_java/xmldoc_setcont.html new file mode 100644 index 000000000..7927d3b06 --- /dev/null +++ b/db/docs/api_java/xmldoc_setcont.html @@ -0,0 +1,70 @@ +<!--Id: xmldoc_setcont.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.setContent</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.setContent</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setContent(String content, int flags) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.setContent method sets the document content. +<p>The <b>flags</b> parameter is currently unused, and must be set to 0. +<p>The XmlDocument.setContent method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.setContent method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlDocument.setContent method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.setContent method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_setname.html b/db/docs/api_java/xmldoc_setname.html new file mode 100644 index 000000000..16f0d3109 --- /dev/null +++ b/db/docs/api_java/xmldoc_setname.html @@ -0,0 +1,69 @@ +<!--Id: xmldoc_setname.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.setName</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.setName</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setName(String name) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.setName method sets the name of the document. +<p>The XmlDocument.setName method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.setName method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>If the requested item could not be returned due to insufficient memory, +the XmlDocument.setName method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlDocument.setName method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.setName method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldoc_settype.html b/db/docs/api_java/xmldoc_settype.html new file mode 100644 index 000000000..9853c12f2 --- /dev/null +++ b/db/docs/api_java/xmldoc_settype.html @@ -0,0 +1,71 @@ +<!--Id: xmldoc_settype.so,v 10.4 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument.setType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument.setType</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setType(Type type) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlDocument.setType method sets the document type. The document type +must be set to one of the following values: +<p><dl compact> +<p><dt>Db.XmlDocument::BYTES<dd>Untyped input, which cannot be indexed. +<p><dt>Db.XmlDocument::XML<dd>XML input. +</dl> +<p>The XmlDocument.setType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlDocument.setType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>The XmlDocument.setType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlDocument.setType method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmldocument_class.html b/db/docs/api_java/xmldocument_class.html new file mode 100644 index 000000000..c7a98942d --- /dev/null +++ b/db/docs/api_java/xmldocument_class.html @@ -0,0 +1,73 @@ +<!--Id: xmldocument_class.so,v 1.9 2002/07/29 04:20:27 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlDocument</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlDocument</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public class XmlDocument extends Object +{ + XmlDocument() + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>An XmlDocument is the unit of storage within a <a href="../api_java/xmlcontainer_class.html">XmlContainer</a>. +<p>A XmlDocument contains a stream of bytes that may be of type +XML or BYTES. The <a href="../api_java/xmlcontainer_class.html">XmlContainer</a> will only index the content of +XmlDocuments that contain XML. The BYTES type is supported to +allow the storage of arbitrary content along with XML content. +<p>All documents objects stored within a container are assigned a document +ID, at 32-bit unsigned integral value. This ID uniquely identifies a +document within a container. The ID is assigned by the container when +the document is first added to the container. +<p>The XmlDocument class supports annotation attributes. The user +may annotate their documents with meta-information to be stored with +their document, but not within their document. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_clearname.html b/db/docs/api_java/xmlq_clearname.html new file mode 100644 index 000000000..99c07abb1 --- /dev/null +++ b/db/docs/api_java/xmlq_clearname.html @@ -0,0 +1,66 @@ +<!--Id: xmlq_clearname.so,v 10.3 2002/06/24 14:49:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.clearNamespaces</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.clearNamespaces</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void clearNamespaces() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.clearNamespaces method removes all current namespace prefix to URI +mappings. +<p>The XmlQueryContext.clearNamespaces method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.clearNamespaces method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.clearNamespaces method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_getname.html b/db/docs/api_java/xmlq_getname.html new file mode 100644 index 000000000..e0ecbce4b --- /dev/null +++ b/db/docs/api_java/xmlq_getname.html @@ -0,0 +1,75 @@ +<!--Id: xmlq_getname.so,v 10.5 2002/07/01 16:46:15 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.getNamespace</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.getNamespace</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public String getNamespace(String prefix) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.getNamespace method returns the namespace prefix to URI mapping +for <b>prefix</b>. +<p> +If no mapping is found, the XmlQueryContext.getNamespace method will return Db.DB_NOTFOUND. +Otherwise, the XmlQueryContext.getNamespace method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.getNamespace method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>If the requested item could not be returned due to insufficient memory, +the XmlQueryContext.getNamespace method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlQueryContext.getNamespace method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.getNamespace method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_getvar.html b/db/docs/api_java/xmlq_getvar.html new file mode 100644 index 000000000..2fe1295bc --- /dev/null +++ b/db/docs/api_java/xmlq_getvar.html @@ -0,0 +1,72 @@ +<!--Id: xmlq_getvar.so,v 10.5 2002/07/01 16:46:16 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.getVariableValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.getVariableValue</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public XmlValue getVariableValue(String name) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.getVariableValue method returns the value bound to the variable +<b>name</b>. +<p> +If there is no value, the XmlQueryContext.getVariableValue method will return Db.DB_NOTFOUND. +Otherwise, the XmlQueryContext.getVariableValue method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.getVariableValue method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlQueryContext.getVariableValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.getVariableValue method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_remname.html b/db/docs/api_java/xmlq_remname.html new file mode 100644 index 000000000..1598bd9c0 --- /dev/null +++ b/db/docs/api_java/xmlq_remname.html @@ -0,0 +1,67 @@ +<!--Id: xmlq_remname.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.removeNamespace</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.removeNamespace</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void removeNamespace(String prefix) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.removeNamespace method removes the namespace prefix to URI mapping +for <b>prefix</b>. A prefix with no mapping is ignored. +<p>The XmlQueryContext.removeNamespace method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.removeNamespace method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p>The XmlQueryContext.removeNamespace method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.removeNamespace method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_seteval.html b/db/docs/api_java/xmlq_seteval.html new file mode 100644 index 000000000..235489fb5 --- /dev/null +++ b/db/docs/api_java/xmlq_seteval.html @@ -0,0 +1,80 @@ +<!--Id: xmlq_seteval.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.setEvaluationType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.setEvaluationType</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setEvaluationType(EvaluationType type) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.setEvaluationType method sets the query evaluation type. This option +is provided as large result sets could consume large amounts of memory. +By electing lazy evaluation the caller can read documents into memory +as needed. The <b>type</b> must be set to one of the following +values: +<p><dl compact> +<p><dt>Db.XmlQueryContext::Eager<dd>The whole query is executed and its restultant values derived and stored +in-memory before the call to <a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a> returns. +<p><dt>Db.XmlQueryContext::Lazy<dd>Perform as little up-front processing as possible, deferring all +processing to results iteration. This means that as each call to +<a href="../api_java/xmlr_next.html">XmlResults.next</a> is called the next resultant value is determined. +</dl> +<p>The XmlQueryContext.setEvaluationType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.setEvaluationType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlQueryContext.setEvaluationType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.setEvaluationType method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_setname.html b/db/docs/api_java/xmlq_setname.html new file mode 100644 index 000000000..8dbc42f89 --- /dev/null +++ b/db/docs/api_java/xmlq_setname.html @@ -0,0 +1,66 @@ +<!--Id: xmlq_setname.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.setNamespace</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.setNamespace</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setNamespace(String prefix, String uri) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.setNamespace method defines the namespace prefix to URI mapping +for <b>prefix</b> and <b>uri</b>. +<p>The XmlQueryContext.setNamespace method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.setNamespace method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.setNamespace method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_setret.html b/db/docs/api_java/xmlq_setret.html new file mode 100644 index 000000000..3cc7d8a73 --- /dev/null +++ b/db/docs/api_java/xmlq_setret.html @@ -0,0 +1,86 @@ +<!--Id: xmlq_setret.so,v 10.4 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.setReturnType</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.setReturnType</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setReturnType(ReturnType type) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.setReturnType method sets the query return type. The query can +return candidate documents, result documents, or result values. A +candidate document is a document that may match the XPath expression, +a result document is a document that does match the XPath expression, +and a result value is the result of executing the XPath expression +against the result document. +<p>For some expressions it might be known that the candidate set is in fact +equivalent to the result set. For these expressions there is no need to +pass the candidate documents through a filter to eliminate false +positives. The query processor can detect some expressions of this +nature, but not all. The user application may know better, or may want +to do its own false positive elimination. +<p>The <b>type</b> must be set to one of the following values: +<p><dl compact> +<p><dt>Db.Db.XmlQueryContext::CandidateDocuments<dd>Return documents that may match the XPath expression. +<p><dt>Db.Db.XmlQueryContext::ResultDocuments<dd>Return documents that match the XPath expression. +<p><dt>Db.Db.XmlQueryContext::ResultValues<dd>Project the XPath expression over the matching document. +</dl> +<p>The XmlQueryContext.setReturnType method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XmlQueryContext.setReturnType method may fail and throw an exception encapsulating a non-zero error for the following conditions: +<p><dl compact> +<p><dt>EINVAL<dd>An invalid flag value or parameter was specified. +</dl> +<p>The XmlQueryContext.setReturnType method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.setReturnType method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlq_setvar.html b/db/docs/api_java/xmlq_setvar.html new file mode 100644 index 000000000..ee78ab414 --- /dev/null +++ b/db/docs/api_java/xmlq_setvar.html @@ -0,0 +1,64 @@ +<!--Id: xmlq_setvar.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext.setVariableValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext.setVariableValue</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void setVariableValue(String name, XmlValue value) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlQueryContext.setVariableValue method binds the variable <b>name</b> to the value +<b>value</b>. +<h1>Errors</h1> +<p>The XmlQueryContext.setVariableValue method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlQueryContext.setVariableValue method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlquery_class.html b/db/docs/api_java/xmlquery_class.html new file mode 100644 index 000000000..c5c57e60e --- /dev/null +++ b/db/docs/api_java/xmlquery_class.html @@ -0,0 +1,72 @@ +<!--Id: xmlquery_class.so,v 1.9 2002/07/29 04:20:27 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlQueryContext</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlQueryContext</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public class XmlQueryContext extends Object +{ + XmlQueryContext(int flags) + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>An XmlQueryContext is the context within which a query is +performed against an <a href="../api_java/xmlcontainer_class.html">XmlContainer</a>. This context includes a +namespace mapping, variable bindings, and flags that determine how the +query result set should be determined and returned to the caller. +<p>The XPath syntax permits expressions to refer to namespace prefixes, +but not to define them. The XmlQueryContext class provides +namespace management methods so the caller may manage the namespace +prefix to URI mapping. The XPath syntax also permits expressions to +refer to variables, but not to define them. The XmlQueryContext class +provides methods so the caller may manage the variable to value +bindings. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlr_next.html b/db/docs/api_java/xmlr_next.html new file mode 100644 index 000000000..6e809759d --- /dev/null +++ b/db/docs/api_java/xmlr_next.html @@ -0,0 +1,71 @@ +<!--Id: xmlr_next.so,v 10.3 2002/06/24 14:49:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlResults.next</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlResults.next</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void next(DbTxn txnid, XmlValue value) + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlResults.next method returns the next value in the results into the +memory referenced by <b>value</b>. When no more values remain in the +result set, XmlResults.next will return a value with an empty pointer, +so that UNREF==xmlv_get will return 0. +<p>The XmlResults.next method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the requested item could not be returned due to insufficient memory, +the XmlResults.next method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlResults.next method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlResults.next method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlr_reset.html b/db/docs/api_java/xmlr_reset.html new file mode 100644 index 000000000..379b73695 --- /dev/null +++ b/db/docs/api_java/xmlr_reset.html @@ -0,0 +1,72 @@ +<!--Id: xmlr_reset.so,v 10.2 2002/06/24 14:49:42 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlResults.reset</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlResults.reset</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public void reset() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XmlResults.reset method reset the results iterator, for eager +evaluation. If the query was processed with eager evaluation then reset +will reset the iterator so a subsequent call to <a href="../api_java/xmlr_next.html">XmlResults.next</a> method will +return the first value in the result set. If the query was processed +with lazy evaluation then XmlResults.reset will have no effect. +<p>The XmlResults.reset method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>If the requested item could not be returned due to insufficient memory, +the XmlResults.reset method will fail and +throw a <a href="../api_java/mem_class.html">DbMemoryException</a> exception. +<p>The XmlResults.reset method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XmlResults.reset method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlresults_class.html b/db/docs/api_java/xmlresults_class.html new file mode 100644 index 000000000..7c46b5a25 --- /dev/null +++ b/db/docs/api_java/xmlresults_class.html @@ -0,0 +1,73 @@ +<!--Id: xmlresults_class.so,v 1.8 2002/07/29 04:20:27 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlResults</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlResults</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public class XmlResults extends Object { ... } +</pre></h3> +<h1>Description</h1> +<p>The XmlResults class encapsulates the results of a query against +an <a href="../api_java/xmlcontainer_class.html">XmlContainer</a>. +<p>The results of a query are a collection of <a href="../api_java/xmlvalue_class.html">XmlValue</a>s. The +<a href="../api_java/xmlvalue_class.html">XmlValue</a>s may be either documents or nodesets. If the query +context selected a return type of <a href="../api_java/xmlq_setret.html#XmlQueryContext::ResultValues">Db.XmlQueryContext::ResultValues</a> +then the values will be of type NodeListValue, otherwise they will be +of type DocumentValue. +<p>An XmlResults object is created by calling <a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +If the query context called for lazy expression evaluation then the +resultant values will be computed as needed. If eager evaluation was +selected the resultant values are stored within the XmlResults +object. +<p>XmlResults provides an iteration interface through its next() +method. When there are no more values available the passed back value +pointer will be zero. If eager evaluation was selected then the reset +method can be called to reset the iterator, and the next call to next() +will return the first value of the results. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlvalue_class.html b/db/docs/api_java/xmlvalue_class.html new file mode 100644 index 000000000..64ff42c28 --- /dev/null +++ b/db/docs/api_java/xmlvalue_class.html @@ -0,0 +1,88 @@ +<!--Id: xmlvalue_class.so,v 1.4 2002/07/29 04:20:28 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XmlValue</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XmlValue</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public class XmlValue extends Object +{ + XmlValue(int flags) + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>An XmlValue is the value of a node in an XML document. +<p>The value types Db.XmlValue::BOOLEAN, Db.XmlValue::NUMBER, and +Db.XmlValue::STRING are defined in the W3C XPath 1.0 specification. +This implementation adds the value types Db.XmlValue::DOCUMENT, +Db.XmlValue::NODELIST, and Db.XmlValue::VARIABLE. +<p>The query context is passed though each of the XmlValue methods as the +value of an XmlValue object of type Variable is taken from the context. +If no context is provided and a lookup is performed then +XmlException::NO_VARIABLE_BINDING will be thrown. This exception is also +thrown if a context is provided, but a value is not bound to the +variable referred to in the XmlValue object. +<p><dl compact> +<p><dt>DOM_NodeList asNodeList (const XmlQueryContext *context) const<dd>Return the value as a NodeList. +<dt>XmlDocument asDocument (const XmlQueryContext *context) const<dd>Return the value as a Document. +<dt>XmlValue::Type getType (const XmlQueryContext *context) const<dd>Return the type of the value. +<dt>bool asBoolean (const XmlQueryContext *context) const<dd>Return the value as a Boolean. +<dt>bool equals (const XmlValue &v, const XmlQueryContext *context) const<dd>Compare two values for equality. +<dt>bool isBoolean (const XmlQueryContext *context) const<dd>Return if the value is a Boolean. +<dt>bool isDocument (const XmlQueryContext *context) const<dd>Return if the value is a Document. +<dt>bool isNull () const<dd>Return if the value has no value. +<dt>bool isNumber (const XmlQueryContext *context) const<dd>Return if the value is a Number. +<dt>bool isString (const XmlQueryContext *context) const<dd>Return if the value is a String. +<dt>bool isVariable (const XmlQueryContext *context) const<dd>Return if the value is a Variable. +<dt>double asNumber (const XmlQueryContext *context) const<dd>Return the value as a Number. +<dt>isNodeList (const XmlQueryContext *context) const<dd>Return if the value is a NodeList. +<dt>std::string asString (const XmlQueryContext *context) const<dd>Return the value as a String. +</dl> +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlxpathexp_class.html b/db/docs/api_java/xmlxpathexp_class.html new file mode 100644 index 000000000..efd37fc9b --- /dev/null +++ b/db/docs/api_java/xmlxpathexp_class.html @@ -0,0 +1,65 @@ +<!--Id: xmlxpathexp_class.so,v 1.3 2002/07/29 04:20:28 mjc Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XPathExpression</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XPathExpression</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public class XPathExpression extends Object +{ + XPathExpression(int flags) + throws DbException; + ... +} +</pre></h3> +<h1>Description</h1> +<p>An XPathExpression represents a parsed XPath expression. They +are created with <a href="../api_java/xml_xparse.html">XmlContainer.parseXPathExpression</a> and evaluated with <a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p>Parsed XPath expressions are useful as the cost of the expression +parsing and optimization can be amortized over many evaluations. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_java/xmlxpe_get.html b/db/docs/api_java/xmlxpe_get.html new file mode 100644 index 000000000..c9f14fe5c --- /dev/null +++ b/db/docs/api_java/xmlxpe_get.html @@ -0,0 +1,65 @@ +<!--Id: xmlxpe_get.so,v 10.1 2002/06/25 17:17:40 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: XPathExpression.getXPathQuery</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1>XPathExpression.getXPathQuery</h1> +</td> +<td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre> +import com.sleepycat.dbxml.*; +<p> +public String getXPathQuery() + throws XmlException; +</pre></h3> +<h1>Description</h1> +<p>The XPathExpression.getXPathQuery method returns the Xpath query as a string. +<p>The XPathExpression.getXPathQuery method throws an exception that encapsulates a non-zero error value on +failure. +<h1>Errors</h1> +<p>The XPathExpression.getXPathQuery method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. +If a catastrophic error has occurred, the XPathExpression.getXPathQuery method may fail and +throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>, +in which case all subsequent Berkeley DB calls will fail in the same way. +<h1>Class</h1> +<a href="../api_java/xmlcontainer_class.html">XmlContainer</a>, <a href="../api_java/xmldocument_class.html">XmlDocument</a>, <a href="../api_java/xmlquery_class.html">XmlQueryContext</a> +<h1>See Also</h1> +<a href="../api_java/xml_close.html">XmlContainer.close</a>, +<a href="../api_java/xml_declare.html">XmlContainer.declareIndex</a>, +<a href="../api_java/xml_del.html">XmlContainer.deleteDocument</a>, +<a href="../api_java/xml_get.html">XmlContainer.getDocument</a>, +<a href="../api_java/xml_getname.html">XmlContainer.getName</a>, +<a href="../api_java/xml_open.html">XmlContainer.open</a>, +<a href="../api_java/xml_put.html">XmlContainer.putDocument</a> +and +<a href="../api_java/xml_xpath.html">XmlContainer.queryWithXPath</a>. +<p> +<a href="../api_java/xmldoc_getattr.html">XmlDocument.getAttributeValue</a>, +<a href="../api_java/xmldoc_getcont.html">XmlDocument.getContent</a>, +<a href="../api_java/xmldoc_getid.html">XmlDocument.getID</a>, +<a href="../api_java/xmldoc_getname.html">XmlDocument.getName</a>, +<a href="../api_java/xmldoc_gettype.html">XmlDocument.getType</a>, +<a href="../api_java/xmldoc_setcont.html">XmlDocument.setContent</a>, +<a href="../api_java/xmldoc_setname.html">XmlDocument.setName</a>, +and +<a href="../api_java/xmldoc_settype.html">XmlDocument.setType</a>. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_tcl/env_dbremove.html b/db/docs/api_tcl/env_dbremove.html new file mode 100644 index 000000000..c885d5021 --- /dev/null +++ b/db/docs/api_tcl/env_dbremove.html @@ -0,0 +1,49 @@ +<!--Id: env_dbremove.so,v 11.2 2002/06/24 14:49:55 bostic Exp --> +<!--Id: m4.tcl,v 11.25 2002/02/22 18:59:43 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: env dbremove</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1><i>env</i> <b>dbremove</b></h1> +</td> +<td align=right> +<a href="../api_tcl/tcl_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre>env dbremove + [-auto_commit] + [-txn txnid] + [--] + file +</pre></h3> +<h1>Description</h1> +<p>Remove the Berkeley DB database <b>file</b>. +<p>The options are as follows: +<p><dl compact> +<p><dt>-auto_commit<dd>Enclose the call within a transaction. If the call succeeds, changes +made by the operation will be recoverable. If the call fails, the +operation will have made no changes. +<p><dt>-txn txnid<dd>If the operation is to be +transaction-protected (other than by specifying the -auto_commit flag), +the <b>txnid</b> parameter is a transaction handle returned from +<i>env</i> <b>txn</b>. +</dl> +<p>The <i>env</i> <b>dbremove</b> command returns 0 on success, and in the case of error, a Tcl error +is thrown. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_tcl/tcl_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/api_tcl/env_dbrename.html b/db/docs/api_tcl/env_dbrename.html new file mode 100644 index 000000000..e21dcba95 --- /dev/null +++ b/db/docs/api_tcl/env_dbrename.html @@ -0,0 +1,50 @@ +<!--Id: env_dbrename.so,v 11.2 2002/06/24 14:49:56 bostic Exp --> +<!--Id: m4.tcl,v 11.25 2002/02/22 18:59:43 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB: env dbrename</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td> +<h1><i>env</i> <b>dbrename</b></h1> +</td> +<td align=right> +<a href="../api_tcl/tcl_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<hr size=1 noshade> +<tt> +<h3><pre>env dbrename + [-auto_commit] + [-txn txnid] + [--] + file + newname +</pre></h3> +<h1>Description</h1> +<p>Rename the Berkeley DB database <b>file</b> to <b>newname</b>. +<p>The options are as follows: +<p><dl compact> +<p><dt>-auto_commit<dd>Enclose the call within a transaction. If the call succeeds, changes +made by the operation will be recoverable. If the call fails, the +operation will have made no changes. +<p><dt>-txn txnid<dd>If the operation is to be +transaction-protected (other than by specifying the -auto_commit flag), +the <b>txnid</b> parameter is a transaction handle returned from +<i>env</i> <b>txn</b>. +</dl> +<p>The <i>env</i> <b>dbrename</b> command returns 0 on success, and in the case of error, a Tcl error +is thrown. +</tt> +<table width="100%"><tr><td><br></td><td align=right> +<a href="../api_tcl/tcl_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/am_misc/struct.html b/db/docs/ref/am_misc/struct.html new file mode 100644 index 000000000..3a2b3e9d4 --- /dev/null +++ b/db/docs/ref/am_misc/struct.html @@ -0,0 +1,88 @@ +<!--Id: struct.so,v 10.5 2002/06/21 03:04:29 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Storing C/C++ structures/objects</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></h3></td> +<td align=right><a href="../../ref/am_misc/partial.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/am_misc/error.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Storing C/C++ structures/objects</h1> +<p>Berkeley DB can store any kind of data, that is, it is entirely 8-bit clean. +How you use this depends, to some extent, on the application language +you are using. In the C/C++ languages, there are a couple of different +ways to store structures and objects. +<p>First, you can do some form of run-length encoding and copy your +structure into another piece of memory before storing it: +<p><blockquote><pre>struct { + char *data1; + u_int32_t data2; + ... +} info; +size_t len; +u_int8_t *p, data_buffer[1024]; +<p> +p = &data_buffer[0]; +len = strlen(info.data1); +memcpy(p, &len, sizeof(len)); +p += sizeof(len); +memcpy(p, info.data1, len); +p += len; +memcpy(p, &info.data2, sizeof(info.data2)); +p += sizeof(info.data2); +...</pre></blockquote> +<p>and so on, until all the fields of the structure have been loaded into +the byte array. If you want more examples, see the Berkeley DB logging +routines (for example, btree/btree_auto.c:__bam_split_log()). This +technique is generally known as "marshalling". If you use this +technique, you must then un-marshall the data when you read it back: +<p><blockquote><pre>struct { + char *data1; + u_int32_t data2; + ... +} info; +size_t len; +u_int8_t *p; +<p> +p = &data_buffer[0]; +memcpy(&len, p, sizeof(len)); +p += sizeof(len); +info.data = malloc(len); +memcpy(info.data1, p, len); +p += len; +memcpy(&info.data2, p, sizeof(info.data2)); +p += sizeof(info.data2); +...</pre></blockquote> +<p>and so on. +<p>The second way to solve this problem only works if you have just one +variable length field in the structure. In that case, you can declare +the structure as follows: +<p><blockquote><pre>struct { + int a, b, c; + u_int8_t buf[1]; +} info;</pre></blockquote> +<p>Then, let's say you have a string you want to store in this structure. +When you allocate the structure, you allocate it as: +<p><blockquote><pre>malloc(sizeof(struct info) + strlen(string));</pre></blockquote> +<p>Since the allocated memory is contiguous, you can the initialize the +structure as: +<p><blockquote><pre>info.a = 1; +info.b = 2; +info.c = 3; +memcpy(&info.buf[0], string, strlen(string));</pre></blockquote> +<p>and give it to Berkeley DB to store, with a length of: +<p><blockquote><pre>sizeof(struct info) + strlen(string);</pre></blockquote> +<p>In this case, the structure can be copied out of the database and used +without any additional work. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/am_misc/partial.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/am_misc/error.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/apprec/auto.html b/db/docs/ref/apprec/auto.html new file mode 100644 index 000000000..9a885ec67 --- /dev/null +++ b/db/docs/ref/apprec/auto.html @@ -0,0 +1,159 @@ +<!--Id: auto.so,v 10.3 2002/03/15 16:19:10 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Automatically generated functions</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Application Specific Logging and Recovery</dl></h3></td> +<td align=right><a href="../../ref/apprec/def.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/apprec/config.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Automatically generated functions</h1> +<p>The XXX.src file is processed using the gen_rec.awk script included in +the dist directory of the Berkeley DB distribution. This is an awk script +that is executed from with the following command line: +<p><blockquote><pre>awk -f gen_rec.awk \ + -v source_file=<i>C_FILE</i> \ + -v header_file=<i>H_FILE</i> \ + -v template_file=<i>TMP_FILE</i> < XXX.src</pre></blockquote> +<p>where <i>C_FILE</i> is the name of the file into which to place the +automatically generated C code, <i>H_FILE</i> is the name of the +file into which to place the automatically generated data structures +and declarations, and <i>TMP_FILE</i> is the name of the file into +which to place a template for the recovery routines. +<p>Because the gen_rec.awk script uses sources files located relative to +the Berkeley DB dist directory, it must be run from the dist directory. For +example, in building the Berkeley DB logging and recovery routines for +ex_apprec, the following script is used to rebuild the automatically +generated files: +<p><blockquote><pre>E=../examples_c/ex_apprec +<p> +cd ../../dist +awk -f gen_rec.awk \ + -v source_file=$E/ex_apprec_auto.c \ + -v header_file=$E/ex_apprec_auto.h \ + -v template_file=$E/ex_apprec_template < $E/ex_apprec.src</pre></blockquote> +<p>For each log record description found in the XXX.src file, the following +structure declarations and #defines will be created in the file +<i>header_file</i>: +<p><blockquote><pre>#define DB_PREFIX_RECORD_TYPE /* Integer ID number */ +<p> +typedef struct _PREFIX_RECORD_TYPE_args { + /* + * These three fields are generated for every record. + */ + u_int32_t type; /* Record type used for dispatch. */ +<p> + /* + * Transaction handle that identifies the transaction on whose + * behalf the record is being logged. + */ + DB_TXN *txnid; +<p> + /* + * The log sequence number returned by the previous call to log_put + * for this transaction. + */ + DB_LSN *prev_lsn; +<p> + /* + * The rest of the structure contains one field for each of + * the entries in the record statement. + */ +};</pre></blockquote> +<p>Thus, the auto-generated ex_apprec_mkdir_args structure looks as follows: +<p><blockquote><pre>typedef struct _ex_apprec_mkdir_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT dirname; +} ex_apprec_mkdir_args;</pre></blockquote> +<p>The template_file will contain a template for a recovery function. The +recovery function is called on each record read from the log during +system recovery, transaction abort, or the application of log records +on a replication client, and is expected to redo or undo the operations +described by that record. The details of the recovery function will be +specific to the record being logged and need to be written manually, +but the template provides a good starting point. (Note that the +template assumes that the record is manipulating the internals of a +Berkeley DB database and sets up database handles, page structures, and such +for convenience. Many application-specific log records will not need +these, and may simply delete much of the template. See +ex_apprec_template and ex_apprec_rec.c for an example.) +<p>The template file should be copied to a source file in the application +(but not the automatically generated source_file, as that will get +overwritten each time gen_rec.awk is run) and fully developed there. +The recovery function takes the following parameters: +<p><blockquote><p><dl compact> +<p><dt>dbenv<dd>The environment in which recovery is running. +<p><dt>rec<dd>The record being recovered. +<p><dt>lsn<dd>The log sequence number of the record being recovered. The +prev_lsn field, automatically included in every auto-generated log +record, should be returned through this argument. The prev_lsn field +is used to chain log records together to allow transaction aborts; +because the recovery function is the only place that a log record gets +parsed, the responsibility for returning this value lies with the +recovery function writer. +<p><dt>op<dd>A parameter of type db_recops, which indicates what operation is being +run (<a href="../../api_c/env_set_app_dispatch.html#DB_TXN_ABORT">DB_TXN_ABORT</a>, <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_APPLY">DB_TXN_APPLY</a>, <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a>, +<a href="../../api_c/env_set_app_dispatch.html#DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a> or <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_PRINT">DB_TXN_PRINT</a>). +<p><dt>info<dd>A structure passed by the dispatch function. It is used to contain a +list of committed transactions and information about files that may have +been deleted. Application-specific log records can usually simply +ignore this field. +</dl></blockquote> +<p>In addition to the header_file and template_file, a source_file is +created, containing a log, read, recovery, and print function for each +record type. +<p>The log function marshalls the parameters into a buffer, and calls +<a href="../../api_c/log_put.html">DB_ENV->log_put</a> on that buffer returning 0 on success and non-zero on +failure. The log function takes the following parameters: +<p><blockquote><p><dl compact> +<p><dt>dbenv<dd>The environment in which recovery is running. +<p><dt>txnid<dd>The transaction identifier for the transaction handle returned by +<a href="../../api_c/txn_begin.html">DB_ENV->txn_begin</a>. +<p><dt>lsnp<dd>A pointer to storage for a log sequence number into which the log +sequence number of the new log record will be returned. +<p><dt>syncflag<dd>A flag indicating whether the record must be written synchronously. +Valid values are 0 and <a href="../../api_c/log_put.html#DB_FLUSH">DB_FLUSH</a>. +<p><dt>args<dd>The remaining parameters to the log message are the fields described +in the XXX.src file, in order. +</dl></blockquote> +<p>The read function takes a buffer and unmarshalls its contents into a +structure of the appropriate type. It returns 0 on success and non-zero +on error. After the fields of the structure have been used, the pointer +returned from the read function should be freed. The read function +takes the following parameters: +<p><blockquote><p><dl compact> +<p><dt>dbenv<dd>The environment in which recovery is running. +<p><dt>recbuf<dd>A buffer. +<p><dt>argp<dd>A pointer to a structure of the appropriate type. +</dl></blockquote> +<p>The print function displays the contents of the record. The print +function takes the same parameters as the recovery function described +previously. Although some of the parameters are unused by the print +function, taking the same parameters allows a single dispatch loop to +dispatch to a variety of functions. The print function takes the +following parameters: +<p><blockquote><p><dl compact> +<p><dt>dbenv<dd>The environment in which recovery is running. +<p><dt>rec<dd>The record being recovered. +<p><dt>lsn<dd>The log sequence number of the record being recovered. +<p><dt>op<dd>Unused. +<p><dt>info<dd>Unused. +</dl></blockquote> +<p>Finally, the source file will contain a function (named XXX_init_print, +where XXX is replaced by the prefix) which should be added to the +initialization part of the standalone <a href="../../utility/db_printlog.html">db_printlog</a> utility code +so that utility can be used to display application-specific log records. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/apprec/def.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/apprec/config.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/apprec/config.html b/db/docs/ref/apprec/config.html new file mode 100644 index 000000000..0d9498e1c --- /dev/null +++ b/db/docs/ref/apprec/config.html @@ -0,0 +1,128 @@ +<!--Id: config.so,v 10.4 2002/06/05 21:09:14 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Application configuration</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Application Specific Logging and Recovery</dl></h3></td> +<td align=right><a href="../../ref/apprec/auto.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/program/appsignals.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Application configuration</h1> +<p>The application should include a dispatch function that dispatches to +appropriate printing and/or recovery functions based on the log record +type and the operation code. The dispatch function should take the same +arguments as the recovery function, and should call the appropriate +recovery and/or printing functions based on the log record type and the +operation code. For example, the ex_apprec dispatch function is as +follows: +<p><blockquote><pre>int +apprec_dispatch(dbenv, dbt, lsn, op) + DB_ENV *dbenv; + DBT *dbt; + DB_LSN *lsn; + db_recops op; +{ + u_int32_t rectype; + /* Pull the record type out of the log record. */ + memcpy(&rectype, dbt->data, sizeof(rectype)); + switch (rectype) { + case DB_ex_apprec_mkdir: + return (ex_apprec_mkdir_recover(dbenv, dbt, lsn, op, NULL)); + default: + /* + * We've hit an unexpected, allegedly user-defined record + * type. + */ + dbenv->errx(dbenv, "Unexpected log record type encountered"); + return (EINVAL); + } +} +</pre></blockquote> +<p>Applications use this dispatch function and the automatically generated +functions as follows: +<p><ol> +<p><li>When the application starts, call the <a href="../../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a> +with your dispatch function. +<p><li>Issue a <a href="../../api_c/txn_begin.html">DB_ENV->txn_begin</a> call before any operations you want to be +transaction-protected. +<p><li>Before accessing any data, issue the appropriate lock call to lock the +data (either for reading or writing). +<p><li>Before modifying any data that is transaction-protected, issue a call +to the appropriate log function. +<p><li>Call <a href="../../api_c/txn_commit.html">DB_TXN->commit</a> to save all the changes, or call <a href="../../api_c/txn_abort.html">DB_TXN->abort</a> +to cancel all of the modifications. +</ol> +<p>The recovery functions are called in the three following cases: +<p><ol> +<p><li>During recovery after application or system failure, with op set to +<a href="../../api_c/env_set_app_dispatch.html#DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a> or <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a>. +<p><li>During transaction abort, with op set to <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_ABORT">DB_TXN_ABORT</a>. +<p><li>On a replicated client to apply updates from the master, with op set to +<a href="../../api_c/env_set_app_dispatch.html#DB_TXN_APPLY">DB_TXN_APPLY</a>. +</ol> +<p>For each log record type you declare, you must write the appropriate +function to undo and redo the modifications. The shell of these +functions will be generated for you automatically, but you must fill in +the details. +<p>Your code must be able to detect whether the described modifications +have been applied to the data. The function will be called with the +"op" parameter set to <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_ABORT">DB_TXN_ABORT</a> when a transaction that wrote +the log record aborts, with <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a> and +<a href="../../api_c/env_set_app_dispatch.html#DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a> during recovery, and with <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_APPLY">DB_TXN_APPLY</a> +on a replicated client. +<p>The actions for <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_ABORT">DB_TXN_ABORT</a> and <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a> +should generally be the same, and the actions for +<a href="../../api_c/env_set_app_dispatch.html#DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a> and <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_APPLY">DB_TXN_APPLY</a> should generally +be the same. However, if the application is using Berkeley DB replication +and another thread of control may be performing read operations while +log records are applied on a replication client, the recovery function +should perform appropriate locking during <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_APPLY">DB_TXN_APPLY</a> +operations. In this case, the recovery function may encounter deadlocks +when issuing locking calls. The application should run with the +deadlock detector, and the recovery function should simply return +<a href="../../ref/program/errorret.html#DB_LOCK_DEADLOCK">DB_LOCK_DEADLOCK</a> if a deadlock is detected and a locking +operation fails with that error. +<p>The <a href="../../api_c/env_set_app_dispatch.html#DB_TXN_PRINT">DB_TXN_PRINT</a> operation should print the log record, +typically using the auto-generated print function; it is not used in +the Berkeley DB library, but may be useful for debugging, as in the +<a href="../../utility/db_printlog.html">db_printlog</a> utility. Applications may safely ignore this +operation code, they may handle printing from the recovery function, or +they may dispatch directly to the auto-generated print function. +<p>One common way to determine whether operations need to be undone or +redone is the use of log sequence numbers (LSNs). For example, each +access method database page contains the LSN of the most recent log +record that describes a modification to the page. When the access +method changes a page, it writes a log record describing the change and +including the LSN that was on the page before the change. This LSN is +referred to as the previous LSN. The recovery functions read the page +described by a log record, and compare the LSN on the page to the LSN +they were passed. +<p>If the page LSN is less than the passed LSN and the operation is an +undo, no action is necessary (because the modifications have not been +written to the page). If the page LSN is the same as the previous LSN +and the operation is a redo, the actions described are reapplied to the +page. If the page LSN is equal to the passed LSN and the operation is +an undo, the actions are removed from the page; if the page LSN is +greater than the passed LSN and the operation is a redo, no further +action is necessary. If the action is a redo and the LSN on the page +is less than the previous LSN in the log record, it is an error because +it could happen only if some previous log record was not processed. +<p>Examples of other recovery functions can be found in the Berkeley DB library +recovery functions (found in files named XXX_rec.c) and in the +application-specific recovery example (specifically, ex_apprec_rec.c). +<p>Finally, applications need to ensure that any data modifications they +have made, that were part of a committed transaction, must be written +to stable storage before calling the <a href="../../api_c/txn_checkpoint.html">DB_ENV->txn_checkpoint</a> function. This is +to allow the periodic removal of database environment log files. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/apprec/auto.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/program/appsignals.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/apprec/def.html b/db/docs/ref/apprec/def.html new file mode 100644 index 000000000..c9bc0ad41 --- /dev/null +++ b/db/docs/ref/apprec/def.html @@ -0,0 +1,96 @@ +<!--Id: def.so,v 10.3 2002/03/06 20:49:57 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Defining application-specific log records</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Application Specific Logging and Recovery</dl></h3></td> +<td align=right><a href="../../ref/apprec/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/apprec/auto.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Defining application-specific log records</h1> +<p>By convention, log records are described in files named <b>XXX.src</b>, +where "XXX" is typically a descriptive name for a subsystem or other +logical group of logging functions. These files contain interface +definition language descriptions for each type of log record that is +used by the subsystem. +<p>All blank lines and lines beginning with a hash ("#") character in +the XXX.src files are ignored. +<p>The first non-comment line in the file should begin with the keyword +PREFIX, followed by a string that will be prepended to every generated +function name. Frequently, the PREFIX is either identical or similar +to the name of the <b>XXX.src</b> file. For example, the Berkeley DB +application-specific recovery example uses the file +<b>ex_apprec.src</b>, which begins with the following PREFIX line: +<p><blockquote><pre>PREFIX ex_apprec</pre></blockquote> +<p>Following the PREFIX line are the include files required by the +automatically generated functions. The include files should be listed +in order, prefixed by the keyword INCLUDE. For example, the Berkeley DB +application-specific recovery example lists the following include +files: +<p><blockquote><pre>INCLUDE #include <ctype.h> +INCLUDE #include <errno.h> +INCLUDE #include <stdlib.h> +INCLUDE #include <string.h> +INCLUDE +INCLUDE #include <db.h> +INCLUDE +INCLUDE #include "ex_apprec.h"</pre></blockquote> +<p>The rest of the XXX.src file consists of log record descriptions. Each +log record description begins with the line: +<p><blockquote><pre>BEGIN <i>RECORD_NAME</i> <i>RECORD_NUMBER</i></pre></blockquote> +<p>and ends with the line: +<p><blockquote><pre>END</pre></blockquote> +<p>The <i>RECORD_NAME</i> variable should be replaced with a record +name for this log record. The <i>RECORD_NUMBER</i> variable should +be replaced with a record number. +<p>The combination of PREFIX name and <i>RECORD_NAME</i>, and the +<i>RECORD_NUMBER</i> must be unique for the application, that is, +values for application-specific and Berkeley DB log records may not overlap. +Further, because record numbers are stored in log files, which are +usually portable across application and Berkeley DB releases, any change to +the record numbers or log record format or should be handled as +described in the <a href="../../ref/upgrade/process.html">Upgrading Berkeley DB +installations</a> section on log format changes. The record number space +below 10,000 is reserved for Berkeley DB itself; applications should choose +record number values equal to or greater than 10,000. +<p>Between the BEGIN and END keywords there should be one line for each +data item logged as part of this log record. The format of these lines +is as follows: +<p><blockquote><pre>ARG | DBT | POINTER <i>variable_name</i> <i>variable_type</i> <i>printf_format</i></pre></blockquote> +<p>The keyword ARG indicates that the argument is a simple parameter of +the type specified. For example, a file ID might be logged as: +<p><blockquote><pre>ARG fileID int d</pre></blockquote> +<p>The keyword DBT indicates that the argument is a Berkeley DB DBT structure, +containing a length and pointer to a byte string. The keyword POINTER +indicates that the argument is a pointer to the data type specified (of +course the data type, not the pointer, is what is logged). +<p>The <i>variable_name</i> is the field name within the structure that +will be used to refer to this item. The <i>variable_type</i> is +the C-language type of the variable, and the printf format is the +C-language format string, without the leading percent ("%") character, +that should be used to display the contents of the field (for example, +"s" for string, "d" for signed integral type, "u" for unsigned integral +type, "ld" for signed long integral type, "lu" for long unsigned +integral type, and so on). +<p>For example, ex_apprec.src defines a single log record type, used to +log a directory name that has been stored in a DBT: +<p><blockquote><pre>BEGIN mkdir 10000 +DBT dirname DBT s +END</pre></blockquote> +<p>As the name suggests, this example of an application-defined log record +will be used to log the creation of a directory. There are many more +examples of XXX.src files in the Berkeley DB distribution. For example, the +file btree/btree.src contains the definitions for the log records +supported by the Berkeley DB Btree access method. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/apprec/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/apprec/auto.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/apprec/intro.html b/db/docs/ref/apprec/intro.html new file mode 100644 index 000000000..037beb9da --- /dev/null +++ b/db/docs/ref/apprec/intro.html @@ -0,0 +1,77 @@ +<!--Id: intro.so,v 10.47 2002/04/04 03:56:29 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Introduction</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Application Specific Logging and Recovery</dl></h3></td> +<td align=right><a href="../../ref/xa/faq.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/apprec/def.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Introduction</h1> +<p>It is possible to use the Locking, Logging and Transaction subsystems +of Berkeley DB to provide transaction semantics on objects other than those +described by the Berkeley DB access methods. In these cases, the application +will need application-specific logging and recovery functions. +<p>For example, consider an application that provides transaction semantics +on data stored in plain text files accessed using the POSIX read and +write system calls. The read and write operations for which transaction +protection is desired will be bracketed by calls to the standard Berkeley DB +transactional interfaces, <a href="../../api_c/txn_begin.html">DB_ENV->txn_begin</a> and <a href="../../api_c/txn_commit.html">DB_TXN->commit</a>, and +the transaction's locker ID will be used to acquire relevant read and +write locks. +<p>Before data is accessed, the application must make a call to the lock +manager, <a href="../../api_c/lock_get.html">DB_ENV->lock_get</a>, for a lock of the appropriate type (for +example, read) on the object being locked. The object might be a page +in the file, a byte, a range of bytes, or some key. It is up to the +application to ensure that appropriate locks are acquired. Before a +write is performed, the application should acquire a write lock on the +object by making an appropriate call to the lock manager, +<a href="../../api_c/lock_get.html">DB_ENV->lock_get</a>. Then, the application should make a call to the log +manager, <a href="../../api_c/log_put.html">DB_ENV->log_put</a>, to record enough information to redo the +operation in case of failure after commit and to undo the operation in +case of abort. +<p>When designing applications that will use the log subsystem, it is +important to remember that the application is responsible for providing +any necessary structure to the log record. For example, the application +must understand what part of the log record is an operation code, what +part identifies the file being modified, what part is redo information, +and what part is undo information. +<p>After the log message is written, the application may issue the write +system call. After all requests are issued, the application may call +<a href="../../api_c/txn_commit.html">DB_TXN->commit</a>. When <a href="../../api_c/txn_commit.html">DB_TXN->commit</a> returns, the caller is +guaranteed that all necessary log writes have been written to disk. +<p>At any time before issuing a <a href="../../api_c/txn_commit.html">DB_TXN->commit</a>, +the application may call <a href="../../api_c/txn_abort.html">DB_TXN->abort</a>, which will +result in restoration of the database to a consistent pretransaction +state. (The application may specify its own recovery function for this +purpose using the <a href="../../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a> function. The recovery +function must be able to either reapply or undo the update depending on +the context, for each different type of log record.) +<p>If the application crashes, the recovery process uses the log to restore +the database to a consistent state. +<p>Berkeley DB includes tools to assist in the development of application-specific +logging and recovery. Specifically, given a description of information +to be logged in a family of log records, these tools will automatically +create log-writing functions (functions that marshall their arguments +into a single log record), log-reading functions (functions that read +a log record and unmarshall it into a structure containing fields that +map into the arguments written to the log), log-printing functions +(functions that print the contents of a log record for debugging), and +templates for recovery functions (functions that review log records +during transaction abort or recovery). The tools and generated code +are C-language and POSIX-system based, but the generated code should be +usable on any system, not just POSIX systems. +<p>A sample application that does application-specific recovery is included +in the Berkeley DB distribution, in the directory <b>examples_c/ex_apprec</b>. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/xa/faq.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/apprec/def.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/env/encrypt.html b/db/docs/ref/env/encrypt.html new file mode 100644 index 000000000..41ccfe23b --- /dev/null +++ b/db/docs/ref/env/encrypt.html @@ -0,0 +1,101 @@ +<!--Id: encrypt.so,v 11.5 2002/04/18 19:23:24 sue Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Encryption</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Environment</dl></h3></td> +<td align=right><a href="../../ref/env/security.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/env/remote.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Encryption</h1> +<p>Berkeley DB releases optionally include strong cryptography support. To +determine if you have a Berkeley DB release that includes cryptography, check +for a top-level directory named <b>crypto</b> in the distribution. +Only releases including cryptography support will have a directory by +that name. <b>Note that export/import and/or use of cryptography +software, or even communicating technical details about cryptography +software, is illegal in some parts of the world. You are strongly +advised to pay close attention to any export/import and/or use laws +which apply to you when you import release of Berkeley DB including +cryptography to your country or re-distribute source code from it in +any way.</b> +<p>Berkeley DB supports encryption using the Rijndael/AES (also known as the +Advanced Encryption Standard and Federal Information Processing Standard +(FIPS) 197) algorithm for encryption or decryption. The algorithm is +configured to use a 128-bit key. Berkeley DB uses a 16-byte initialization +vector generated using the Mersenne Twister. All encrypted information +is additionally checksummed using the SHA1 Secure Hash Algorithm, using +a 160-bit message digest. +<p>The encryption support provided with Berkeley DB is intended to protect +applications from an attacker obtaining physical access to the media on +which a Berkeley DB database is stored, or an attacker compromising a system +on which Berkeley DB is running but who is unable to read system or process +memory on that system. +<b>The encryption support provided with Berkeley DB will not protect applications +from attackers able to read system memory on the system where Berkeley DB is +running.</b> +<p>Encryption is not the default for created databases, even in database +environments configured for encryption. In addition to configuring for +encryption by calling the <a href="../../api_c/env_set_encrypt.html">DB_ENV->set_encrypt</a> or +<a href="../../api_c/db_set_encrypt.html">DB->set_encrypt</a> functions, applications must specify the +<a href="../../api_c/db_set_flags.html#DB_ENCRYPT">DB_ENCRYPT</a> flag before creating the database in order for the +database to be encrypted. Further, databases cannot be converted to an +encrypted format after they have been created without dumping and +re-creating them. +<p>Each encrypted database environment (including all its encrypted +databases) is encrypted using a single password and a single algorithm. +Applications wanting to provide a finer granularity of database access +must either use multiple database environments or implement additional +access controls outside of Berkeley DB. +<p>The only encrypted parts of a database environment are its databases +and its log files. Specifically, the <a href="../../ref/env/region.html">Shared memory regions</a> supporting the database environment are not +encrypted. For this reason, it may be possible for an attacker to read +some or all of an encrypted database by reading the on-disk files that +back these shared memory regions. To prevent such attacks, applications +may want to use in-memory filesystem support (on systems that support +it), or the <a href="../../api_c/env_open.html#DB_PRIVATE">DB_PRIVATE</a> or <a href="../../api_c/env_open.html#DB_SYSTEM_MEM">DB_SYSTEM_MEM</a> flags to the +<a href="../../api_c/env_open.html">DB_ENV->open</a> function, to place the shared memory regions in memory that +is never written to a disk. As some systems page system memory to a +backing disk, it is important to consider the specific operating system +running on the machine as well. Finally, when backing database +environment shared regions with the filesystem, Berkeley DB can be configured +to overwrite the shared regions before removing them by specifying the +<a href="../../api_c/env_set_flags.html#DB_OVERWRITE">DB_OVERWRITE</a> flag. This option is only effective in the +presence of fixed-block filesystems, journaling or logging filesystems +will require operating system support and probably modification of the +Berkeley DB sources. +<p>While all user data is encrypted, parts of the databases and log files +in an encrypted environment are maintained in an unencrypted state. +Specifically, log record headers are not encrypted, only the actual log +records. Additionally, database internal page header fields are not +encrypted. These page header fields includes information such as the +page's <a href="../../api_c/db_lsn.html">DB_LSN</a>, number, and position in the database's sort +order. +<p>Log records distributed by replication master to replicated clients are +transmitted to the clients in unencrypted form. If encryption is +desired in a replicated application, the use of a secure transport +is strongly suggested. +<p>Sleepycat Software gratefully acknowledges: +<p><ul type=disc> +<li>Vincent Rijmen, Antoon Bosselaers and Paulo Barreto for writing the +Rijndael/AES code used in Berkeley DB. +<li>Steve Reid and James H. Brown for writing the SHA1 checksum code used +in Berkeley DB. +<li>Makoto Matsumoto and Takuji Nishimura for writing the Mersenne Twister +code used in Berkeley DB. +<li>Adam Stubblefield for integrating the Rijndael/AES, SHA1 checksum and +Mersenne Twister code into Berkeley DB. +</ul> +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/env/security.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/env/remote.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/lock/deaddbg.html b/db/docs/ref/lock/deaddbg.html new file mode 100644 index 000000000..749f7ba1f --- /dev/null +++ b/db/docs/ref/lock/deaddbg.html @@ -0,0 +1,141 @@ +<!--Id: deaddbg.so,v 10.3 2002/06/19 19:23:05 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Deadlock debugging</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Locking Subsystem</dl></h3></td> +<td align=right><a href="../../ref/lock/timeout.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/lock/page.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Deadlock debugging</h1> +<p>An occasional debugging problem in Berkeley DB applications is unresolvable +deadlock. The output of the <b>-Co</b> flags of the <a href="../../utility/db_stat.html">db_stat</a> +utility can be used to detect and debug these problems. The following +is a typical example of the output of this utility: +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- + 1 READ 1 HELD a.db handle 0 +80000004 WRITE 1 HELD a.db page 3</pre></blockquote> +<p>In this example, we have opened a database and stored a single key/data +pair in it. Because we have a database handle open, we have a read lock +on that database handle. The database handle lock is the read lock +labelled <i>handle</i>. (We can normally ignore handle locks for +the purposes of database debugging, as they will only conflict with +other handle operations, for example, an attempt to remove the database +will block because we are holding the handle locked, but reading and +writing the database will not conflict with the handle lock.) +<p>It is important to note that locker IDs are 32-bit unsigned integers, +and are divided into two name spaces. Locker IDs with the high bit set +(that is, values 80000000 or higher), are locker IDs associated with +transactions. Locker IDs without the high bit set are locker IDs that +are not associated with a transaction. Locker IDs associated with +transactions map one-to-one with the transaction, that is, a transaction +never has more than a single locker ID, and all of the locks acquired +by the transaction will be acquired on behalf of the same locker ID. +<p>We also hold a write lock on the database page where we stored the new +key/data pair. The page lock is labeled <i>page</i> and is on page +number 3. If we were to put an additional key/data pair in the +database, we would see the following output: +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- +80000004 WRITE 2 HELD a.db page 3 + 1 READ 1 HELD a.db handle 0</pre></blockquote> +<p>That is, we have acquired a second reference count to page number 3, but +have not acquired any new locks. If we add an entry to a different page +in the database, we would acquire additional locks: +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- + 1 READ 1 HELD a.db handle 0 +80000004 WRITE 2 HELD a.db page 3 +80000004 WRITE 1 HELD a.db page 2</pre></blockquote> +<p>Here's a simple example of one lock blocking another one: +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- +80000004 WRITE 1 HELD a.db page 2 +80000005 WRITE 1 WAIT a.db page 2 + 1 READ 1 HELD a.db handle 0 +80000004 READ 1 HELD a.db page 1</pre></blockquote> +<p>In this example, there are two different transactional lockers (80000004 and +80000005). Locker 80000004 is holding a write lock on page 2, and +locker 80000005 is waiting for a write lock on page 2. This is not a +deadlock, because locker 80000004 is not blocked on anything. +Presumably, the thread of control using locker 80000004 will proceed, +eventually release its write lock on page 2, at which point the thread +of control using locker 80000005 can also proceed, acquiring a write +lock on page 2. +<p>If lockers 80000004 and 80000005 are not in different threads of +control, the result would be <i>self deadlock</i>. Self deadlock +is not a true deadlock, and won't be detected by the Berkeley DB deadlock +detector. It's not a true deadlock because, if work could continue to +be done on behalf of locker 80000004, then the lock would eventually be +released, and locker 80000005 could acquire the lock and itself proceed. +So, the key element is that the thread of control holding the lock +cannot proceed because it the same thread as is blocked waiting on the +lock. +<p>Here's an example of three transactions reaching true deadlock. First, +three different threads of control opened the database, acquiring three +database handle read locks. +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- + 1 READ 1 HELD a.db handle 0 + 3 READ 1 HELD a.db handle 0 + 5 READ 1 HELD a.db handle 0</pre></blockquote> +<p>The three threads then each began a transaction, and put a key/data pair +on a different page: +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- +80000008 WRITE 1 HELD a.db page 4 + 1 READ 1 HELD a.db handle 0 + 3 READ 1 HELD a.db handle 0 + 5 READ 1 HELD a.db handle 0 +80000006 READ 1 HELD a.db page 1 +80000007 READ 1 HELD a.db page 1 +80000008 READ 1 HELD a.db page 1 +80000006 WRITE 1 HELD a.db page 2 +80000007 WRITE 1 HELD a.db page 3</pre></blockquote> +<p>The thread using locker 80000006 put a new key/data pair on page 2, the +thread using locker 80000007, on page 3, and the thread using locker +80000008 on page 4. Because the database is a 2-level Btree, the tree +was searched, and so each transaction acquired a read lock on the Btree +root page (page 1) as part of this operation. +<p>The three threads then each attempted to put a second key/data pair on +a page currently locked by another thread. The thread using locker +80000006 tried to put a key/data pair on page 3, the thread using locker +80000007 on page 4, and the thread using locker 80000008 on page 2: +<p><blockquote><pre>Locks grouped by object +Locker Mode Count Status ----------- Object ---------- +80000008 WRITE 1 HELD a.db page 4 +80000007 WRITE 1 WAIT a.db page 4 + 1 READ 1 HELD a.db handle 0 + 3 READ 1 HELD a.db handle 0 + 5 READ 1 HELD a.db handle 0 +80000006 READ 2 HELD a.db page 1 +80000007 READ 2 HELD a.db page 1 +80000008 READ 2 HELD a.db page 1 +80000006 WRITE 1 HELD a.db page 2 +80000008 WRITE 1 WAIT a.db page 2 +80000007 WRITE 1 HELD a.db page 3 +80000006 WRITE 1 WAIT a.db page 3</pre></blockquote> +<p>Now, each of the threads of control are blocked, waiting on a different +thread of control. +The thread using locker 80000007 is blocked by +the thread using locker 80000008, due to the lock on page 4. +The thread using locker 80000008 is blocked by +the thread using locker 80000006, due to the lock on page 2. +And the thread using locker 80000006 is blocked by +the thread using locker 80000007, due to the lock on page 3. +Since none of the threads of control can make +progress, one of them will have to be killed in order to resolve the +deadlock. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/lock/timeout.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/lock/page.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/program/cache.html b/db/docs/ref/program/cache.html new file mode 100644 index 000000000..4f109a8bf --- /dev/null +++ b/db/docs/ref/program/cache.html @@ -0,0 +1,35 @@ +<!--Id: cache.so,v 10.2 2002/05/15 15:36:14 margo Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Disk drive caches</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Programmer Notes</dl></h3></td> +<td align=right><a href="../../ref/program/namespace.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/program/copy.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Disk drive caches</h1> +<p>Many disk drives contain onboard caches. Some of these drives include +battery-backup or other functionality that guarantees that all cached +data will be completely written if the power fails. These drives can +offer substantial performance improvements over drives without caching +support. However, some caching drives rely on capacitors or other +mechanisms that guarantee only that the write of the current sector +will complete. These drives can endanger your database and potentially +cause corruption of your data. +<p>To avoid losing your data, make sure the caching on your disk drives is +properly configured so the drive will never report that data has been written +unless the data is guaranteed to be written in the face of a power failure. +Many times, this means that write-caching on the disk drive must +be disabled. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/program/namespace.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/program/copy.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/program/faq.html b/db/docs/ref/program/faq.html new file mode 100644 index 000000000..f0b079b6d --- /dev/null +++ b/db/docs/ref/program/faq.html @@ -0,0 +1,31 @@ +<!--Id: faq.so,v 10.2 2002/05/17 02:47:36 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Programmer notes FAQ</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Programmer Notes</dl></h3></td> +<td align=right><a href="../../ref/program/runtime.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/lock/intro.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Programmer notes FAQ</h1> +<p><ol> +<a name="2"><!--meow--></a> +<p><li><b>What priorities should threads/tasks executing Berkeley DB functions +be given?</b> +<p>Tasks executing Berkeley DB functions should have the same, or roughly +equivalent, system priorities. For example, it can be dangerous to give +tasks of control performing checkpoints a lower priority than tasks of +control doing database lookups, and starvation can sometimes result. +</ol> +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/program/runtime.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/lock/intro.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/rpc/faq.html b/db/docs/ref/rpc/faq.html new file mode 100644 index 000000000..7274ed244 --- /dev/null +++ b/db/docs/ref/rpc/faq.html @@ -0,0 +1,32 @@ +<!--Id: faq.so,v 1.1 2002/06/17 18:38:43 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: RPC FAQ</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>RPC Client/Server</dl></h3></td> +<td align=right><a href="../../ref/rpc/server.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/java/conf.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>RPC FAQ</h1> +<p><ol> +<p><li><b>I get the <a href="../../api_c/env_set_rpc_server.html#DB_NOSERVER">DB_NOSERVER</a> error back from a +<a href="../../api_c/env_set_rpc_server.html">DB_ENV->set_rpc_server</a> call that is using the default client +timeout value.</b> +<p>Some systems have a default RPC client timeout value that is too small, +and the client times out the request before the server has a chance to +process and reply. If you get this error, try explicitly setting the +client timeout value. +</ol> +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/rpc/server.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/java/conf.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/transapp/atomicity.html b/db/docs/ref/transapp/atomicity.html new file mode 100644 index 000000000..24ad1eb7b --- /dev/null +++ b/db/docs/ref/transapp/atomicity.html @@ -0,0 +1,63 @@ +<!--Id: atomicity.so,v 10.3 2002/05/17 15:48:41 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Atomicity</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Berkeley DB Transactional Data Store Applications</dl></h3></td> +<td align=right><a href="../../ref/transapp/put.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/transapp/inc.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Atomicity</h1> +<p>The second reason listed for using transactions was <i>atomicity</i>. +Atomicity means that multiple operations can be grouped into a single +logical entity, that is, other threads of control accessing the database +will either see all of the changes or none of the changes. Atomicity +is important for applications wanting to update two related databases +(for example, a primary database and secondary index) in a single +logical action. Or, for an application wanting to update multiple +records in one database in a single logical action. +<p>Any number of operations on any number of databases can be included in +a single transaction to ensure the atomicity of the operations. There +is, however, a trade-off between the number of operations included in +a single transaction and both throughput and the possibility of +deadlock. The reason for this is because transactions acquire locks +throughout their lifetime and do not release the locks until commit or +abort time. So, the more operations included in a transaction, the more +likely it is that a transaction will block other operations and that +deadlock will occur. However, each transaction commit requires a +synchronous disk I/O, so grouping multiple operations into a transaction +can increase overall throughput. (There is one exception to this: the +<a href="../../api_c/env_set_flags.html#DB_TXN_WRITE_NOSYNC">DB_TXN_WRITE_NOSYNC</a> and <a href="../../api_c/env_set_flags.html#DB_TXN_NOSYNC">DB_TXN_NOSYNC</a> flags cause +transactions to exhibit the ACI (atomicity, consistency and isolation) +properties, but not D (durability); avoiding the write and/or +synchronous disk I/O on transaction commit greatly increases transaction +throughput for some applications.) +<p>When applications do create complex transactions, they often avoid +having more than one complex transaction at a time because simple +operations like a single <a href="../../api_c/db_put.html">DB->put</a> are unlikely to deadlock with +each other or the complex transaction; while multiple complex +transactions are likely to deadlock with each other because they will +both acquire many locks over their lifetime. Alternatively, complex +transactions can be broken up into smaller sets of operations, and each +of those sets may be encapsulated in a nested transaction. Because +nested transactions may be individually aborted and retried without +causing the entire transaction to be aborted, this allows complex +transactions to proceed even in the face of heavy contention, repeatedly +trying the suboperations until they succeed. +<p>It is also helpful to order operations within a transaction; that is, +access the databases and items within the databases in the same order, +to the extent possible, in all transactions. Accessing databases and +items in different orders greatly increases the likelihood of operations +being blocked and failing due to deadlocks. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/transapp/put.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/transapp/inc.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/app_dispatch.html b/db/docs/ref/upgrade.4.1/app_dispatch.html new file mode 100644 index 000000000..e71a6b11a --- /dev/null +++ b/db/docs/ref/upgrade.4.1/app_dispatch.html @@ -0,0 +1,32 @@ +<!--Id: app_dispatch.so,v 1.4 2002/04/04 03:53:10 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: Application-specific logging and recovery</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/memp_sync.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/disk.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: Application-specific logging and recovery</h1> +<p>The application-specific logging and recovery tools and interfaces have +been reworked in the 4.1 release to make it simpler for applications to +use Berkeley DB to support their own logging and recovery of non-Berkeley DB +objects. Specifically, the DB_ENV->set_recovery_init and +DB_ENV->set_tx_recover interfaces have been removed, replaced by +<a href="../../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a>. Applications using either of the +removed interfaces should be updated to call +<a href="../../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a>. For more information see +<a href="../../ref/apprec/intro.html">"Application-specific logging and +recovery"</a> and the <a href="../../api_c/env_set_app_dispatch.html">DB_ENV->set_app_dispatch</a> documentation. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/memp_sync.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/disk.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/checkpoint.html b/db/docs/ref/upgrade.4.1/checkpoint.html new file mode 100644 index 000000000..4a80ad729 --- /dev/null +++ b/db/docs/ref/upgrade.4.1/checkpoint.html @@ -0,0 +1,30 @@ +<!--Id: checkpoint.so,v 1.4 2002/08/12 21:12:06 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: DB_CHECKPOINT, DB_CURLSN</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/log_stat.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/incomplete.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: DB_CHECKPOINT, DB_CURLSN</h1> +<p>The DB_CHECKPOINT flag has been removed from the <a href="../../api_c/logc_get.html">DB_LOGC->get</a> and +<a href="../../api_c/log_put.html">DB_ENV->log_put</a> functions. It is very unlikely application programs used this +flag. If your application used this flag, please contact Sleepycat +Software support for help in upgrading. +<p>The DB_CURLSN flag has been removed from the <a href="../../api_c/log_put.html">DB_ENV->log_put</a> function. It is +very unlikely application programs used this flag. If your application +used this flag, please contact Sleepycat Software support for help in +upgrading. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/log_stat.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/incomplete.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/disk.html b/db/docs/ref/upgrade.4.1/disk.html new file mode 100644 index 000000000..19289acba --- /dev/null +++ b/db/docs/ref/upgrade.4.1/disk.html @@ -0,0 +1,31 @@ +<!--Id: disk.so,v 1.6 2002/05/09 20:36:22 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: upgrade requirements</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/app_dispatch.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/test/run.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: upgrade requirements</h1> +<p>All of the access method database formats changed in the Berkeley DB 4.1 +release (Btree/Recno: version 8 to version 9, Hash: version 7 to version +8, and Queue: version 3 to version 4). <b>The format changes are +entirely backward-compatible, and no database upgrades are needed.</b> +Note, however, that databases created using the 4.1 release may not be +usable with earlier Berkeley DB releases. +<p>The log file format changed in the Berkeley DB 4.1 release. +<p>For further information on upgrading Berkeley DB installations, see +<a href="../../ref/upgrade/process.html">Upgrading Berkeley DB installations</a>. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/app_dispatch.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/test/run.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/excl.html b/db/docs/ref/upgrade.4.1/excl.html new file mode 100644 index 000000000..db0821353 --- /dev/null +++ b/db/docs/ref/upgrade.4.1/excl.html @@ -0,0 +1,26 @@ +<!--Id: excl.so,v 1.1 2002/01/16 20:12:08 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: DB_EXCL</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/fop.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: DB_EXCL</h1> +<p>The <a href="../../api_c/db_open.html#DB_EXCL">DB_EXCL</a> flag to the <a href="../../api_c/db_open.html">DB->open</a> method now works for +subdatabases as well as physical files, and it is now possible to use +the <a href="../../api_c/db_open.html#DB_EXCL">DB_EXCL</a> flag to check for the previous existence of +subdatabases. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/fop.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/fop.html b/db/docs/ref/upgrade.4.1/fop.html new file mode 100644 index 000000000..631cbf4ca --- /dev/null +++ b/db/docs/ref/upgrade.4.1/fop.html @@ -0,0 +1,128 @@ +<!--Id: fop.so,v 1.7 2002/05/09 20:34:20 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: DB->associate, DB->open, DB->remove, DB->rename</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/excl.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/log_register.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: DB->associate, DB->open, DB->remove, DB->rename</h1> +<p>Historic releases of Berkeley DB transaction-protected the <a href="../../api_c/db_open.html">DB->open</a>, +<a href="../../api_c/db_remove.html">DB->remove</a> and <a href="../../api_c/db_rename.html">DB->rename</a> functions, but did it in an implicit +way, that is, applications did not specify the <a href="../../api_c/txn_begin.html">DB_TXN</a> handles +associated with the operations. This approach had a number of problems, +the most significant of which was there was no way to group operations +that included database creation, removal or rename. For example, +applications wanting to maintain a list of the databases in an +environment in a well-known database had no way to update the well-known +database and create a database within a single transaction, and so there +was no way to guarantee the list of databases was correct for the +environment after system or application failure. Another example might +be the creation of both a primary database and a database intended to +serve as a secondary index, where again there was no way to group the +creation of both databases in a single atomic operation. +<p>In the 4.1 release of Berkeley DB, this is no longer the case. The +<a href="../../api_c/db_open.html">DB->open</a> and <a href="../../api_c/db_associate.html">DB->associate</a> functions now take a <a href="../../api_c/txn_begin.html">DB_TXN</a> +handle returned by <a href="../../api_c/txn_begin.html">DB_ENV->txn_begin</a> as an optional argument. New +<a href="../../api_c/env_dbremove.html">DB_ENV->dbremove</a> and <a href="../../api_c/env_dbrename.html">DB_ENV->dbrename</a> functions taking a +<a href="../../api_c/txn_begin.html">DB_TXN</a> handle as an optional argument have been added. +<p>To upgrade, applications must add a <a href="../../api_c/txn_begin.html">DB_TXN</a> parameter in the +appropriate location for the <a href="../../api_c/db_open.html">DB->open</a> function calls, and the +<a href="../../api_c/db_associate.html">DB->associate</a> function calls (in both cases, the second argument for +the C API, the first for the C++ or Java APIs). +<p>Applications wanting to transaction-protect their <a href="../../api_c/db_open.html">DB->open</a> and +<a href="../../api_c/db_associate.html">DB->associate</a> method calls can add a NULL <a href="../../api_c/txn_begin.html">DB_TXN</a> +argument and specify the <a href="../../api_c/env_set_flags.html#DB_AUTO_COMMIT">DB_AUTO_COMMIT</a> flag to the two calls, +which wraps the operation in an internal Berkeley DB transaction. +Applications wanting to transaction-protect the remove and rename +operations must rewrite their calls to the <a href="../../api_c/db_remove.html">DB->remove</a> and +<a href="../../api_c/db_rename.html">DB->rename</a> functions to be, instead, calls to the new +<a href="../../api_c/env_dbremove.html">DB_ENV->dbremove</a> and <a href="../../api_c/env_dbrename.html">DB_ENV->dbrename</a> functions. Applications not +wanting to transaction-protect any of the operations can add a NULL +argument to their <a href="../../api_c/db_open.html">DB->open</a> and <a href="../../api_c/db_associate.html">DB->associate</a> function calls and +require no further changes. +<p>For example, an application currently opening and closing a database as +follows: +<p><blockquote><pre>DB *dbp; +DB_ENV *dbenv; +int ret; +<p> +if ((ret = db_create(&dbp, dbenv, 0)) != 0) + goto err_handler; +<p> +if ((ret = dbp->open(dbp, "file", NULL, DB_BTREE, DB_CREATE, 0664)) != 0) { + (void)dbp->close(dbp); + goto err_handler; +}</pre></blockquote> +<p>could transaction-protect the <a href="../../api_c/db_open.html">DB->open</a> call as follows: +<p><blockquote><pre>DB *dbp; +DB_ENV *dbenv; +int ret; +<p> +if ((ret = db_create(&dbp, dbenv, 0)) != 0) + goto err_handler; +<p> +if ((ret = dbp->open(dbp, + NULL, "file", NULL, DB_BTREE, DB_CREATE | DB_AUTO_COMMIT, 0664)) != 0) { + (void)dbp->close(dbp); + goto err_handler; +}</pre></blockquote> +<p>An application currently removing a database as follows: +<p><blockquote><pre>DB *dbp; +DB_ENV *dbenv; +int ret; +<p> +if ((ret = db_create(&dbp, dbenv, 0)) != 0) + goto err_handler; +<p> +if ((ret = dbp->remove(dbp, "file", NULL, 0)) != 0) + goto err_handler;</pre></blockquote> +<p>could transaction-protect the database removal as follows: +<p><blockquote><pre>DB *dbp; +DB_ENV *dbenv; +int ret; +<p> +if ((ret = + dbenv->dbremove(dbenv, NULL, "file", NULL, DB_AUTO_COMMIT)) != 0) + goto err_handler;</pre></blockquote> +<p>An application currently renaming a database as follows: +<p><blockquote><pre>DB *dbp; +DB_ENV *dbenv; +int ret; +<p> +if ((ret = db_create(&dbp, dbenv, 0)) != 0) + goto err_handler; +<p> +if ((ret = dbp->rename(dbp, "file", NULL, "newname", 0)) != 0) + goto err_handler;</pre></blockquote> +<p>could transaction-protect the database renaming as follows: +<p><blockquote><pre>DB *dbp; +DB_ENV *dbenv; +int ret; +<p> +if ((ret = dbenv->dbrename( + dbenv, NULL, "file", NULL, "newname", DB_AUTO_COMMIT)) != 0) + goto err_handler;</pre></blockquote> +<p>These examples are the simplest possible translation, and will result in +behavior matching that of previous releases. For further discussion on +how to transaction-protect <a href="../../api_c/db_open.html">DB->open</a> function calls, see +<a href="../../ref/transapp/data_open.html">Opening the databases</a>. +<p><a href="../../api_c/db_create.html">DB</a> handles that will later be used for transaction-protected +operations must be opened within a transaction. Specifying a +transaction handle to operations using handles not opened within a +transaction will return an error. Similarly, not specifying a +transaction handle to operations using handles that were opened within +a transaction will also return an error. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/excl.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/log_register.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/incomplete.html b/db/docs/ref/upgrade.4.1/incomplete.html new file mode 100644 index 000000000..d15006137 --- /dev/null +++ b/db/docs/ref/upgrade.4.1/incomplete.html @@ -0,0 +1,30 @@ +<!--Id: incomplete.so,v 1.5 2002/07/05 12:31:23 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: DB_INCOMPLETE</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/checkpoint.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/memp_sync.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: DB_INCOMPLETE</h1> +<p>The DB_INCOMPLETE error has been removed from the 4.1 release, and is +no longer returned by the Berkeley DB library. Applications no longer need +to check for this error return, as the underlying Berkeley DB interfaces that +could historically fail to checkpoint or flush the cache and return this +error can no longer fail for that reason. Applications should remove +all uses of DB_INCOMPLETE. +<p>Additionally, the <a href="../../api_java/txn_checkpoint.html">DbEnv.txn_checkpoint</a> and <a href="../../api_java/db_sync.html">Db.sync</a> +methods have been changed from returning int to returning void. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/checkpoint.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/memp_sync.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/intro.html b/db/docs/ref/upgrade.4.1/intro.html new file mode 100644 index 000000000..141a5e49f --- /dev/null +++ b/db/docs/ref/upgrade.4.1/intro.html @@ -0,0 +1,27 @@ +<!--Id: intro.so,v 1.2 2002/01/16 20:12:09 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: introduction</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<a name="2"><!--meow--></a> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.0/disk.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/excl.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: introduction</h1> +<p>The following pages describe how to upgrade applications coded against +the Berkeley DB 4.0 release interfaces to the Berkeley DB 4.1 release interfaces. +This information does not describe how to upgrade Berkeley DB 1.85 release +applications. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.0/disk.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/excl.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/log_register.html b/db/docs/ref/upgrade.4.1/log_register.html new file mode 100644 index 000000000..6beeb14f1 --- /dev/null +++ b/db/docs/ref/upgrade.4.1/log_register.html @@ -0,0 +1,27 @@ +<!--Id: log_register.so,v 1.3 2002/01/16 20:12:09 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: DB_ENV->log_register</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/fop.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/log_stat.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: DB_ENV->log_register</h1> +<p>The DB_ENV->log_register and DB_ENV->log_unregister interfaces +were removed from the Berkeley DB 4.1 release. It is very unlikely +application programs used these interfaces. If your application used +these interfaces, please contact Sleepycat Software support for help in +upgrading. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/fop.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/log_stat.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/log_stat.html b/db/docs/ref/upgrade.4.1/log_stat.html new file mode 100644 index 000000000..2e1cfde6e --- /dev/null +++ b/db/docs/ref/upgrade.4.1/log_stat.html @@ -0,0 +1,26 @@ +<!--Id: log_stat.so,v 1.1 2002/01/11 16:33:12 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: st_flushcommit</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/log_register.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/checkpoint.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: st_flushcommit</h1> +<p>The DB_ENV->log_stat "st_flushcommits" statistic has been removed +from Berkeley DB, as it is now the same as the "st_scount" statistic. Any +application using the "st_flushcommits" statistic should remove it, or +replace it with the "st_count" statistic. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/log_register.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/checkpoint.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/memp_sync.html b/db/docs/ref/upgrade.4.1/memp_sync.html new file mode 100644 index 000000000..0d164e815 --- /dev/null +++ b/db/docs/ref/upgrade.4.1/memp_sync.html @@ -0,0 +1,31 @@ +<!--Id: memp_sync.so,v 1.3 2002/03/26 22:57:17 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Release 4.1: DB_ENV->memp_sync</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../ref/upgrade.4.1/incomplete.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/app_dispatch.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p> +<h1 align=center>Release 4.1: DB_ENV->memp_sync</h1> +<p>Historical documentation for the <a href="../../api_c/memp_sync.html">DB_ENV->memp_sync</a> interface stated: +<p><blockquote><pre>In addition, if <a href="../../api_c/memp_sync.html">DB_ENV->memp_sync</a> returns success, the value of +<b>lsn</b> will be overwritten with the largest log sequence number +from any page that was written by <a href="../../api_c/memp_sync.html">DB_ENV->memp_sync</a> to satisfy this +request.</pre></blockquote> +<p>This functionality was never correctly implemented, and has been removed +in the Berkeley DB 4.1 release. It is very unlikely application programs used +this information. If your application used this information, please +contact Sleepycat Software support for help in upgrading. +<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/upgrade.4.1/incomplete.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/upgrade.4.1/app_dispatch.html"><img src="../../images/next.gif" alt="Next"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/docs/ref/upgrade.4.1/toc.html b/db/docs/ref/upgrade.4.1/toc.html new file mode 100644 index 000000000..0ec9d7b24 --- /dev/null +++ b/db/docs/ref/upgrade.4.1/toc.html @@ -0,0 +1,34 @@ +<!--Id: toc.so,v 1.13 2002/08/12 21:12:06 bostic Exp --> +<!--Copyright 1997-2002 by Sleepycat Software, Inc.--> +<!--All rights reserved.--> +<!--See the file LICENSE for redistribution information.--> +<html> +<head> +<title>Berkeley DB Reference Guide: Upgrading Berkeley DB 4.0.X applications to Berkeley DB 4.1</title> +<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> +<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++"> +</head> +<body bgcolor=white> +<table width="100%"><tr valign=top> +<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></h3></td> +<td align=right><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p> +<h1 align=center>Upgrading Berkeley DB 4.0.X applications to Berkeley DB 4.1</h1> +<p><ol> +<p><li><a href="intro.html">Release 4.1: introduction</a> +<li><a href="excl.html">Release 4.1: DB_EXCL</a> +<li><a href="fop.html">Release 4.1: DB->associate, DB->open, DB->remove, DB->rename</a> +<li><a href="log_register.html">Release 4.1: DB_ENV->log_register</a> +<li><a href="log_stat.html">Release 4.1: st_flushcommit</a> +<li><a href="checkpoint.html">Release 4.1: DB_CHECKPOINT, DB_CURLSN</a> +<li><a href="incomplete.html">Release 4.1: DB_INCOMPLETE</a> +<li><a href="memp_sync.html">Release 4.1: DB_ENV->memp_sync</a> +<li><a href="app_dispatch.html">Release 4.1: Application-specific logging and recovery</a> +<li><a href="disk.html">Release 4.1: upgrade requirements</a> +</ol> +<table width="100%"><tr><td><br></td><td align=right><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a> +</td></tr></table> +<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font> +</body> +</html> diff --git a/db/env/env_file.c b/db/env/env_file.c new file mode 100644 index 000000000..c7b0fd2e0 --- /dev/null +++ b/db/env/env_file.c @@ -0,0 +1,166 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: env_file.c,v 1.5 2002/03/08 17:47:18 sue Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" + +static int __db_overwrite_pass __P((DB_ENV *, + const char *, DB_FH *, u_int32_t, u_int32_t, u_int32_t)); + +/* + * __db_fileinit -- + * Initialize a regular file, optionally zero-filling it as well. + * + * PUBLIC: int __db_fileinit __P((DB_ENV *, DB_FH *, size_t, int)); + */ +int +__db_fileinit(dbenv, fhp, size, zerofill) + DB_ENV *dbenv; + DB_FH *fhp; + size_t size; + int zerofill; +{ + db_pgno_t pages; + size_t i; + size_t nw; + u_int32_t relative; + int ret; + char buf[OS_VMPAGESIZE]; + + /* Write nuls to the new bytes. */ + memset(buf, 0, sizeof(buf)); + + /* + * Extend the region by writing the last page. If the region is >4Gb, + * increment may be larger than the maximum possible seek "relative" + * argument, as it's an unsigned 32-bit value. Break the offset into + * pages of 1MB each so that we don't overflow (2^20 + 2^32 is bigger + * than any memory I expect to see for awhile). + */ + if ((ret = __os_seek(dbenv, fhp, 0, 0, 0, 0, DB_OS_SEEK_END)) != 0) + return (ret); + pages = (db_pgno_t)((size - OS_VMPAGESIZE) / MEGABYTE); + relative = (u_int32_t)((size - OS_VMPAGESIZE) % MEGABYTE); + if ((ret = __os_seek(dbenv, + fhp, MEGABYTE, pages, relative, 0, DB_OS_SEEK_CUR)) != 0) + return (ret); + if ((ret = __os_write(dbenv, fhp, buf, sizeof(buf), &nw)) != 0) + return (ret); + + /* + * We may want to guarantee that there is enough disk space for the + * file, so we also write a byte to each page. We write the byte + * because reading it is insufficient on systems smart enough not to + * instantiate disk pages to satisfy a read (e.g., Solaris). + */ + if (zerofill) { + pages = (db_pgno_t)(size / MEGABYTE); + relative = (u_int32_t)(size % MEGABYTE); + if ((ret = __os_seek(dbenv, fhp, + MEGABYTE, pages, relative, 1, DB_OS_SEEK_END)) != 0) + return (ret); + + /* Write a byte to each page. */ + for (i = 0; i < size; i += OS_VMPAGESIZE) { + if ((ret = __os_write(dbenv, fhp, buf, 1, &nw)) != 0) + return (ret); + if ((ret = __os_seek(dbenv, fhp, + 0, 0, OS_VMPAGESIZE - 1, 0, DB_OS_SEEK_CUR)) != 0) + return (ret); + } + } + return (0); +} + +/* + * __db_overwrite -- + * Overwrite a file. + * + * PUBLIC: int __db_overwrite __P((DB_ENV *, const char *)); + */ +int +__db_overwrite(dbenv, path) + DB_ENV *dbenv; + const char *path; +{ + DB_FH fh, *fhp; + u_int32_t mbytes, bytes; + int ret; + + fhp = &fh; + if ((ret = __os_open(dbenv, path, DB_OSO_REGION, 0, fhp)) == 0 && + (ret = __os_ioinfo(dbenv, path, fhp, &mbytes, &bytes, NULL)) == 0) { + /* + * !!! + * Overwrite a regular file with alternating 0xff, 0x00 and 0xff + * byte patterns. Implies a fixed-block filesystem, journaling + * or logging filesystems will require operating system support. + */ + if ((ret = __db_overwrite_pass( + dbenv, path, fhp, mbytes, bytes, 0xff)) != 0) + goto err; + if ((ret = __db_overwrite_pass( + dbenv, path, fhp, mbytes, bytes, 0x00)) != 0) + goto err; + if ((ret = __db_overwrite_pass( + dbenv, path, fhp, mbytes, bytes, 0xff)) != 0) + goto err; + } else + __db_err(dbenv, "%s: %s", path, db_strerror(ret)); + +err: if (F_ISSET(fhp, DB_FH_VALID)) + __os_closehandle(dbenv, fhp); + return (ret); +} + +/* + * __db_overwrite_pass -- + * A single pass over the file, writing the specified byte pattern. + */ +static int +__db_overwrite_pass(dbenv, path, fhp, mbytes, bytes, pattern) + DB_ENV *dbenv; + const char *path; + DB_FH *fhp; + u_int32_t mbytes, bytes, pattern; +{ + size_t len, nw; + int i, ret; + char buf[8 * 1024]; + + if ((ret = __os_seek(dbenv, fhp, 0, 0, 0, 0, DB_OS_SEEK_SET)) != 0) + goto err; + + memset(buf, pattern, sizeof(buf)); + + for (; mbytes > 0; --mbytes) + for (i = MEGABYTE / sizeof(buf); i > 0; --i) + if ((ret = + __os_write(dbenv, fhp, buf, sizeof(buf), &nw)) != 0) + goto err; + for (; bytes > 0; bytes -= (u_int32_t)len) { + len = bytes < sizeof(buf) ? bytes : sizeof(buf); + if ((ret = __os_write(dbenv, fhp, buf, len, &nw)) != 0) + goto err; + } + + if ((ret = __os_fsync(dbenv, fhp)) != 0) +err: __db_err(dbenv, "%s: %s", path, db_strerror(ret)); + + return (ret); +} diff --git a/db/examples_c/ex_apprec/auto_rebuild b/db/examples_c/ex_apprec/auto_rebuild new file mode 100644 index 000000000..342519848 --- /dev/null +++ b/db/examples_c/ex_apprec/auto_rebuild @@ -0,0 +1,9 @@ +# Script to rebuild automatically generated files for ex_apprec. + +E=../examples_c/ex_apprec + +cd ../../dist +awk -f gen_rec.awk \ + -v source_file=$E/ex_apprec_auto.c \ + -v header_file=$E/ex_apprec_auto.h \ + -v template_file=$E/ex_apprec_template < $E/ex_apprec.src diff --git a/db/examples_c/ex_apprec/ex_apprec.c b/db/examples_c/ex_apprec/ex_apprec.c new file mode 100644 index 000000000..571388d4b --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec.c @@ -0,0 +1,267 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: ex_apprec.c,v 1.2 2002/08/06 05:39:01 bostic Exp + */ + +#include <sys/types.h> +#include <sys/stat.h> + +#include <errno.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <db.h> + +#include "ex_apprec.h" + +int apprec_dispatch __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); +int open_env __P((const char *, FILE *, const char *, DB_ENV **)); +int verify_absence __P((DB_ENV *, const char *)); +int verify_presence __P((DB_ENV *, const char *)); + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + DB_LSN lsn; + DB_TXN *txn; + DBT dirnamedbt; + int ret; + const char *home; + char ch, dirname[256]; + const char *progname = "ex_apprec"; /* Program name. */ + + /* Default home. */ + home = "TESTDIR"; + + while ((ch = getopt(argc, argv, "h:")) != EOF) + switch (ch) { + case 'h': + home = optarg; + break; + default: + fprintf(stderr, "usage: %s [-h home]", progname); + exit(EXIT_FAILURE); + } + + printf("Set up environment.\n"); + if ((ret = open_env(home, stderr, progname, &dbenv)) != 0) + return (EXIT_FAILURE); + + printf("Create a directory in a transaction.\n"); + /* + * This application's convention is to log the full directory name, + * including trailing nul. + */ + memset(&dirnamedbt, 0, sizeof(dirnamedbt)); + sprintf(dirname, "%s/MYDIRECTORY", home); + dirnamedbt.data = dirname; + dirnamedbt.size = strlen(dirname) + 1; + + if ((ret = dbenv->txn_begin(dbenv, NULL, &txn, 0)) != 0) { + dbenv->err(dbenv, ret, "txn_begin"); + return (EXIT_FAILURE); + } + + /* Remember, always log actions before you execute them! */ + memset(&lsn, 0, sizeof(lsn)); + if ((ret = + ex_apprec_mkdir_log(dbenv, txn, &lsn, 0, &dirnamedbt)) != 0) { + dbenv->err(dbenv, ret, "mkdir_log"); + return (EXIT_FAILURE); + } + if (mkdir(dirname, 0755) != 0) { + dbenv->err(dbenv, errno, "mkdir"); + return (EXIT_FAILURE); + } + + printf("Verify the directory's presence: "); + verify_presence(dbenv, dirname); + printf("check.\n"); + + /* Now abort the transaction and verify that the directory goes away. */ + printf("Abort the transaction.\n"); + if ((ret = txn->abort(txn)) != 0) { + dbenv->err(dbenv, ret, "txn_abort"); + return (EXIT_FAILURE); + } + + printf("Verify the directory's absence: "); + verify_absence(dbenv, dirname); + printf("check.\n"); + + /* Now do the same thing over again, only with a commit this time. */ + printf("Create a directory in a transaction.\n"); + memset(&dirnamedbt, 0, sizeof(dirnamedbt)); + sprintf(dirname, "%s/MYDIRECTORY", home); + dirnamedbt.data = dirname; + dirnamedbt.size = strlen(dirname) + 1; + if ((ret = dbenv->txn_begin(dbenv, NULL, &txn, 0)) != 0) { + dbenv->err(dbenv, ret, "txn_begin"); + return (EXIT_FAILURE); + } + + memset(&lsn, 0, sizeof(lsn)); + if ((ret = + ex_apprec_mkdir_log(dbenv, txn, &lsn, 0, &dirnamedbt)) != 0) { + dbenv->err(dbenv, ret, "mkdir_log"); + return (EXIT_FAILURE); + } + if (mkdir(dirname, 0755) != 0) { + dbenv->err(dbenv, errno, "mkdir"); + return (EXIT_FAILURE); + } + + printf("Verify the directory's presence: "); + verify_presence(dbenv, dirname); + printf("check.\n"); + + /* Now abort the transaction and verify that the directory goes away. */ + printf("Commit the transaction.\n"); + if ((ret = txn->commit(txn, 0)) != 0) { + dbenv->err(dbenv, ret, "txn_commit"); + return (EXIT_FAILURE); + } + + printf("Verify the directory's presence: "); + verify_presence(dbenv, dirname); + printf("check.\n"); + + printf("Now remove the directory, then run recovery.\n"); + if ((ret = dbenv->close(dbenv, 0)) != 0) { + fprintf(stderr, "DB_ENV->close: %s\n", db_strerror(ret)); + return (EXIT_FAILURE); + } + if (rmdir(dirname) != 0) { + fprintf(stderr, + "%s: rmdir failed with error %s", progname, + strerror(errno)); + } + verify_absence(dbenv, dirname); + + /* Opening with DB_RECOVER runs recovery. */ + if ((ret = open_env(home, stderr, progname, &dbenv)) != 0) + return (EXIT_FAILURE); + + printf("Verify the directory's presence: "); + verify_presence(dbenv, dirname); + printf("check.\n"); + + /* Close the handle. */ + if ((ret = dbenv->close(dbenv, 0)) != 0) { + fprintf(stderr, "DB_ENV->close: %s\n", db_strerror(ret)); + return (EXIT_FAILURE); + } + + return (EXIT_SUCCESS); +} + +int +open_env(home, errfp, progname, dbenvp) + const char *home, *progname; + FILE *errfp; + DB_ENV **dbenvp; +{ + DB_ENV *dbenv; + int ret; + + /* + * Create an environment object and initialize it for error + * reporting. + */ + if ((ret = db_env_create(&dbenv, 0)) != 0) { + fprintf(errfp, "%s: %s\n", progname, db_strerror(ret)); + return (ret); + } + dbenv->set_errfile(dbenv, errfp); + dbenv->set_errpfx(dbenv, progname); + + /* Set up our custom recovery dispatch function. */ + if ((ret = dbenv->set_app_dispatch(dbenv, apprec_dispatch)) != 0) { + dbenv->err(dbenv, ret, "set_app_dispatch"); + return (ret); + } + + /* + * Open the environment with full transactional support, running + * recovery. + */ + if ((ret = + dbenv->open(dbenv, home, DB_CREATE | DB_RECOVER | DB_INIT_LOCK | + DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN, 0)) != 0) { + dbenv->err(dbenv, ret, "environment open: %s", home); + dbenv->close(dbenv, 0); + return (ret); + } + + *dbenvp = dbenv; + return (0); +} + +/* + * Sample application dispatch function to handle user-specified log record + * types. + */ +int +apprec_dispatch(dbenv, dbt, lsn, op) + DB_ENV *dbenv; + DBT *dbt; + DB_LSN *lsn; + db_recops op; +{ + u_int32_t rectype; + + /* Pull the record type out of the log record. */ + memcpy(&rectype, dbt->data, sizeof(rectype)); + + switch (rectype) { + case DB_ex_apprec_mkdir: + return (ex_apprec_mkdir_recover(dbenv, dbt, lsn, op, NULL)); + default: + /* + * We've hit an unexpected, allegedly user-defined record + * type. + */ + dbenv->errx(dbenv, "Unexpected log record type encountered"); + return (EINVAL); + } +} + +int +verify_absence(dbenv, dirname) + DB_ENV *dbenv; + const char *dirname; +{ + + if (access(dirname, F_OK) == 0) { + dbenv->errx(dbenv, "Error--directory present!"); + exit(EXIT_FAILURE); + } + + return (0); +} + +int +verify_presence(dbenv, dirname) + DB_ENV *dbenv; + const char *dirname; +{ + + if (access(dirname, F_OK) != 0) { + dbenv->errx(dbenv, "Error--directory not present!"); + exit(EXIT_FAILURE); + } + + return (0); +} diff --git a/db/examples_c/ex_apprec/ex_apprec.h b/db/examples_c/ex_apprec/ex_apprec.h new file mode 100644 index 000000000..f4899de29 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec.h @@ -0,0 +1,24 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2002 + * Sleepycat Software. All rights reserved. + * + * Id: ex_apprec.h,v 1.2 2002/08/08 15:47:00 bostic Exp + */ + +#ifndef _EX_APPREC_H_ +#define _EX_APPREC_H_ + +#include "ex_apprec_auto.h" + +int ex_apprec_mkdir_log + __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t, const DBT *)); +int ex_apprec_mkdir_print + __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); +int ex_apprec_mkdir_read + __P((DB_ENV *, void *, ex_apprec_mkdir_args **)); +int ex_apprec_mkdir_recover + __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + +#endif /* !_EX_APPREC_H_ */ diff --git a/db/examples_c/ex_apprec/ex_apprec.src b/db/examples_c/ex_apprec/ex_apprec.src new file mode 100644 index 000000000..986b57b68 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec.src @@ -0,0 +1,41 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2002 + * Sleepycat Software. All rights reserved. + * + * Id: ex_apprec.src,v 1.3 2002/08/08 15:47:00 bostic Exp + */ + +PREFIX ex_apprec + +/* + * This is the source file used to generate the application-specific recovery + * functions used by the ex_apprec example. It should be turned into usable + * source code (including a template for the recovery function itself) by + * invoking changing to the dist directory of the DB distribution and + * running the gen_rec.awk script there as follows: + * + * awk -f ./gen_rec.awk \ + * -v source_file=../examples_c/ex_apprec/ex_apprec_auto.c \ + * -v header_file=../examples_c/ex_apprec/ex_apprec_auto.h \ + * -v template_file=../examples_c/ex_apprec/ex_apprec_template \ + * < ../examples_c/ex_apprec/ex_apprec.src + +INCLUDE #include <ctype.h> +INCLUDE #include <errno.h> +INCLUDE #include <stdlib.h> +INCLUDE #include <string.h> +INCLUDE +INCLUDE #include <db.h> +INCLUDE +INCLUDE #include "ex_apprec.h" + +/* + * mkdir: used to create a directory + * + * dirname: relative or absolute pathname of the directory to be created + */ +BEGIN mkdir 10000 +DBT dirname DBT s +END diff --git a/db/examples_c/ex_apprec/ex_apprec_auto.c b/db/examples_c/ex_apprec/ex_apprec_auto.c new file mode 100644 index 000000000..d8c27e762 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec_auto.c @@ -0,0 +1,188 @@ +/* Do not edit: automatically built by gen_rec.awk. */ +#include <ctype.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> + +#include <db.h> + +#include "ex_apprec.h" +/* + * PUBLIC: int ex_apprec_mkdir_log __P((DB_ENV *, DB_TXN *, DB_LSN *, + * PUBLIC: u_int32_t, const DBT *)); + */ +int +ex_apprec_mkdir_log(dbenv, txnid, ret_lsnp, flags, + dirname) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *dirname; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ex_apprec_mkdir; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (dirname == NULL ? 0 : dirname->size); + if ((logrec.data = malloc(logrec.size)) == NULL) + return (ENOMEM); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + if (dirname == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &dirname->size, sizeof(dirname->size)); + bp += sizeof(dirname->size); + memcpy(bp, dirname->data, dirname->size); + bp += dirname->size; + } + + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)ex_apprec_mkdir_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int ex_apprec_mkdir_print __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +ex_apprec_mkdir_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + ex_apprec_mkdir_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = ex_apprec_mkdir_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]ex_apprec_mkdir: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\tdirname: "); + for (i = 0; i < argp->dirname.size; i++) { + ch = ((u_int8_t *)argp->dirname.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\n"); + free(argp); + return (0); +} + +/* + * PUBLIC: int ex_apprec_mkdir_read __P((DB_ENV *, void *, + * PUBLIC: ex_apprec_mkdir_args **)); + */ +int +ex_apprec_mkdir_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + ex_apprec_mkdir_args **argpp; +{ + ex_apprec_mkdir_args *argp; + u_int8_t *bp; + /* Keep the compiler quiet. */ + + dbenv = NULL; + if ((argp = malloc(sizeof(ex_apprec_mkdir_args) + sizeof(DB_TXN))) == NULL) + return (ENOMEM); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memset(&argp->dirname, 0, sizeof(argp->dirname)); + memcpy(&argp->dirname.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->dirname.data = bp; + bp += argp->dirname.size; + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int ex_apprec_init_print __P((DB_ENV *, int (***)(DB_ENV *, + * PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *)); + */ +int +ex_apprec_init_print(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int __db_add_recovery __P((DB_ENV *, + int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), + size_t *, + int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *), u_int32_t)); + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + ex_apprec_mkdir_print, DB_ex_apprec_mkdir)) != 0) + return (ret); + return (0); +} + diff --git a/db/examples_c/ex_apprec/ex_apprec_auto.h b/db/examples_c/ex_apprec/ex_apprec_auto.h new file mode 100644 index 000000000..358b1a9f0 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec_auto.h @@ -0,0 +1,13 @@ +/* Do not edit: automatically built by gen_rec.awk. */ + +#ifndef ex_apprec_AUTO_H +#define ex_apprec_AUTO_H +#define DB_ex_apprec_mkdir 10000 +typedef struct _ex_apprec_mkdir_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT dirname; +} ex_apprec_mkdir_args; + +#endif diff --git a/db/examples_c/ex_apprec/ex_apprec_rec.c b/db/examples_c/ex_apprec/ex_apprec_rec.c new file mode 100644 index 000000000..ea732c3e1 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec_rec.c @@ -0,0 +1,115 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + * + * Id: ex_apprec_rec.c,v 1.2 2002/08/06 05:39:02 bostic Exp + */ + +/* + * This file is based on the template file ex_apprec_template. Note that + * because ex_apprec_mkdir, like most application-specific recovery functions, + * does not make use of DB-private structures, it has actually been simplified + * significantly. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <stdlib.h> +#include <unistd.h> + +#include <db.h> + +#include "ex_apprec.h" + +/* + * ex_apprec_mkdir_recover -- + * Recovery function for mkdir. + * + * PUBLIC: int ex_apprec_mkdir_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +ex_apprec_mkdir_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + ex_apprec_mkdir_args *argp; + int ret; + + argp = NULL; + + /* + * Shut up the compiler--"info" is used for the recovery functions + * belonging to transaction meta-operations such as txn_create, and + * need not concern us here either. + */ + info = NULL; + + if ((ret = ex_apprec_mkdir_read(dbenv, dbtp->data, &argp)) != 0) + goto out; + + switch (op) { + case DB_TXN_ABORT: + case DB_TXN_BACKWARD_ROLL: + /* + * If we're aborting, we need to remove the directory if it + * exists. We log the trailing zero in pathnames, so we can + * simply pass the data part of the DBT into rmdir as a string. + * (Note that we don't have any alignment guarantees, but for + * a char * this doesn't matter.) + * + * Ignore all errors other than ENOENT; DB may attempt to undo + * or redo operations without knowing whether they have already + * been done or undone, so we should never assume in a recovery + * function that the task definitely needs doing or undoing. + */ + ret = rmdir(argp->dirname.data); + if (ret != 0 && errno != ENOENT) + dbenv->err(dbenv, ret, "Error in abort of mkdir"); + else + ret = 0; + break; + case DB_TXN_FORWARD_ROLL: + /* + * The forward direction is just the opposite; here, we ignore + * EEXIST, because the directory may already exist. + */ + ret = mkdir(argp->dirname.data, 0755); + if (ret != 0 && errno != EEXIST) + dbenv->err(dbenv, + ret, "Error in roll-forward of mkdir"); + else + ret = 0; + break; + default: + /* + * We might want to handle DB_TXN_PRINT or DB_TXN_APPLY here, + * too, but we don't try to print the log records and aren't + * using replication, so there's no need to in this example. + */ + dbenv->errx(dbenv, "Unexpected operation type\n"); + return (EINVAL); + } + + /* + * The recovery function is responsible for returning the LSN of the + * previous log record in this transaction, so that transaction aborts + * can follow the chain backwards. + * + * (If we'd wanted the LSN of this record earlier, we could have + * read it from lsnp, as well--but because we weren't working with + * pages or other objects that store their LSN and base recovery + * decisions on it, we didn't need to.) + */ + *lsnp = argp->prev_lsn; + +out: if (argp != NULL) + free(argp); + return (ret); +} diff --git a/db/examples_c/ex_apprec/ex_apprec_template b/db/examples_c/ex_apprec/ex_apprec_template new file mode 100644 index 000000000..e67ccb6d8 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec_template @@ -0,0 +1,75 @@ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/ex_apprec.h" +#include "dbinc/log.h" + +/* + * ex_apprec_mkdir_recover -- + * Recovery function for mkdir. + * + * PUBLIC: int ex_apprec_mkdir_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +ex_apprec_mkdir_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + ex_apprec_mkdir_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(ex_apprec_mkdir_print); + REC_INTRO(ex_apprec_mkdir_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + diff --git a/db/fileops/fileops.src b/db/fileops/fileops.src new file mode 100644 index 000000000..67ce97929 --- /dev/null +++ b/db/fileops/fileops.src @@ -0,0 +1,111 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: fileops.src,v 1.8 2002/04/06 18:25:55 bostic Exp + */ + +PREFIX __fop +DBPRIVATE + +INCLUDE #include "db_config.h" +INCLUDE +INCLUDE #ifndef NO_SYSTEM_INCLUDES +INCLUDE #include <sys/types.h> +INCLUDE +INCLUDE #include <ctype.h> +INCLUDE #include <string.h> +INCLUDE #endif +INCLUDE +INCLUDE #include "db_int.h" +INCLUDE #include "dbinc/crypto.h" +INCLUDE #include "dbinc/db_page.h" +INCLUDE #include "dbinc/db_dispatch.h" +INCLUDE #include "dbinc/db_am.h" +INCLUDE #include "dbinc/log.h" +INCLUDE #include "dbinc/rep.h" +INCLUDE #include "dbinc/txn.h" +INCLUDE #include "dbinc/fop.h" +INCLUDE + +/* + * create -- create a file system object. + * + * name: name in the file system + * appname: indicates if the name needs to go through __db_appname + * mode: file system mode + */ +BEGIN create 143 +DBT name DBT s +ARG appname u_int32_t lu +ARG mode u_int32_t o +END + +/* + * remove -- remove a file system object. + * + * name: name in the file system + * appname: indicates if the name needs to go through __db_appname + */ +BEGIN remove 144 +DBT name DBT s +DBT fid DBT s +ARG appname u_int32_t lu +END + +/* + * write: log the writing of data into an object. + * + * name: file containing the page. + * appname: indicates if the name needs to go through __db_appname + * offset: offset in the file. + * page: the actual meta-data page. + * flag: non-0 indicates that this is a tempfile, so we needn't undo + * these modifications (we'll toss the file). + */ +BEGIN write 145 +DBT name DBT s +ARG appname u_int32_t lu +ARG offset u_int32_t lu +PGDBT page DBT s +ARG flag u_int32_t lu +END + +/* + * rename: move a file from one name to another. + * The appname value indicates if this is a path name that should be used + * directly (i.e., no interpretation) or if it is a pathname that should + * be interpreted via calls to __db_appname. The fileid is the 20-byte + * DB fileid of the file being renamed. We need to check it on recovery + * so that we don't inadvertently overwrite good files. + */ +BEGIN rename 146 +DBT oldname DBT s +DBT newname DBT s +DBT fileid DBT s +ARG appname u_int32_t lu +END + +/* + * File removal record. This is a DB-level log record that indicates + * we've just completed some form of file removal. The purpose of this + * log record is to logically identify the particular instance of the + * named file so that during recovery, in deciding if we should roll-forward + * a remove or a rename, we can make sure that we don't roll one forward and + * delete or overwrite the wrong file. + * real_fid: The 20-byte unique file identifier of the original file being + * removed. + * tmp_fid: The unique fid of the tmp file that is removed. + * name: The pre- __db_appname name of the file + * child: The transaction that removed or renamed the file. + */ + */ +BEGIN file_remove 141 +DBT real_fid DBT s +DBT tmp_fid DBT s +DBT name DBT s +ARG appname u_int32_t lu +ARG child u_int32_t lx +END diff --git a/db/fileops/fileops_auto.c b/db/fileops/fileops_auto.c new file mode 100644 index 000000000..f38640b74 --- /dev/null +++ b/db/fileops/fileops_auto.c @@ -0,0 +1,1371 @@ +/* Do not edit: automatically built by gen_rec.awk. */ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <ctype.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/crypto.h" +#include "dbinc/db_page.h" +#include "dbinc/db_dispatch.h" +#include "dbinc/db_am.h" +#include "dbinc/log.h" +#include "dbinc/rep.h" +#include "dbinc/txn.h" +#include "dbinc/fop.h" + +/* + * PUBLIC: int __fop_create_log __P((DB_ENV *, DB_TXN *, DB_LSN *, + * PUBLIC: u_int32_t, const DBT *, u_int32_t, u_int32_t)); + */ +int +__fop_create_log(dbenv, txnid, ret_lsnp, flags, + name, appname, mode) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *name; + u_int32_t appname; + u_int32_t mode; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t uinttmp; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB___fop_create; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + if (TAILQ_FIRST(&txnid->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + return (ret); + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (name == NULL ? 0 : name->size) + + sizeof(u_int32_t) + + sizeof(u_int32_t); + if (CRYPTO_ON(dbenv)) { + npad = + ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size); + logrec.size += npad; + } + + if ((ret = __os_malloc(dbenv, + logrec.size, &logrec.data)) != 0) + return (ret); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + if (name == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &name->size, sizeof(name->size)); + bp += sizeof(name->size); + memcpy(bp, name->data, name->size); + bp += name->size; + } + + uinttmp = (u_int32_t)appname; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + uinttmp = (u_int32_t)mode; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)__fop_create_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + __os_free(dbenv, logrec.data); + return (ret); +} + +/* + * PUBLIC: int __fop_create_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_create_getpgnos(dbenv, rec, lsnp, notused1, summary) + DB_ENV *dbenv; + DBT *rec; + DB_LSN *lsnp; + db_recops notused1; + void *summary; +{ + TXN_RECS *t; + int ret; + COMPQUIET(rec, NULL); + COMPQUIET(notused1, DB_TXN_ABORT); + + t = (TXN_RECS *)summary; + + if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0) + return (ret); + + t->array[t->npages].flags = LSN_PAGE_NOLOCK; + t->array[t->npages].lsn = *lsnp; + t->array[t->npages].fid = DB_LOGFILEID_INVALID; + memset(&t->array[t->npages].pgdesc, 0, + sizeof(t->array[t->npages].pgdesc)); + + t->npages++; + + return (0); +} + +/* + * PUBLIC: int __fop_create_print __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_create_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + __fop_create_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = __fop_create_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]__fop_create: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\tname: "); + for (i = 0; i < argp->name.size; i++) { + ch = ((u_int8_t *)argp->name.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tappname: %lu\n", (u_long)argp->appname); + (void)printf("\tmode: %o\n", argp->mode); + (void)printf("\n"); + __os_free(dbenv, argp); + return (0); +} + +/* + * PUBLIC: int __fop_create_read __P((DB_ENV *, void *, __fop_create_args **)); + */ +int +__fop_create_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + __fop_create_args **argpp; +{ + __fop_create_args *argp; + u_int32_t uinttmp; + u_int8_t *bp; + int ret; + + if ((ret = __os_malloc(dbenv, + sizeof(__fop_create_args) + sizeof(DB_TXN), &argp)) != 0) + return (ret); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memset(&argp->name, 0, sizeof(argp->name)); + memcpy(&argp->name.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->name.data = bp; + bp += argp->name.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->appname = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->mode = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __fop_remove_log __P((DB_ENV *, DB_TXN *, DB_LSN *, + * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t)); + */ +int +__fop_remove_log(dbenv, txnid, ret_lsnp, flags, + name, fid, appname) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *name; + const DBT *fid; + u_int32_t appname; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t uinttmp; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB___fop_remove; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + if (TAILQ_FIRST(&txnid->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + return (ret); + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (name == NULL ? 0 : name->size) + + sizeof(u_int32_t) + (fid == NULL ? 0 : fid->size) + + sizeof(u_int32_t); + if (CRYPTO_ON(dbenv)) { + npad = + ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size); + logrec.size += npad; + } + + if ((ret = __os_malloc(dbenv, + logrec.size, &logrec.data)) != 0) + return (ret); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + if (name == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &name->size, sizeof(name->size)); + bp += sizeof(name->size); + memcpy(bp, name->data, name->size); + bp += name->size; + } + + if (fid == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &fid->size, sizeof(fid->size)); + bp += sizeof(fid->size); + memcpy(bp, fid->data, fid->size); + bp += fid->size; + } + + uinttmp = (u_int32_t)appname; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)__fop_remove_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + __os_free(dbenv, logrec.data); + return (ret); +} + +/* + * PUBLIC: int __fop_remove_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_remove_getpgnos(dbenv, rec, lsnp, notused1, summary) + DB_ENV *dbenv; + DBT *rec; + DB_LSN *lsnp; + db_recops notused1; + void *summary; +{ + TXN_RECS *t; + int ret; + COMPQUIET(rec, NULL); + COMPQUIET(notused1, DB_TXN_ABORT); + + t = (TXN_RECS *)summary; + + if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0) + return (ret); + + t->array[t->npages].flags = LSN_PAGE_NOLOCK; + t->array[t->npages].lsn = *lsnp; + t->array[t->npages].fid = DB_LOGFILEID_INVALID; + memset(&t->array[t->npages].pgdesc, 0, + sizeof(t->array[t->npages].pgdesc)); + + t->npages++; + + return (0); +} + +/* + * PUBLIC: int __fop_remove_print __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_remove_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + __fop_remove_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = __fop_remove_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]__fop_remove: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\tname: "); + for (i = 0; i < argp->name.size; i++) { + ch = ((u_int8_t *)argp->name.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tfid: "); + for (i = 0; i < argp->fid.size; i++) { + ch = ((u_int8_t *)argp->fid.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tappname: %lu\n", (u_long)argp->appname); + (void)printf("\n"); + __os_free(dbenv, argp); + return (0); +} + +/* + * PUBLIC: int __fop_remove_read __P((DB_ENV *, void *, __fop_remove_args **)); + */ +int +__fop_remove_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + __fop_remove_args **argpp; +{ + __fop_remove_args *argp; + u_int32_t uinttmp; + u_int8_t *bp; + int ret; + + if ((ret = __os_malloc(dbenv, + sizeof(__fop_remove_args) + sizeof(DB_TXN), &argp)) != 0) + return (ret); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memset(&argp->name, 0, sizeof(argp->name)); + memcpy(&argp->name.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->name.data = bp; + bp += argp->name.size; + + memset(&argp->fid, 0, sizeof(argp->fid)); + memcpy(&argp->fid.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->fid.data = bp; + bp += argp->fid.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->appname = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __fop_write_log __P((DB_ENV *, DB_TXN *, DB_LSN *, + * PUBLIC: u_int32_t, const DBT *, u_int32_t, u_int32_t, const DBT *, + * PUBLIC: u_int32_t)); + */ +int +__fop_write_log(dbenv, txnid, ret_lsnp, flags, + name, appname, offset, page, flag) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *name; + u_int32_t appname; + u_int32_t offset; + const DBT *page; + u_int32_t flag; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t uinttmp; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB___fop_write; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + if (TAILQ_FIRST(&txnid->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + return (ret); + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (name == NULL ? 0 : name->size) + + sizeof(u_int32_t) + + sizeof(u_int32_t) + + sizeof(u_int32_t) + (page == NULL ? 0 : page->size) + + sizeof(u_int32_t); + if (CRYPTO_ON(dbenv)) { + npad = + ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size); + logrec.size += npad; + } + + if ((ret = __os_malloc(dbenv, + logrec.size, &logrec.data)) != 0) + return (ret); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + if (name == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &name->size, sizeof(name->size)); + bp += sizeof(name->size); + memcpy(bp, name->data, name->size); + bp += name->size; + } + + uinttmp = (u_int32_t)appname; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + uinttmp = (u_int32_t)offset; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + if (page == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &page->size, sizeof(page->size)); + bp += sizeof(page->size); + memcpy(bp, page->data, page->size); + bp += page->size; + } + + uinttmp = (u_int32_t)flag; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)__fop_write_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + __os_free(dbenv, logrec.data); + return (ret); +} + +/* + * PUBLIC: int __fop_write_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_write_getpgnos(dbenv, rec, lsnp, notused1, summary) + DB_ENV *dbenv; + DBT *rec; + DB_LSN *lsnp; + db_recops notused1; + void *summary; +{ + TXN_RECS *t; + int ret; + COMPQUIET(rec, NULL); + COMPQUIET(notused1, DB_TXN_ABORT); + + t = (TXN_RECS *)summary; + + if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0) + return (ret); + + t->array[t->npages].flags = LSN_PAGE_NOLOCK; + t->array[t->npages].lsn = *lsnp; + t->array[t->npages].fid = DB_LOGFILEID_INVALID; + memset(&t->array[t->npages].pgdesc, 0, + sizeof(t->array[t->npages].pgdesc)); + + t->npages++; + + return (0); +} + +/* + * PUBLIC: int __fop_write_print __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_write_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + __fop_write_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = __fop_write_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]__fop_write: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\tname: "); + for (i = 0; i < argp->name.size; i++) { + ch = ((u_int8_t *)argp->name.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tappname: %lu\n", (u_long)argp->appname); + (void)printf("\toffset: %lu\n", (u_long)argp->offset); + (void)printf("\tpage: "); + for (i = 0; i < argp->page.size; i++) { + ch = ((u_int8_t *)argp->page.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tflag: %lu\n", (u_long)argp->flag); + (void)printf("\n"); + __os_free(dbenv, argp); + return (0); +} + +/* + * PUBLIC: int __fop_write_read __P((DB_ENV *, void *, __fop_write_args **)); + */ +int +__fop_write_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + __fop_write_args **argpp; +{ + __fop_write_args *argp; + u_int32_t uinttmp; + u_int8_t *bp; + int ret; + + if ((ret = __os_malloc(dbenv, + sizeof(__fop_write_args) + sizeof(DB_TXN), &argp)) != 0) + return (ret); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memset(&argp->name, 0, sizeof(argp->name)); + memcpy(&argp->name.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->name.data = bp; + bp += argp->name.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->appname = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->offset = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + memset(&argp->page, 0, sizeof(argp->page)); + memcpy(&argp->page.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->page.data = bp; + bp += argp->page.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->flag = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __fop_rename_log __P((DB_ENV *, DB_TXN *, DB_LSN *, + * PUBLIC: u_int32_t, const DBT *, const DBT *, const DBT *, u_int32_t)); + */ +int +__fop_rename_log(dbenv, txnid, ret_lsnp, flags, + oldname, newname, fileid, appname) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *oldname; + const DBT *newname; + const DBT *fileid; + u_int32_t appname; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t uinttmp; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB___fop_rename; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + if (TAILQ_FIRST(&txnid->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + return (ret); + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (oldname == NULL ? 0 : oldname->size) + + sizeof(u_int32_t) + (newname == NULL ? 0 : newname->size) + + sizeof(u_int32_t) + (fileid == NULL ? 0 : fileid->size) + + sizeof(u_int32_t); + if (CRYPTO_ON(dbenv)) { + npad = + ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size); + logrec.size += npad; + } + + if ((ret = __os_malloc(dbenv, + logrec.size, &logrec.data)) != 0) + return (ret); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + if (oldname == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &oldname->size, sizeof(oldname->size)); + bp += sizeof(oldname->size); + memcpy(bp, oldname->data, oldname->size); + bp += oldname->size; + } + + if (newname == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &newname->size, sizeof(newname->size)); + bp += sizeof(newname->size); + memcpy(bp, newname->data, newname->size); + bp += newname->size; + } + + if (fileid == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &fileid->size, sizeof(fileid->size)); + bp += sizeof(fileid->size); + memcpy(bp, fileid->data, fileid->size); + bp += fileid->size; + } + + uinttmp = (u_int32_t)appname; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)__fop_rename_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + __os_free(dbenv, logrec.data); + return (ret); +} + +/* + * PUBLIC: int __fop_rename_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_rename_getpgnos(dbenv, rec, lsnp, notused1, summary) + DB_ENV *dbenv; + DBT *rec; + DB_LSN *lsnp; + db_recops notused1; + void *summary; +{ + TXN_RECS *t; + int ret; + COMPQUIET(rec, NULL); + COMPQUIET(notused1, DB_TXN_ABORT); + + t = (TXN_RECS *)summary; + + if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0) + return (ret); + + t->array[t->npages].flags = LSN_PAGE_NOLOCK; + t->array[t->npages].lsn = *lsnp; + t->array[t->npages].fid = DB_LOGFILEID_INVALID; + memset(&t->array[t->npages].pgdesc, 0, + sizeof(t->array[t->npages].pgdesc)); + + t->npages++; + + return (0); +} + +/* + * PUBLIC: int __fop_rename_print __P((DB_ENV *, DBT *, DB_LSN *, + * PUBLIC: db_recops, void *)); + */ +int +__fop_rename_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + __fop_rename_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = __fop_rename_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]__fop_rename: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\toldname: "); + for (i = 0; i < argp->oldname.size; i++) { + ch = ((u_int8_t *)argp->oldname.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tnewname: "); + for (i = 0; i < argp->newname.size; i++) { + ch = ((u_int8_t *)argp->newname.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tfileid: "); + for (i = 0; i < argp->fileid.size; i++) { + ch = ((u_int8_t *)argp->fileid.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tappname: %lu\n", (u_long)argp->appname); + (void)printf("\n"); + __os_free(dbenv, argp); + return (0); +} + +/* + * PUBLIC: int __fop_rename_read __P((DB_ENV *, void *, __fop_rename_args **)); + */ +int +__fop_rename_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + __fop_rename_args **argpp; +{ + __fop_rename_args *argp; + u_int32_t uinttmp; + u_int8_t *bp; + int ret; + + if ((ret = __os_malloc(dbenv, + sizeof(__fop_rename_args) + sizeof(DB_TXN), &argp)) != 0) + return (ret); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memset(&argp->oldname, 0, sizeof(argp->oldname)); + memcpy(&argp->oldname.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->oldname.data = bp; + bp += argp->oldname.size; + + memset(&argp->newname, 0, sizeof(argp->newname)); + memcpy(&argp->newname.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->newname.data = bp; + bp += argp->newname.size; + + memset(&argp->fileid, 0, sizeof(argp->fileid)); + memcpy(&argp->fileid.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->fileid.data = bp; + bp += argp->fileid.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->appname = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __fop_file_remove_log __P((DB_ENV *, DB_TXN *, + * PUBLIC: DB_LSN *, u_int32_t, const DBT *, const DBT *, const DBT *, + * PUBLIC: u_int32_t, u_int32_t)); + */ +int +__fop_file_remove_log(dbenv, txnid, ret_lsnp, flags, + real_fid, tmp_fid, name, appname, child) + DB_ENV *dbenv; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *real_fid; + const DBT *tmp_fid; + const DBT *name; + u_int32_t appname; + u_int32_t child; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t uinttmp; + u_int32_t npad, rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB___fop_file_remove; + npad = 0; + + if (txnid == NULL) { + txn_num = 0; + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else { + if (TAILQ_FIRST(&txnid->kids) != NULL && + (ret = __txn_activekids(dbenv, rectype, txnid)) != 0) + return (ret); + txn_num = txnid->txnid; + lsnp = &txnid->last_lsn; + } + + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (real_fid == NULL ? 0 : real_fid->size) + + sizeof(u_int32_t) + (tmp_fid == NULL ? 0 : tmp_fid->size) + + sizeof(u_int32_t) + (name == NULL ? 0 : name->size) + + sizeof(u_int32_t) + + sizeof(u_int32_t); + if (CRYPTO_ON(dbenv)) { + npad = + ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size); + logrec.size += npad; + } + + if ((ret = __os_malloc(dbenv, + logrec.size, &logrec.data)) != 0) + return (ret); + + if (npad > 0) + memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad); + + bp = logrec.data; + + memcpy(bp, &rectype, sizeof(rectype)); + bp += sizeof(rectype); + + memcpy(bp, &txn_num, sizeof(txn_num)); + bp += sizeof(txn_num); + + memcpy(bp, lsnp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + if (real_fid == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &real_fid->size, sizeof(real_fid->size)); + bp += sizeof(real_fid->size); + memcpy(bp, real_fid->data, real_fid->size); + bp += real_fid->size; + } + + if (tmp_fid == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &tmp_fid->size, sizeof(tmp_fid->size)); + bp += sizeof(tmp_fid->size); + memcpy(bp, tmp_fid->data, tmp_fid->size); + bp += tmp_fid->size; + } + + if (name == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &name->size, sizeof(name->size)); + bp += sizeof(name->size); + memcpy(bp, name->data, name->size); + bp += name->size; + } + + uinttmp = (u_int32_t)appname; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + uinttmp = (u_int32_t)child; + memcpy(bp, &uinttmp, sizeof(uinttmp)); + bp += sizeof(uinttmp); + + DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size); + ret = dbenv->log_put(dbenv, + ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY); + if (txnid != NULL && ret == 0) + txnid->last_lsn = *ret_lsnp; +#ifdef LOG_DIAGNOSTIC + if (ret != 0) + (void)__fop_file_remove_print(dbenv, + (DBT *)&logrec, ret_lsnp, NULL, NULL); +#endif + __os_free(dbenv, logrec.data); + return (ret); +} + +/* + * PUBLIC: int __fop_file_remove_getpgnos __P((DB_ENV *, DBT *, + * PUBLIC: DB_LSN *, db_recops, void *)); + */ +int +__fop_file_remove_getpgnos(dbenv, rec, lsnp, notused1, summary) + DB_ENV *dbenv; + DBT *rec; + DB_LSN *lsnp; + db_recops notused1; + void *summary; +{ + TXN_RECS *t; + int ret; + COMPQUIET(rec, NULL); + COMPQUIET(notused1, DB_TXN_ABORT); + + t = (TXN_RECS *)summary; + + if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0) + return (ret); + + t->array[t->npages].flags = LSN_PAGE_NOLOCK; + t->array[t->npages].lsn = *lsnp; + t->array[t->npages].fid = DB_LOGFILEID_INVALID; + memset(&t->array[t->npages].pgdesc, 0, + sizeof(t->array[t->npages].pgdesc)); + + t->npages++; + + return (0); +} + +/* + * PUBLIC: int __fop_file_remove_print __P((DB_ENV *, DBT *, + * PUBLIC: DB_LSN *, db_recops, void *)); + */ +int +__fop_file_remove_print(dbenv, dbtp, lsnp, notused2, notused3) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops notused2; + void *notused3; +{ + __fop_file_remove_args *argp; + u_int32_t i; + int ch; + int ret; + + notused2 = DB_TXN_ABORT; + notused3 = NULL; + + if ((ret = __fop_file_remove_read(dbenv, dbtp->data, &argp)) != 0) + return (ret); + (void)printf( + "[%lu][%lu]__fop_file_remove: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", + (u_long)lsnp->file, + (u_long)lsnp->offset, + (u_long)argp->type, + (u_long)argp->txnid->txnid, + (u_long)argp->prev_lsn.file, + (u_long)argp->prev_lsn.offset); + (void)printf("\treal_fid: "); + for (i = 0; i < argp->real_fid.size; i++) { + ch = ((u_int8_t *)argp->real_fid.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\ttmp_fid: "); + for (i = 0; i < argp->tmp_fid.size; i++) { + ch = ((u_int8_t *)argp->tmp_fid.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tname: "); + for (i = 0; i < argp->name.size; i++) { + ch = ((u_int8_t *)argp->name.data)[i]; + printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch); + } + (void)printf("\n"); + (void)printf("\tappname: %lu\n", (u_long)argp->appname); + (void)printf("\tchild: 0x%lx\n", (u_long)argp->child); + (void)printf("\n"); + __os_free(dbenv, argp); + return (0); +} + +/* + * PUBLIC: int __fop_file_remove_read __P((DB_ENV *, void *, + * PUBLIC: __fop_file_remove_args **)); + */ +int +__fop_file_remove_read(dbenv, recbuf, argpp) + DB_ENV *dbenv; + void *recbuf; + __fop_file_remove_args **argpp; +{ + __fop_file_remove_args *argp; + u_int32_t uinttmp; + u_int8_t *bp; + int ret; + + if ((ret = __os_malloc(dbenv, + sizeof(__fop_file_remove_args) + sizeof(DB_TXN), &argp)) != 0) + return (ret); + + argp->txnid = (DB_TXN *)&argp[1]; + + bp = recbuf; + memcpy(&argp->type, bp, sizeof(argp->type)); + bp += sizeof(argp->type); + + memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); + bp += sizeof(argp->txnid->txnid); + + memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); + bp += sizeof(DB_LSN); + + memset(&argp->real_fid, 0, sizeof(argp->real_fid)); + memcpy(&argp->real_fid.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->real_fid.data = bp; + bp += argp->real_fid.size; + + memset(&argp->tmp_fid, 0, sizeof(argp->tmp_fid)); + memcpy(&argp->tmp_fid.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->tmp_fid.data = bp; + bp += argp->tmp_fid.size; + + memset(&argp->name, 0, sizeof(argp->name)); + memcpy(&argp->name.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->name.data = bp; + bp += argp->name.size; + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->appname = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + memcpy(&uinttmp, bp, sizeof(uinttmp)); + argp->child = (u_int32_t)uinttmp; + bp += sizeof(uinttmp); + + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __fop_init_print __P((DB_ENV *, int (***)(DB_ENV *, + * PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *)); + */ +int +__fop_init_print(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_create_print, DB___fop_create)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_remove_print, DB___fop_remove)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_write_print, DB___fop_write)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_rename_print, DB___fop_rename)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_file_remove_print, DB___fop_file_remove)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __fop_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, + * PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *)); + */ +int +__fop_init_getpgnos(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_create_getpgnos, DB___fop_create)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_remove_getpgnos, DB___fop_remove)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_write_getpgnos, DB___fop_write)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_rename_getpgnos, DB___fop_rename)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_file_remove_getpgnos, DB___fop_file_remove)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __fop_init_recover __P((DB_ENV *, int (***)(DB_ENV *, + * PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *)); + */ +int +__fop_init_recover(dbenv, dtabp, dtabsizep) + DB_ENV *dbenv; + int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + size_t *dtabsizep; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_create_recover, DB___fop_create)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_remove_recover, DB___fop_remove)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_write_recover, DB___fop_write)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_rename_recover, DB___fop_rename)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep, + __fop_file_remove_recover, DB___fop_file_remove)) != 0) + return (ret); + return (0); +} diff --git a/db/fileops/fop_basic.c b/db/fileops/fop_basic.c new file mode 100644 index 000000000..db3dae45c --- /dev/null +++ b/db/fileops/fop_basic.c @@ -0,0 +1,275 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: fop_basic.c,v 1.23 2002/08/11 02:11:23 margo Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <string.h> +#include <sys/types.h> +#endif + +#include "db_int.h" +#include "dbinc/log.h" +#include "dbinc/db_page.h" +#include "dbinc/fop.h" +#include "dbinc/txn.h" +#include "dbinc/db_am.h" + +/* + * This file implements the basic file-level operations. This code + * ought to be fairly independent of DB, other than through its + * error-reporting mechanism. + */ + +/* + * __fop_create -- + * Create a (transactionally protected) file system object. This is used + * to create DB files now, potentially blobs, queue extents and anything + * else you wish to store in a file system object. + * + * PUBLIC: int __fop_create __P((DB_ENV *, + * PUBLIC: DB_TXN *, DB_FH *, const char *, APPNAME, int)); + */ +int +__fop_create(dbenv, txn, fhp, name, appname, mode) + DB_ENV *dbenv; + DB_TXN *txn; + DB_FH *fhp; + const char *name; + APPNAME appname; + int mode; +{ + DB_FH fh; + DB_LSN lsn; + DBT data; + char *real_name; + int do_close, ret; + + ret = 0; + real_name = NULL; + + if (fhp != NULL) + do_close = 0; + else { + fhp = &fh; + memset(fhp, 0, sizeof(fh)); + do_close = 1; + } + + if (mode == 0) + mode = __db_omode("rw----"); + + if ((ret = + __db_appname(dbenv, appname, name, 0, NULL, &real_name)) != 0) + goto err; + + if (DBENV_LOGGING(dbenv)) { + memset(&data, 0, sizeof(data)); + data.data = (void *)name; + data.size = (u_int32_t)strlen(name) + 1; + if ((ret = __fop_create_log(dbenv, + txn, &lsn, DB_FLUSH, &data, (u_int32_t)appname, mode)) != 0) + goto err; + } + + DB_ENV_TEST_RECOVERY(dbenv, DB_TEST_POSTLOG, ret, name); + + ret = + __os_open(dbenv, real_name, DB_OSO_CREATE | DB_OSO_EXCL, mode, fhp); + +err: +DB_TEST_RECOVERY_LABEL + if (do_close && F_ISSET(fhp, DB_FH_VALID)) + __os_closehandle(dbenv, fhp); + if (real_name != NULL) + __os_free(dbenv, real_name); + return (ret); +} + +/* + * __fop_remove -- + * Remove a file system object. + * + * PUBLIC: int __fop_remove __P((DB_ENV *, + * PUBLIC: DB_TXN *, u_int8_t *, const char *, APPNAME)); + */ +int +__fop_remove(dbenv, txn, fileid, name, appname) + DB_ENV *dbenv; + DB_TXN *txn; + u_int8_t *fileid; + const char *name; + APPNAME appname; +{ + DB_LSN lsn; + DBT fdbt, ndbt; + char *real_name; + int ret; + + real_name = NULL; + + if ((ret = + __db_appname(dbenv, appname, name, 0, NULL, &real_name)) != 0) + goto err; + + if (txn == NULL) { + if (fileid != NULL && (ret = dbenv->memp_nameop( + dbenv, fileid, NULL, real_name, NULL)) != 0) + goto err; + } else { + if (DBENV_LOGGING(dbenv)) { + memset(&fdbt, 0, sizeof(ndbt)); + fdbt.data = fileid; + fdbt.size = fileid == NULL ? 0 : DB_FILE_ID_LEN; + memset(&ndbt, 0, sizeof(ndbt)); + ndbt.data = (void *)name; + ndbt.size = (u_int32_t)strlen(name) + 1; + if ((ret = __fop_remove_log(dbenv, + txn, &lsn, 0, &ndbt, &fdbt, appname)) != 0) + goto err; + } + ret = __txn_remevent(dbenv, txn, real_name, fileid); + } + +err: if (real_name != NULL) + __os_free(dbenv, real_name); + return (ret); +} + +/* + * __fop_write + * + * Write "size" bytes from "buf" to file "name" beginning at offset "off." + * If the file is open, supply a handle in fhp. Istmp indicate if this is + * an operation that needs to be undone in the face of failure (i.e., if + * this is a write to a temporary file, we're simply going to remove the + * file, so don't worry about undoing the write). + * + * Currently, we *only* use this with istmp true. If we need more general + * handling, then we'll have to zero out regions on abort (and possibly + * log the before image of the data in the log record). + * + * PUBLIC: int __fop_write __P((DB_ENV *, DB_TXN *, const char *, APPNAME, + * PUBLIC: DB_FH *, u_int32_t, u_int8_t *, u_int32_t, u_int32_t)); + */ +int +__fop_write(dbenv, txn, name, appname, fhp, off, buf, size, istmp) + DB_ENV *dbenv; + DB_TXN *txn; + const char *name; + APPNAME appname; + DB_FH *fhp; + u_int32_t off; + u_int8_t *buf; + u_int32_t size, istmp; +{ + DB_FH fh; + DB_LSN lsn; + DBT data, namedbt; + char *real_name; + int ret, t_ret, we_opened; + size_t nbytes; + + ret = 0; + we_opened = 0; + real_name = NULL; + + if ((ret = + __db_appname(dbenv, appname, name, 0, NULL, &real_name)) != 0) + goto err; + + if (DBENV_LOGGING(dbenv)) { + memset(&data, 0, sizeof(data)); + data.data = buf; + data.size = size; + memset(&namedbt, 0, sizeof(namedbt)); + namedbt.data = (void *)name; + namedbt.size = (u_int32_t)strlen(name) + 1; + if ((ret = __fop_write_log(dbenv, + txn, &lsn, 0, &namedbt, appname, off, &data, istmp)) != 0) + goto err; + } + + if (fhp == NULL) { + /* File isn't open; we need to reopen it. */ + if ((ret = __os_open(dbenv, real_name, 0, 0, &fh)) != 0) + goto err; + fhp = &fh; + we_opened = 1; + } else + we_opened = 0; + + /* Seek to offset. */ + if ((ret = __os_seek(dbenv, fhp, 0, 0, off, 0, DB_OS_SEEK_SET)) != 0) + goto err; + + /* Now do the write. */ + if ((ret = __os_write(dbenv, fhp, buf, size, &nbytes)) != 0) + goto err; + +err: if (we_opened) + if ((t_ret = __os_closehandle(dbenv, fhp)) != 0 && ret == 0) + ret = t_ret; + + if (real_name != NULL) + __os_free(dbenv, real_name); + return (ret); +} + +/* + * __fop_rename -- + * Change a file's name. + * + * PUBLIC: int __fop_rename __P((DB_ENV *, + * PUBLIC: DB_TXN *, const char *, const char *, u_int8_t *, APPNAME)); + */ +int +__fop_rename(dbenv, txn, oldname, newname, fid, appname) + DB_ENV *dbenv; + DB_TXN *txn; + const char *oldname; + const char *newname; + u_int8_t *fid; + APPNAME appname; +{ + DB_LSN lsn; + DBT fiddbt, new, old; + int ret; + char *n, *o; + + if ((ret = __db_appname(dbenv, appname, oldname, 0, NULL, &o)) != 0) + goto err; + if ((ret = __db_appname(dbenv, appname, newname, 0, NULL, &n)) != 0) + goto err; + + if (DBENV_LOGGING(dbenv)) { + memset(&old, 0, sizeof(old)); + memset(&new, 0, sizeof(new)); + memset(&fiddbt, 0, sizeof(fiddbt)); + old.data = (void *)oldname; + old.size = (u_int32_t)strlen(oldname) + 1; + new.data = (void *)newname; + new.size = (u_int32_t)strlen(newname) + 1; + fiddbt.data = fid; + fiddbt.size = DB_FILE_ID_LEN; + if ((ret = __fop_rename_log(dbenv, txn, &lsn, + DB_FLUSH, &old, &new, &fiddbt, (u_int32_t)appname)) != 0) + goto err; + } + + ret = dbenv->memp_nameop(dbenv, fid, newname, o, n); + +err: if (o != oldname) + __os_free(dbenv, o); + if (n != newname) + __os_free(dbenv, n); + return (ret); +} diff --git a/db/fileops/fop_rec.c b/db/fileops/fop_rec.c new file mode 100644 index 000000000..8150a81e4 --- /dev/null +++ b/db/fileops/fop_rec.c @@ -0,0 +1,310 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: fop_rec.c,v 1.16 2002/07/08 19:54:51 margo Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/fop.h" +#include "dbinc/db_am.h" +#include "dbinc/txn.h" + +/* + * __fop_create_recover -- + * Recovery function for create. + * + * PUBLIC: int __fop_create_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_create_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + DB_FH fh; + __fop_create_args *argp; + char *real_name; + int ret; + + real_name = NULL; + COMPQUIET(info, NULL); + REC_PRINT(__fop_create_print); + REC_NOOP_INTRO(__fop_create_read); + + if ((ret = __db_appname(dbenv, (APPNAME)argp->appname, + (const char *)argp->name.data, 0, NULL, &real_name)) != 0) + goto out; + + if (DB_UNDO(op)) + (void)__os_unlink(dbenv, real_name); + else if (DB_REDO(op)) + if ((ret = __os_open(dbenv, real_name, + DB_OSO_CREATE | DB_OSO_EXCL, argp->mode, &fh)) == 0) + __os_closehandle(dbenv, &fh); + + *lsnp = argp->prev_lsn; + +out: if (real_name != NULL) + __os_free(dbenv, real_name); + + REC_NOOP_CLOSE; +} + +/* + * __fop_remove_recover -- + * Recovery function for remove. + * + * PUBLIC: int __fop_remove_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_remove_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_remove_args *argp; + char *real_name; + int ret; + + real_name = NULL; + COMPQUIET(info, NULL); + REC_PRINT(__fop_remove_print); + REC_NOOP_INTRO(__fop_remove_read); + + if ((ret = __db_appname(dbenv, (APPNAME)argp->appname, + (const char *)argp->name.data, 0, NULL, &real_name)) != 0) + goto out; + + if (DB_REDO(op) && (ret = dbenv->memp_nameop(dbenv, + (u_int8_t *)argp->fid.data, NULL, real_name, NULL)) != 0) + goto out; + + *lsnp = argp->prev_lsn; +out: if (real_name != NULL) + __os_free(dbenv, real_name); + REC_NOOP_CLOSE; +} + +/* + * __fop_write_recover -- + * Recovery function for writechunk. + * + * PUBLIC: int __fop_write_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_write_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_write_args *argp; + int ret; + + COMPQUIET(info, NULL); + REC_PRINT(__fop_write_print); + REC_NOOP_INTRO(__fop_write_read); + + if (DB_UNDO(op)) + DB_ASSERT(argp->flag != 0); + else if (DB_REDO(op)) + ret = __fop_write(dbenv, + argp->txnid, argp->name.data, argp->appname, NULL, + argp->offset, argp->page.data, argp->page.size, argp->flag); + + *lsnp = argp->prev_lsn; + REC_NOOP_CLOSE; +} + +/* + * __fop_rename_recover -- + * Recovery function for rename. + * + * PUBLIC: int __fop_rename_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_rename_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_rename_args *argp; + DBMETA *meta; + char *real_new, *real_old, *src; + int ret, t_ret; + u_int8_t *fileid, mbuf[DBMETASIZE]; + + real_new = NULL; + real_old = NULL; + ret = 0; + meta = (DBMETA *)&mbuf[0]; + + COMPQUIET(info, NULL); + REC_PRINT(__fop_rename_print); + REC_NOOP_INTRO(__fop_rename_read); + fileid = argp->fileid.data; + + if ((ret = __db_appname(dbenv, (APPNAME)argp->appname, + (const char *)argp->newname.data, 0, NULL, &real_new)) != 0) + goto out; + if ((ret = __db_appname(dbenv, (APPNAME)argp->appname, + (const char *)argp->oldname.data, 0, NULL, &real_old)) != 0) + goto out; + + /* + * Verify that we are manipulating the correct file. We should always + * be OK on an ABORT or an APPLY, but during recovery, we have to + * check. + */ + if (op != DB_TXN_ABORT && op != DB_TXN_APPLY) { + src = DB_UNDO(op) ? real_new : real_old; + /* + * Interpret any error as meaning that the file either doesn't + * exist, doesn't have a meta-data page, or is in some other + * way, shape or form, incorrect, so that we should not restore + * it. + */ + if ((ret = __fop_read_meta(dbenv, + src, mbuf, DBMETASIZE, NULL, 1, 0)) != 0) { + ret = 0; + goto done; + } + if ((t_ret = __db_chk_meta(dbenv, NULL, meta, 1)) != 0) + goto done; + if (memcmp(argp->fileid.data, meta->uid, DB_FILE_ID_LEN) != 0) + goto done; + } + + if (DB_UNDO(op)) + (void)dbenv->memp_nameop(dbenv, fileid, + (const char *)argp->oldname.data, real_new, real_old); + if (DB_REDO(op)) + (void)dbenv->memp_nameop(dbenv, fileid, + (const char *)argp->newname.data, real_old, real_new); + +done: *lsnp = argp->prev_lsn; +out: if (real_new != NULL) + __os_free(dbenv, real_new); + if (real_old != NULL) + __os_free(dbenv, real_old); + + REC_NOOP_CLOSE; +} + +/* + * __fop_file_remove_recover -- + * Recovery function for file_remove. On the REDO pass, we need to + * make sure no one recreated the file while we weren't looking. On an + * undo pass must check if the file we are interested in is the one that + * exists and then set the status of the child transaction depending on + * what we find out. + * + * PUBLIC: int __fop_file_remove_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +__fop_file_remove_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + __fop_file_remove_args *argp; + DBMETA *meta; + char *real_name; + int is_real, is_tmp, ret; + u_int8_t mbuf[DBMETASIZE]; + u_int32_t cstat; + + real_name = NULL; + is_real = is_tmp = 0; + meta = (DBMETA *)&mbuf[0]; + REC_PRINT(__fop_file_remove_print); + REC_NOOP_INTRO(__fop_file_remove_read); + + /* + * This record is only interesting on the backward, forward, and + * apply phases. + */ + if (op != DB_TXN_BACKWARD_ROLL && + op != DB_TXN_FORWARD_ROLL && op != DB_TXN_APPLY) + goto done; + + if ((ret = __db_appname(dbenv, + (APPNAME)argp->appname, argp->name.data, 0, NULL, &real_name)) != 0) + goto out; + + /* Verify that we are manipulating the correct file. */ + if ((ret = __fop_read_meta(dbenv, + real_name, mbuf, DBMETASIZE, NULL, 1, 0)) != 0) { + /* File does not exist. */ + cstat = TXN_EXPECTED; + } else { + /* + * We can ignore errors here since we'll simply fail the + * checks below and assume this is the wrong file. + */ + (void)__db_chk_meta(dbenv, NULL, meta, 1); + is_real = + memcmp(argp->real_fid.data, meta->uid, DB_FILE_ID_LEN) == 0; + is_tmp = + memcmp(argp->tmp_fid.data, meta->uid, DB_FILE_ID_LEN) == 0; + + if (!is_real && !is_tmp) + /* File exists, but isn't what we were removing. */ + cstat = TXN_IGNORE; + else + /* File exists and is the one that we were removing. */ + cstat = TXN_COMMIT; + } + + if (DB_UNDO(op)) { + /* On the backward pass, we leave a note for the child txn. */ + if ((ret = __db_txnlist_update(dbenv, + info, argp->child, cstat, NULL)) == DB_NOTFOUND) + ret = __db_txnlist_add(dbenv, + info, argp->child, cstat, NULL); + } else if (DB_REDO(op)) { + /* + * On the forward pass, check if someone recreated the + * file while we weren't looking. + */ + if (cstat == TXN_COMMIT) + (void)dbenv->memp_nameop(dbenv, + is_real ? argp->real_fid.data : argp->tmp_fid.data, + NULL, real_name, NULL); + } + +done: *lsnp = argp->prev_lsn; + ret = 0; + +out: if (real_name != NULL) + __os_free(dbenv, real_name); + REC_NOOP_CLOSE; +} diff --git a/db/fileops/fop_util.c b/db/fileops/fop_util.c new file mode 100644 index 000000000..2c89f61e6 --- /dev/null +++ b/db/fileops/fop_util.c @@ -0,0 +1,934 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: fop_util.c,v 1.49 2002/08/07 15:40:06 margo Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/db_shash.h" +#include "dbinc/db_am.h" +#include "dbinc/fop.h" +#include "dbinc/lock.h" +#include "dbinc/log.h" +#include "dbinc/txn.h" + +static int __fop_set_pgsize __P((DB *, DB_FH *, const char *)); + +/* + * Acquire the environment meta-data lock. The parameters are the + * environment (ENV), the locker id to use in acquiring the lock (ID) + * and a pointer to a DB_LOCK. + */ +#define GET_ENVLOCK(ENV, ID, L) do { \ + DBT __dbt; \ + u_int32_t __lockval; \ + \ + if (LOCKING_ON((ENV))) { \ + __lockval = 0; \ + __dbt.data = &__lockval; \ + __dbt.size = sizeof(__lockval); \ + if ((ret = (ENV)->lock_get((ENV), (ID), \ + 0, &__dbt, DB_LOCK_WRITE, (L))) != 0) \ + goto err; \ + } \ +} while (0) + +#define REL_ENVLOCK(ENV, L) \ + (!LOCK_ISSET(*(L)) ? 0 : (ENV)->lock_put((ENV), (L))) + +/* + * If our caller is doing fcntl(2) locking, then we can't close it + * because that would discard the caller's lock. Otherwise, close + * the handle. + */ +#define CLOSE_HANDLE(D, F) { \ + if (F_ISSET((F), DB_FH_VALID)) { \ + if (LF_ISSET(DB_FCNTL_LOCKING)) \ + (D)->saved_open_fhp = (F); \ + else if ((ret = __os_closehandle((D)->dbenv,(F))) != 0) \ + goto err; \ + } \ +} + +/* + * __fop_lock_handle -- + * + * Get the handle lock for a database. If the envlock is specified, + * do this as a lock_vec call that releases the enviroment lock before + * acquiring the handle lock. + * + * PUBLIC: int __fop_lock_handle __P((DB_ENV *, + * PUBLIC: DB *, u_int32_t, db_lockmode_t, DB_LOCK *, u_int32_t)); + * + */ +int +__fop_lock_handle(dbenv, dbp, locker, mode, elock, flags) + DB_ENV *dbenv; + DB *dbp; + u_int32_t locker; + db_lockmode_t mode; + DB_LOCK *elock; + u_int32_t flags; +{ + DBT fileobj; + DB_LOCKREQ reqs[2], *ereq; + DB_LOCK_ILOCK lock_desc; + int ret; + + if (!LOCKING_ON(dbenv) || F_ISSET(dbp, DB_AM_COMPENSATE)) + return (0); + + /* + * If we are in recovery, the only locking we should be + * doing is on the global environment. + */ + if (IS_RECOVERING(dbenv)) { + if (elock != NULL) + REL_ENVLOCK(dbenv, elock); + return (0); + } + + memcpy(&lock_desc.fileid, &dbp->fileid, DB_FILE_ID_LEN); + lock_desc.pgno = dbp->meta_pgno; + lock_desc.type = DB_HANDLE_LOCK; + + memset(&fileobj, 0, sizeof(fileobj)); + fileobj.data = &lock_desc; + fileobj.size = sizeof(lock_desc); + DB_TEST_SUBLOCKS(dbenv, flags); + if (elock == NULL) + ret = dbenv->lock_get(dbenv, locker, + flags, &fileobj, mode, &dbp->handle_lock); + else { + reqs[0].op = DB_LOCK_PUT; + reqs[0].lock = *elock; + reqs[1].op = DB_LOCK_GET; + reqs[1].mode = mode; + reqs[1].obj = &fileobj; + reqs[1].timeout = 0; + if ((ret = __lock_vec(dbenv, + locker, flags, reqs, 2, &ereq)) == 0) { + dbp->handle_lock = reqs[1].lock; + LOCK_INIT(*elock); + } else if (ereq != reqs) + LOCK_INIT(*elock); + } + + dbp->cur_lid = locker; + return (ret); +} + +/* + * __fop_file_setup -- + * + * Perform all the needed checking and locking to open up or create a + * file. + * + * There's a reason we don't push this code down into the buffer cache. + * The problem is that there's no information external to the file that + * we can use as a unique ID. UNIX has dev/inode pairs, but they are + * not necessarily unique after reboot, if the file was mounted via NFS. + * Windows has similar problems, as the FAT filesystem doesn't maintain + * dev/inode numbers across reboot. So, we must get something from the + * file we can use to ensure that, even after a reboot, the file we're + * joining in the cache is the right file for us to join. The solution + * we use is to maintain a file ID that's stored in the database, and + * that's why we have to open and read the file before calling into the + * buffer cache or obtaining a lock (we use this unique fileid to lock + * as well as to identify like files in the cache). + * + * PUBLIC: int __fop_file_setup __P((DB *, + * PUBLIC: DB_TXN *, const char *, int, u_int32_t, u_int32_t *)); + */ +int +__fop_file_setup(dbp, txn, name, mode, flags, retidp) + DB *dbp; + DB_TXN *txn; + const char *name; + int mode; + u_int32_t flags, *retidp; +{ + DB_ENV *dbenv; + DB_FH fh, *fhp; + DB_LOCK elock, tmp_lock; + DB_LSN lsn; + DB_TXN *stxn; + db_lockmode_t lmode; + u_int32_t locker, oflags; + u_int8_t mbuf[DBMETASIZE]; + int created_fhp, created_locker, ret, tmp_created, truncating; + char *real_name, *real_tmpname, *tmpname; + + DB_ASSERT(name != NULL); + + *retidp = TXN_INVALID; + + dbenv = dbp->dbenv; + LOCK_INIT(elock); + LOCK_INIT(tmp_lock); + stxn = NULL; + created_fhp = created_locker = 0; + real_name = real_tmpname = tmpname = NULL; + tmp_created = truncating = 0; + + /* + * If we open a file handle and our caller is doing fcntl(2) locking, + * we can't close it because that would discard the caller's lock. + * Save it until we close the DB handle. + */ + if (LF_ISSET(DB_FCNTL_LOCKING)) { + if ((ret = __os_malloc(dbenv, sizeof(*fhp), &fhp)) != 0) + return (ret); + created_fhp = 1; + } else + fhp = &fh; + memset(fhp, 0, sizeof(*fhp)); + + /* + * Get a lockerid for this handle. There are paths through queue + * rename and remove where this dbp already has a locker, so make + * sure we don't clobber it and conflict. + */ + if (LOCKING_ON(dbenv) && + !F_ISSET(dbp, DB_AM_COMPENSATE) && dbp->lid == DB_LOCK_INVALIDID) { + if ((ret = __lock_id(dbenv, &dbp->lid)) != 0) + goto err; + created_locker = 1; + } + + locker = txn == NULL ? dbp->lid : txn->txnid; + + /* Get the real backing file name. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, name, 0, NULL, &real_name)) != 0) + goto err; + + /* Fill in the default file mode. */ + if (mode == 0) + mode = __db_omode("rwrw--"); + + oflags = 0; + if (LF_ISSET(DB_RDONLY)) + oflags |= DB_OSO_RDONLY; + +retry: if (!F_ISSET(dbp, DB_AM_COMPENSATE)) + GET_ENVLOCK(dbenv, locker, &elock); + if ((ret = __os_exists(real_name, NULL)) == 0) { + if (LF_ISSET(DB_EXCL)) { + ret = EEXIST; + goto err; + } +reopen: if ((ret = __fop_read_meta(dbenv, real_name, + mbuf, sizeof(mbuf), fhp, 0, oflags)) != 0) + goto err; + + if ((ret = __db_meta_setup(dbenv, + dbp, real_name, (DBMETA *)mbuf, flags, 1)) != 0) + goto err; + + /* Now, get our handle lock. */ + lmode = LF_ISSET(DB_TRUNCATE) ? DB_LOCK_WRITE : DB_LOCK_READ; + if ((ret = __fop_lock_handle(dbenv, + dbp, locker, lmode, NULL, DB_LOCK_NOWAIT)) == 0) { + if ((ret = REL_ENVLOCK(dbenv, &elock)) != 0) + goto err; + } else { + /* Someone else has file locked; need to wait. */ + if ((ret = __os_closehandle(dbenv, fhp)) != 0) + goto err; + ret = __fop_lock_handle(dbenv, + dbp, locker, lmode, &elock, 0); + if (ret == DB_LOCK_NOTEXIST) + goto retry; + if (ret != 0) + goto err; + /* + * XXX I need to convince myself that I don't need + * to re-read the metadata page here. + * XXX If you do need to re-read it you'd better + * decrypt it too... + */ + if ((ret = __os_open(dbenv, real_name, 0, 0, fhp)) != 0) + goto err; + } + + /* + * Check for a truncate which needs to leap over to the + * create case. + */ + if (LF_ISSET(DB_TRUNCATE)) { + /* + * Sadly, we need to close and reopen the handle + * in order to do the actual truncate. We couldn't + * do the truncate on the initial open because we + * needed to read the old file-id in order to lock. + */ + if ((ret = __os_closehandle(dbenv, fhp)) != 0) + goto err; + if ((ret = __os_open(dbenv, + real_name, DB_OSO_TRUNC, 0, fhp)) != 0) + goto err; + /* + * This is not-transactional, so we'll do the + * open/create in-place. + */ + tmp_lock = dbp->handle_lock; + truncating = 1; + tmpname = (char *)name; + goto creat2; + } + + /* + * Check for a file in the midst of a rename + */ + if (F_ISSET(dbp, DB_AM_IN_RENAME)) { + if (LF_ISSET(DB_CREATE)) { + F_CLR(dbp, DB_AM_IN_RENAME); + goto create; + } else { + ret = ENOENT; + goto err; + } + } + + CLOSE_HANDLE(dbp, fhp); + goto done; + } + + /* File does not exist. */ + if (!LF_ISSET(DB_CREATE)) + goto err; + ret = 0; + + /* + * Need to create file; we need to set up the file, + * the fileid and the locks. Then we need to call + * the appropriate routines to create meta-data pages. + */ + if ((ret = REL_ENVLOCK(dbenv, &elock)) != 0) + goto err; + +create: if (txn == NULL) + ZERO_LSN(lsn); + else + lsn = txn->last_lsn; + if ((ret = __db_backup_name(dbenv, name, txn, &tmpname, &lsn)) != 0) + goto err; + if (TXN_ON(dbenv) && txn != NULL && + (ret = dbenv->txn_begin(dbenv, txn, &stxn, 0)) != 0) + goto err; + if ((ret = __fop_create(dbenv, + stxn, fhp, tmpname, DB_APP_DATA, mode)) != 0) + goto err; + tmp_created = 1; +creat2: if ((ret = __db_appname(dbenv, + DB_APP_DATA, tmpname, 0, NULL, &real_tmpname)) != 0) + goto err; + + /* Set the pagesize if it isn't yet set. */ + if (dbp->pgsize == 0 && + (ret = __fop_set_pgsize(dbp, fhp, real_tmpname)) != 0) + goto errmsg; + + /* Construct a file_id. */ + if ((ret = __os_fileid(dbenv, real_tmpname, 1, dbp->fileid)) != 0) + goto errmsg; + + if ((ret = __db_new_file(dbp, stxn, fhp, tmpname)) != 0) + goto err; + CLOSE_HANDLE(dbp, fhp); + + /* Now move the file into place. */ + if (!F_ISSET(dbp, DB_AM_COMPENSATE)) + GET_ENVLOCK(dbenv, locker, &elock); + if (!truncating && __os_exists(real_name, NULL) == 0) { + /* + * Someone managed to create the file; remove our temp + * and try to open the file that now exists. + */ + (void)__fop_remove(dbenv, + NULL, dbp->fileid, tmpname, DB_APP_DATA); + if (LOCKING_ON(dbenv)) + dbenv->lock_put(dbenv, &dbp->handle_lock); + LOCK_INIT(dbp->handle_lock); + + /* If we have a saved handle; close it. */ + if (LF_ISSET(DB_FCNTL_LOCKING)) + (void)__os_closehandle(dbenv, fhp); + if (stxn != NULL) { + ret = stxn->abort(stxn); + stxn = NULL; + } + if (ret != 0) + goto err; + goto reopen; + } + + /* We've successfully created, move the file into place. */ + if ((ret = __fop_lock_handle(dbenv, + dbp, locker, DB_LOCK_WRITE, &elock, 0)) != 0) + goto err; + if (!truncating && (ret = __fop_rename(dbenv, + stxn, tmpname, name, dbp->fileid, DB_APP_DATA)) != 0) + goto err; + + /* If this was a truncate; release lock on the old file. */ + if (LOCK_ISSET(tmp_lock) && (ret = __lock_put(dbenv, &tmp_lock)) != 0) + goto err; + + if (stxn != NULL) { + *retidp = stxn->txnid; + ret = stxn->commit(stxn, 0); + stxn = NULL; + } else + *retidp = TXN_INVALID; + + if (ret != 0) + goto err; + + F_SET(dbp, DB_AM_CREATED); + + if (0) { +errmsg: __db_err(dbenv, "%s: %s", name, db_strerror(ret)); + +err: if (stxn != NULL) + (void)stxn->abort(stxn); + if (tmp_created && txn == NULL) + (void)__fop_remove(dbenv, + NULL, NULL, tmpname, DB_APP_DATA); + if (F_ISSET(fhp, DB_FH_VALID)) + (void)__os_closehandle(dbenv, fhp); + if (LOCK_ISSET(tmp_lock)) + __lock_put(dbenv, &tmp_lock); + if (LOCK_ISSET(dbp->handle_lock) && txn == NULL) + __lock_put(dbenv, &dbp->handle_lock); + if (LOCK_ISSET(elock)) + (void)REL_ENVLOCK(dbenv, &elock); + if (created_locker) { + (void)__lock_id_free(dbenv, dbp->lid); + dbp->lid = DB_LOCK_INVALIDID; + } + if (created_fhp) + __os_free(dbenv, fhp); + } + +done: if (!truncating && tmpname != NULL) + __os_free(dbenv, tmpname); + if (real_name != NULL) + __os_free(dbenv, real_name); + if (real_tmpname != NULL) + __os_free(dbenv, real_tmpname); + + return (ret); +} + +/* + * __fop_set_pgsize -- + * Set the page size based on file information. + */ +static int +__fop_set_pgsize(dbp, fhp, name) + DB *dbp; + DB_FH *fhp; + const char *name; +{ + DB_ENV *dbenv; + u_int32_t iopsize; + int ret; + + dbenv = dbp->dbenv; + + /* + * Use the filesystem's optimum I/O size as the pagesize if a pagesize + * not specified. Some filesystems have 64K as their optimum I/O size, + * but as that results in fairly large default caches, we limit the + * default pagesize to 16K. + */ + if ((ret = __os_ioinfo(dbenv, name, fhp, NULL, NULL, &iopsize)) != 0) { + __db_err(dbenv, "%s: %s", name, db_strerror(ret)); + return (ret); + } + if (iopsize < 512) + iopsize = 512; + if (iopsize > 16 * 1024) + iopsize = 16 * 1024; + + /* + * Sheer paranoia, but we don't want anything that's not a power-of-2 + * (we rely on that for alignment of various types on the pages), and + * we want a multiple of the sector size as well. If the value + * we got out of __os_ioinfo looks bad, use a default instead. + */ + if (!IS_VALID_PAGESIZE(iopsize)) + iopsize = DB_DEF_IOSIZE; + + dbp->pgsize = iopsize; + F_SET(dbp, DB_AM_PGDEF); + + return (0); +} + +/* + * __fop_subdb_setup -- + * + * Subdb setup is significantly simpler than file setup. In terms of + * locking, for the duration of the operation/transaction, the locks on + * the meta-data page will suffice to protect us from simultaneous operations + * on the sub-database. Before we complete the operation though, we'll get a + * handle lock on the subdatabase so that on one else can try to remove it + * while we've got it open. We use an object that looks like the meta-data + * page lock with a different type (DB_HANDLE_LOCK) for the long-term handle. + * locks. + * + * PUBLIC: int __fop_subdb_setup __P((DB *, DB_TXN *, + * PUBLIC: const char *, const char *, int, u_int32_t)); + */ +int +__fop_subdb_setup(dbp, txn, mname, name, mode, flags) + DB *dbp; + DB_TXN *txn; + const char *mname, *name; + int mode; + u_int32_t flags; +{ + DB *mdbp; + DB_ENV *dbenv; + int remove, ret; + + mdbp = NULL; + dbenv = dbp->dbenv; + + if ((ret = __db_master_open(dbp, txn, mname, flags, mode, &mdbp)) != 0) + return (ret); + + /* + * We are going to close this instance of the master, so we can + * steal its handle instead of reopening a handle on the database. + */ + if (LF_ISSET(DB_FCNTL_LOCKING)) { + dbp->saved_open_fhp = mdbp->saved_open_fhp; + mdbp->saved_open_fhp = NULL; + } + + /* Now copy the pagesize. */ + dbp->pgsize = mdbp->pgsize; + F_SET(dbp, DB_AM_SUBDB); + + if (name != NULL && (ret = __db_master_update(mdbp, dbp, txn, + name, dbp->type, MU_OPEN, NULL, flags)) != 0) + goto err; + + /* + * Hijack the master's locker ID as well, so that our locks don't + * conflict with the master's. Since we're closing the master, + * that lid would just have been freed anyway. Once we've gotten + * the locker id, we need to acquire the handle lock for this + * subdatabase. + */ + dbp->lid = mdbp->lid; + mdbp->lid = DB_LOCK_INVALIDID; + + DB_TEST_RECOVERY(dbp, DB_TEST_POSTLOG, ret, mname); + + /* + * We copy our fileid from our master so that we all open + * the same file in mpool. We'll use the meta-pgno to lock + * so that we end up with different handle locks. + */ + + memcpy(dbp->fileid, mdbp->fileid, DB_FILE_ID_LEN); + if ((ret = __fop_lock_handle(dbenv, dbp, + txn == NULL ? dbp->lid : txn->txnid, + F_ISSET(dbp, DB_AM_CREATED) || LF_ISSET(DB_WRITEOPEN) ? + DB_LOCK_WRITE : DB_LOCK_READ, NULL, 0)) != 0) + goto err; + + if ((ret = __db_init_subdb(mdbp, dbp, name, txn)) != 0) + goto err; + + /* + * In the file create case, these happen in separate places so we have + * two different tests. They end up in the same place for subdbs, but + * for compatibility with file testing, we put them both here anyway. + */ + DB_TEST_RECOVERY(dbp, DB_TEST_POSTLOGMETA, ret, mname); + DB_TEST_RECOVERY(dbp, DB_TEST_POSTSYNC, ret, mname); + + /* + * File exists and we have the appropriate locks; we should now + * process a normal open. + */ + if (F_ISSET(mdbp, DB_AM_CREATED)) { + F_SET(dbp, DB_AM_CREATED_MSTR); + F_CLR(mdbp, DB_AM_DISCARD); + } + + /* + * The master's handle lock is under the control of the + * subdb (it acquired the master's locker. We want to + * keep the master's handle lock so that no one can remove + * the file while the subdb is open. If we register the + * trade event and then invalidate the copy of the lock + * in the master's handle, that will accomplish this. However, + * before we register this event, we'd better remove any + * events that we've already registered for the master. + */ + + if (!F_ISSET(dbp, DB_AM_RECOVER) && txn != NULL) { + /* Unregister old master events. */ + __txn_remlock(dbenv, + txn, &mdbp->handle_lock, DB_LOCK_INVALIDID); + + /* Now register the new event. */ + if ((ret = __txn_lockevent(dbenv, + txn, dbp, &mdbp->handle_lock, dbp->lid)) != 0) + goto err; + } + LOCK_INIT(mdbp->handle_lock); + return (__db_close_i(mdbp, txn, 0)); + +err: +DB_TEST_RECOVERY_LABEL + if (LOCK_ISSET(dbp->handle_lock) && txn == NULL) + __lock_put(dbenv, &dbp->handle_lock); + + /* If we created the master file then we need to remove it. */ + if (mdbp != NULL) { + remove = F_ISSET(mdbp, DB_AM_CREATED) ? 1 : 0; + if (remove) + F_SET(mdbp, DB_AM_DISCARD); + (void)__db_close_i(mdbp, txn, 0); + if (remove) { + (void)db_create(&mdbp, dbp->dbenv, 0); + (void)__db_remove_i(mdbp, txn, mname, NULL); + } + } + return (ret); +} + +/* + * __fop_remove_setup -- + * Open handle appropriately and lock for removal of a database file. + * + * PUBLIC: int __fop_remove_setup __P((DB *, + * PUBLIC: DB_TXN *, const char *, u_int32_t)); + */ +int +__fop_remove_setup(dbp, txn, name, flags) + DB *dbp; + DB_TXN *txn; + const char *name; + u_int32_t flags; +{ + DB_ENV *dbenv; + DB_LOCK elock; + u_int8_t mbuf[DBMETASIZE]; + int ret; + + COMPQUIET(flags, 0); + dbenv = dbp->dbenv; + PANIC_CHECK(dbenv); + LOCK_INIT(elock); + + /* Create locker if necessary. */ + if (LOCKING_ON(dbenv)) { + if (txn != NULL) + dbp->lid = txn->txnid; + else if (dbp->lid == DB_LOCK_INVALIDID) { + if ((ret = __lock_id(dbenv, &dbp->lid)) != 0) + goto err; + } + } + + /* + * Lock environment to protect file open. That will enable us to + * read the meta-data page and get the fileid so that we can lock + * the handle. + */ + GET_ENVLOCK(dbenv, dbp->lid, &elock); + if ((ret = __fop_read_meta(dbenv, + name, mbuf, sizeof(mbuf), NULL, 0, 0)) != 0) + goto err; + + if ((ret = + __db_meta_setup(dbenv, dbp, name, (DBMETA *)mbuf, flags, 1)) != 0) + goto err; + + /* Now, release the environment and get the handle lock. */ + if ((ret = __fop_lock_handle(dbenv, + dbp, dbp->lid, DB_LOCK_WRITE, &elock, 0)) != 0) + goto err; + + return (0); + +err: (void)REL_ENVLOCK(dbenv, &elock); + return (ret); +} + +/* + * __fop_read_meta -- + * Read the meta-data page from a file and return it in buf. The + * open file handle is returned in fhp. + * + * PUBLIC: int __fop_read_meta __P((DB_ENV *, + * PUBLIC: const char *, u_int8_t *, size_t, DB_FH *, int, u_int32_t)); + */ +int +__fop_read_meta(dbenv, name, buf, size, fhp, errok, flags) + DB_ENV *dbenv; + const char *name; + u_int8_t *buf; + size_t size; + DB_FH *fhp; + int errok; + u_int32_t flags; +{ + DB_FH fh, *lfhp; + size_t nr; + int ret; + + lfhp = fhp == NULL ? &fh : fhp; + memset(lfhp, 0, sizeof(*fhp)); + if ((ret = __os_open(dbenv, name, flags, 0, lfhp)) != 0) + goto err; + if ((ret = __os_read(dbenv, lfhp, buf, size, &nr)) != 0) { + if (!errok) + __db_err(dbenv, "%s: %s", name, db_strerror(ret)); + goto err; + } + + if (nr != size) { + if (!errok) + __db_err(dbenv, + "%s: unexpected file type or format", name); + ret = EINVAL; + goto err; + } + +err: /* + * On error, we always close the handle. If there is no error, + * then we only return the handle if the user didn't pass us + * a handle into which to return it. If fhp is valid, then + * lfhp is the same as fhp. + */ + if (F_ISSET(lfhp, DB_FH_VALID) && (ret != 0 || fhp == NULL)) + __os_closehandle(dbenv, lfhp); + return (ret); +} + +/* + * __fop_dummy -- + * This implements the creation and name swapping of dummy files that + * we use for remove and rename (remove is simply a rename with a delayed + * remove). + * + * PUBLIC: int __fop_dummy __P((DB *, + * PUBLIC: DB_TXN *, const char *, const char *, u_int32_t)); + */ +int +__fop_dummy(dbp, txn, old, new, flags) + DB *dbp; + DB_TXN *txn; + const char *old, *new; + u_int32_t flags; +{ + DB *tmpdbp; + DB_ENV *dbenv; + DB_LOCK elock; + DB_LSN lsn; + DBT fiddbt, namedbt, tmpdbt; + DB_TXN *stxn; + char *back; + char *realback, *realnew, *realold; + int ret, t_ret; + u_int8_t mbuf[DBMETASIZE]; + u_int32_t locker, stxnid; + + dbenv = dbp->dbenv; + LOCK_INIT(elock); + realback = NULL; + realnew = NULL; + realold = NULL; + back = NULL; + stxn = NULL; + tmpdbp = NULL; + + DB_ASSERT(txn != NULL); + locker = txn->txnid; + + /* Begin sub transaction to encapsulate the rename. */ + if (TXN_ON(dbenv) && + (ret = dbenv->txn_begin(dbenv, txn, &stxn, 0)) != 0) + goto err; + + /* We need to create a dummy file as a place holder. */ + if ((ret = + __db_backup_name(dbenv, new, txn, &back, &txn->last_lsn)) != 0) + goto err; + if ((ret = __db_appname(dbenv, + DB_APP_DATA, back, flags, NULL, &realback)) != 0) + goto err; + if ((ret = __fop_create(dbenv, stxn, NULL, back, DB_APP_DATA, 0)) != 0) + goto err; + + memset(mbuf, 0, sizeof(mbuf)); + if ((ret = + __os_fileid(dbenv, realback, 1, ((DBMETA *)mbuf)->uid)) != 0) + goto err; + ((DBMETA *)mbuf)->magic = DB_RENAMEMAGIC; + if ((ret = __fop_write(dbenv, + stxn, back, DB_APP_DATA, NULL, 0, mbuf, DBMETASIZE, 1)) != 0) + goto err; + + /* Create a dummy dbp handle. */ + if ((ret = db_create(&tmpdbp, dbenv, 0)) != 0) + goto err; + memcpy(&tmpdbp->fileid, ((DBMETA *)mbuf)->uid, DB_FILE_ID_LEN); + + /* Now, lock the name space while we initialize this file. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, new, 0, NULL, &realnew)) != 0) + goto err; + GET_ENVLOCK(dbenv, locker, &elock); + if (__os_exists(realnew, NULL) == 0) { + ret = EEXIST; + goto err; + } + + /* + * While we have the namespace locked, do the renames and then + * swap for the handle lock. + */ + if ((ret = __fop_rename(dbenv, + stxn, old, new, dbp->fileid, DB_APP_DATA)) != 0) + goto err; + if ((ret = __fop_rename(dbenv, + stxn, back, old, tmpdbp->fileid, DB_APP_DATA)) != 0) + goto err; + if ((ret = __fop_lock_handle(dbenv, + tmpdbp, locker, DB_LOCK_WRITE, &elock, 0)) != 0) + goto err; + + /* + * We just acquired a transactional lock on the tmp handle. + * We need to null out the tmp handle's lock so that it + * doesn't create problems for us in the close path. + */ + LOCK_INIT(tmpdbp->handle_lock); + + if (stxn != NULL) { + /* Commit the child. */ + stxnid = stxn->txnid; + ret = stxn->commit(stxn, 0); + stxn = NULL; + + /* Now log the child information in the parent. */ + memset(&fiddbt, 0, sizeof(fiddbt)); + memset(&tmpdbt, 0, sizeof(fiddbt)); + memset(&namedbt, 0, sizeof(namedbt)); + fiddbt.data = dbp->fileid; + fiddbt.size = DB_FILE_ID_LEN; + tmpdbt.data = tmpdbp->fileid; + tmpdbt.size = DB_FILE_ID_LEN; + namedbt.data = (void *)old; + namedbt.size = strlen(old) + 1; + if ((t_ret = + __fop_file_remove_log(dbenv, txn, &lsn, 0, &fiddbt, + &tmpdbt, &namedbt, DB_APP_DATA, stxnid)) != 0 && ret == 0) + ret = t_ret; + } + + /* This is a delayed delete of the dummy file. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, old, flags, NULL, &realold)) != 0) + goto err; + if ((ret = __txn_remevent(dbenv, txn, realold, NULL)) != 0) + goto err; + +err: (void)REL_ENVLOCK(dbenv, &elock); + if (stxn != NULL) + (void)stxn->abort(stxn); + if (tmpdbp != NULL && + (t_ret = __db_close_i(tmpdbp, NULL, 0)) != 0 && ret == 0) + ret = t_ret; + if (realold != NULL) + __os_free(dbenv, realold); + if (realnew != NULL) + __os_free(dbenv, realnew); + if (realback != NULL) + __os_free(dbenv, realback); + if (back != NULL) + __os_free(dbenv, back); + return (ret); +} + +/* + * __fop_dbrename -- + * Do the appropriate file locking and file system operations + * to effect a dbrename in the absence of transactions (__fop_dummy + * and the subsequent calls in __db_rename do the work for the + * transactional case). + * + * PUBLIC: int __fop_dbrename __P((DB *, const char *, const char *)); + */ +int +__fop_dbrename(dbp, old, new) + DB *dbp; + const char *old, *new; +{ + DB_ENV *dbenv; + DB_LOCK elock; + char *real_new, *real_old; + int ret, tret; + + dbenv = dbp->dbenv; + real_new = NULL; + real_old = NULL; + LOCK_INIT(elock); + + /* Find the real newname of the file. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, new, 0, NULL, &real_new)) != 0) + goto err; + + /* + * It is an error to rename a file over one that already exists, + * as that wouldn't be transaction-safe. + */ + GET_ENVLOCK(dbenv, dbp->lid, &elock); + if (__os_exists(real_new, NULL) == 0) { + ret = EEXIST; + __db_err(dbenv, "rename: file %s exists", real_new); + goto err; + } + + if ((ret = __db_appname(dbenv, + DB_APP_DATA, old, 0, NULL, &real_old)) != 0) + goto err; + + ret = dbenv->memp_nameop(dbenv, dbp->fileid, new, real_old, real_new); + +err: if ((tret = REL_ENVLOCK(dbenv, &elock)) != 0 && ret == 0) + ret = tret; + if (real_old != NULL) + __os_free(dbenv, real_old); + if (real_new != NULL) + __os_free(dbenv, real_new); + return (ret); +} diff --git a/db/hash/hash_open.c b/db/hash/hash_open.c new file mode 100644 index 000000000..2c90824d4 --- /dev/null +++ b/db/hash/hash_open.c @@ -0,0 +1,559 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996-2002 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: hash_open.c,v 11.173 2002/08/06 05:34:44 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stdlib.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/crypto.h" +#include "dbinc/db_page.h" +#include "dbinc/hash.h" +#include "dbinc/log.h" +#include "dbinc/db_shash.h" +#include "dbinc/lock.h" +#include "dbinc/db_swap.h" +#include "dbinc/btree.h" +#include "dbinc/fop.h" + +static db_pgno_t __ham_init_meta __P((DB *, HMETA *, db_pgno_t, DB_LSN *)); + +/* + * __ham_open -- + * + * PUBLIC: int __ham_open __P((DB *, + * PUBLIC: DB_TXN *, const char * name, db_pgno_t, u_int32_t)); + */ +int +__ham_open(dbp, txn, name, base_pgno, flags) + DB *dbp; + DB_TXN *txn; + const char *name; + db_pgno_t base_pgno; + u_int32_t flags; +{ + DB_ENV *dbenv; + DBC *dbc; + DB_MPOOLFILE *mpf; + HASH_CURSOR *hcp; + HASH *hashp; + int need_sync, ret, t_ret; + + COMPQUIET(name, NULL); + dbc = NULL; + dbenv = dbp->dbenv; + mpf = dbp->mpf; + need_sync = 0; + + /* Initialize the remaining fields/methods of the DB. */ + dbp->stat = __ham_stat; + + /* + * Get a cursor. If DB_CREATE is specified, we may be creating + * pages, and to do that safely in CDB we need a write cursor. + * In STD_LOCKING mode, we'll synchronize using the meta page + * lock instead. + */ + if ((ret = dbp->cursor(dbp, + txn, &dbc, LF_ISSET(DB_CREATE) && CDB_LOCKING(dbenv) ? + DB_WRITECURSOR : 0)) != 0) + return (ret); + + hcp = (HASH_CURSOR *)dbc->internal; + hashp = dbp->h_internal; + hashp->meta_pgno = base_pgno; + if ((ret = __ham_get_meta(dbc)) != 0) + goto err1; + + /* Initialize the hdr structure. */ + if (hcp->hdr->dbmeta.magic == DB_HASHMAGIC) { + /* File exists, verify the data in the header. */ + if (hashp->h_hash == NULL) + hashp->h_hash = hcp->hdr->dbmeta.version < 5 + ? __ham_func4 : __ham_func5; + if (!F_ISSET(dbp, DB_AM_RDONLY) && !IS_RECOVERING(dbenv) && + hashp->h_hash(dbp, + CHARKEY, sizeof(CHARKEY)) != hcp->hdr->h_charkey) { + __db_err(dbp->dbenv, + "hash: incompatible hash function"); + ret = EINVAL; + goto err2; + } + if (F_ISSET(&hcp->hdr->dbmeta, DB_HASH_DUP)) + F_SET(dbp, DB_AM_DUP); + if (F_ISSET(&hcp->hdr->dbmeta, DB_HASH_DUPSORT)) + F_SET(dbp, DB_AM_DUPSORT); + if (F_ISSET(&hcp->hdr->dbmeta, DB_HASH_SUBDB)) + F_SET(dbp, DB_AM_SUBDB); + + /* We must initialize last_pgno, it could be stale. */ + if (!F_ISSET(dbp, DB_AM_RDONLY) && + dbp->meta_pgno == PGNO_BASE_MD) { + if ((ret = __ham_dirty_meta(dbc)) != 0) + goto err2; + mpf->last_pgno(mpf, &hcp->hdr->dbmeta.last_pgno); + } + } else if (!IS_RECOVERING(dbenv) && !F_ISSET(dbp, DB_AM_RECOVER)) + DB_ASSERT(0); + +err2: /* Release the meta data page */ + if ((t_ret = __ham_release_meta(dbc)) != 0 && ret == 0) + ret = t_ret; +err1: if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0) + ret = t_ret; + + return (ret); +} + +/* + * __ham_metachk -- + * + * PUBLIC: int __ham_metachk __P((DB *, const char *, HMETA *)); + */ +int +__ham_metachk(dbp, name, hashm) + DB *dbp; + const char *name; + HMETA *hashm; +{ + DB_ENV *dbenv; + u_int32_t vers; + int ret; + + dbenv = dbp->dbenv; + + /* + * At this point, all we know is that the magic number is for a Hash. + * Check the version, the database may be out of date. + */ + vers = hashm->dbmeta.version; + if (F_ISSET(dbp, DB_AM_SWAP)) + M_32_SWAP(vers); + switch (vers) { + case 4: + case 5: + case 6: + __db_err(dbenv, + "%s: hash version %lu requires a version upgrade", + name, (u_long)vers); + return (DB_OLD_VERSION); + case 7: + case 8: + break; + default: + __db_err(dbenv, + "%s: unsupported hash version: %lu", name, (u_long)vers); + return (EINVAL); + } + + /* Swap the page if we need to. */ + if (F_ISSET(dbp, DB_AM_SWAP) && (ret = __ham_mswap((PAGE *)hashm)) != 0) + return (ret); + + /* Check the type. */ + if (dbp->type != DB_HASH && dbp->type != DB_UNKNOWN) + return (EINVAL); + dbp->type = DB_HASH; + DB_ILLEGAL_METHOD(dbp, DB_OK_HASH); + + /* + * Check application info against metadata info, and set info, flags, + * and type based on metadata info. + */ + if ((ret = __db_fchk(dbenv, + "DB->open", hashm->dbmeta.flags, + DB_HASH_DUP | DB_HASH_SUBDB | DB_HASH_DUPSORT)) != 0) + return (ret); + + if (F_ISSET(&hashm->dbmeta, DB_HASH_DUP)) + F_SET(dbp, DB_AM_DUP); + else + if (F_ISSET(dbp, DB_AM_DUP)) { + __db_err(dbenv, + "%s: DB_DUP specified to open method but not set in database", + name); + return (EINVAL); + } + + if (F_ISSET(&hashm->dbmeta, DB_HASH_SUBDB)) + F_SET(dbp, DB_AM_SUBDB); + else + if (F_ISSET(dbp, DB_AM_SUBDB)) { + __db_err(dbenv, + "%s: multiple databases specified but not supported in file", + name); + return (EINVAL); + } + + if (F_ISSET(&hashm->dbmeta, DB_HASH_DUPSORT)) { + if (dbp->dup_compare == NULL) + dbp->dup_compare = __bam_defcmp; + } else + if (dbp->dup_compare != NULL) { + __db_err(dbenv, + "%s: duplicate sort function specified but not set in database", + name); + return (EINVAL); + } + + /* Set the page size. */ + dbp->pgsize = hashm->dbmeta.pagesize; + + /* Copy the file's ID. */ + memcpy(dbp->fileid, hashm->dbmeta.uid, DB_FILE_ID_LEN); + + return (0); +} + +/* + * __ham_init_meta -- + * + * Initialize a hash meta-data page. We assume that the meta-data page is + * contiguous with the initial buckets that we create. If that turns out + * to be false, we'll fix it up later. Return the initial number of buckets + * allocated. + */ +static db_pgno_t +__ham_init_meta(dbp, meta, pgno, lsnp) + DB *dbp; + HMETA *meta; + db_pgno_t pgno; + DB_LSN *lsnp; +{ + HASH *hashp; + db_pgno_t nbuckets; + int i; + int32_t l2; + + hashp = dbp->h_internal; + if (hashp->h_hash == NULL) + hashp->h_hash = DB_HASHVERSION < 5 ? __ham_func4 : __ham_func5; + + if (hashp->h_nelem != 0 && hashp->h_ffactor != 0) { + hashp->h_nelem = (hashp->h_nelem - 1) / hashp->h_ffactor + 1; + l2 = __db_log2(hashp->h_nelem > 2 ? hashp->h_nelem : 2); + } else + l2 = 1; + nbuckets = (db_pgno_t)(1 << l2); + + memset(meta, 0, sizeof(HMETA)); + meta->dbmeta.lsn = *lsnp; + meta->dbmeta.pgno = pgno; + meta->dbmeta.magic = DB_HASHMAGIC; + meta->dbmeta.version = DB_HASHVERSION; + meta->dbmeta.pagesize = dbp->pgsize; + if (F_ISSET(dbp, DB_AM_CHKSUM)) + FLD_SET(meta->dbmeta.metaflags, DBMETA_CHKSUM); + if (F_ISSET(dbp, DB_AM_ENCRYPT)) { + meta->dbmeta.encrypt_alg = + ((DB_CIPHER *)dbp->dbenv->crypto_handle)->alg; + DB_ASSERT(meta->dbmeta.encrypt_alg != 0); + meta->crypto_magic = meta->dbmeta.magic; + } + meta->dbmeta.type = P_HASHMETA; + meta->dbmeta.free = PGNO_INVALID; + meta->dbmeta.last_pgno = pgno; + meta->max_bucket = nbuckets - 1; + meta->high_mask = nbuckets - 1; + meta->low_mask = (nbuckets >> 1) - 1; + meta->ffactor = hashp->h_ffactor; + meta->h_charkey = hashp->h_hash(dbp, CHARKEY, sizeof(CHARKEY)); + memcpy(meta->dbmeta.uid, dbp->fileid, DB_FILE_ID_LEN); + + if (F_ISSET(dbp, DB_AM_DUP)) + F_SET(&meta->dbmeta, DB_HASH_DUP); + if (F_ISSET(dbp, DB_AM_SUBDB)) + F_SET(&meta->dbmeta, DB_HASH_SUBDB); + if (dbp->dup_compare != NULL) + F_SET(&meta->dbmeta, DB_HASH_DUPSORT); + + /* + * Create the first and second buckets pages so that we have the + * page numbers for them and we can store that page number in the + * meta-data header (spares[0]). + */ + meta->spares[0] = pgno + 1; + + /* Fill in the last fields of the meta data page. */ + for (i = 1; i <= l2; i++) + meta->spares[i] = meta->spares[0]; + for (; i < NCACHED; i++) + meta->spares[i] = PGNO_INVALID; + + return (nbuckets); +} + +/* + * __ham_new_file -- + * Create the necessary pages to begin a new database file. If name + * is NULL, then this is an unnamed file, the mpf has been set in the dbp + * and we simply create the pages using mpool. In this case, we don't log + * because we never have to redo an unnamed create and the undo simply + * frees resources. + * + * This code appears more complex than it is because of the two cases (named + * and unnamed). The way to read the code is that for each page being created, + * there are three parts: 1) a "get page" chunk (which either uses malloc'd + * memory or calls mpf->get), 2) the initialization, and 3) the "put page" + * chunk which either does a fop write or an mpf->put. + * + * PUBLIC: int __ham_new_file __P((DB *, DB_TXN *, DB_FH *, const char *)); + */ +int +__ham_new_file(dbp, txn, fhp, name) + DB *dbp; + DB_TXN *txn; + DB_FH *fhp; + const char *name; +{ + DB_ENV *dbenv; + DB_LSN lsn; + DB_MPOOLFILE *mpf; + DB_PGINFO pginfo; + DBT pdbt; + HMETA *meta; + PAGE *page; + int ret; + db_pgno_t lpgno; + void *buf; + + dbenv = dbp->dbenv; + mpf = dbp->mpf; + meta = NULL; + page = NULL; + memset(&pdbt, 0, sizeof(pdbt)); + + /* Build meta-data page. */ + if (name == NULL) { + lpgno = PGNO_BASE_MD; + ret = mpf->get(mpf, &lpgno, DB_MPOOL_CREATE, &meta); + } else { + pginfo.db_pagesize = dbp->pgsize; + pginfo.type = dbp->type; + pginfo.flags = + F_ISSET(dbp, (DB_AM_CHKSUM | DB_AM_ENCRYPT | DB_AM_SWAP)); + pdbt.data = &pginfo; + pdbt.size = sizeof(pginfo); + ret = __os_calloc(dbp->dbenv, 1, dbp->pgsize, &buf); + meta = (HMETA *)buf; + } + if (ret != 0) + return (ret); + + INIT_LSN(lsn); + lpgno = __ham_init_meta(dbp, meta, PGNO_BASE_MD, &lsn); + meta->dbmeta.last_pgno = lpgno; + + if (name == NULL) + ret = mpf->put(mpf, meta, DB_MPOOL_DIRTY); + else { + if ((ret = __db_pgout(dbenv, PGNO_BASE_MD, meta, &pdbt)) != 0) + goto err; + ret = __fop_write(dbenv, txn, name, + DB_APP_DATA, fhp, 0, buf, dbp->pgsize, 1); + } + if (ret != 0) + goto err; + meta = NULL; + + /* Now allocate the final hash bucket. */ + if (name == NULL) { + if ((ret = mpf->get(mpf, &lpgno, DB_MPOOL_CREATE, &page)) != 0) + goto err; + } else { +#ifdef DIAGNOSTIC + memset(buf, dbp->pgsize, 0); +#endif + page = (PAGE *)buf; + } + + P_INIT(page, dbp->pgsize, lpgno, PGNO_INVALID, PGNO_INVALID, 0, P_HASH); + INIT_LSN(page->lsn); + + if (name == NULL) + ret = mpf->put(mpf, page, DB_MPOOL_DIRTY); + else { + if ((ret = __db_pgout(dbenv, lpgno, buf, &pdbt)) != 0) + goto err; + ret = __fop_write(dbenv, txn, name, + DB_APP_DATA, fhp, lpgno * dbp->pgsize, buf, dbp->pgsize, 1); + } + if (ret != 0) + goto err; + page = NULL; + +err: if (name != NULL) + __os_free(dbenv, buf); + else { + if (meta != NULL) + (void)mpf->put(mpf, meta, 0); + if (page != NULL) + (void)mpf->put(mpf, page, 0); + } + return (ret); +} + +/* + * __ham_new_subdb -- + * Create the necessary pages to begin a new subdatabase. + * + * PUBLIC: int __ham_new_subdb __P((DB *, DB *, DB_TXN *)); + */ +int +__ham_new_subdb(mdbp, dbp, txn) + DB *mdbp, *dbp; + DB_TXN *txn; +{ + DBC *dbc; + DB_ENV *dbenv; + DB_LOCK metalock, mmlock; + DB_LSN lsn; + DB_MPOOLFILE *mpf; + DBMETA *mmeta; + HMETA *meta; + PAGE *h; + int i, ret, t_ret; + db_pgno_t lpgno, mpgno; + + dbenv = mdbp->dbenv; + mpf = mdbp->mpf; + dbc = NULL; + meta = NULL; + mmeta = NULL; + LOCK_INIT(metalock); + LOCK_INIT(mmlock); + + if ((ret = mdbp->cursor(mdbp, txn, + &dbc, CDB_LOCKING(dbenv) ? DB_WRITECURSOR : 0)) != 0) + return (ret); + + /* Get and lock the new meta data page. */ + if ((ret = __db_lget(dbc, + 0, dbp->meta_pgno, DB_LOCK_WRITE, 0, &metalock)) != 0) + goto err; + if ((ret = mpf->get(mpf, &dbp->meta_pgno, DB_MPOOL_CREATE, &meta)) != 0) + goto err; + + /* Initialize the new meta-data page. */ + lsn = meta->dbmeta.lsn; + lpgno = __ham_init_meta(dbp, meta, dbp->meta_pgno, &lsn); + + /* + * We are about to allocate a set of contiguous buckets (lpgno + * worth). We need to get the master meta-data page to figure + * out where these pages are and to allocate them. So, lock and + * get the master meta data page. + */ + mpgno = PGNO_BASE_MD; + if ((ret = __db_lget(dbc, 0, mpgno, DB_LOCK_WRITE, 0, &mmlock)) != 0) + goto err; + if ((ret = mpf->get(mpf, &mpgno, 0, &mmeta)) != 0) + goto err; + + /* + * Now update the hash meta-data page to reflect where the first + * set of buckets are actually located. + */ + meta->spares[0] = mmeta->last_pgno + 1; + for (i = 0; i < NCACHED && meta->spares[i] != PGNO_INVALID; i++) + meta->spares[i] = meta->spares[0]; + + /* The new meta data page is now complete; log it. */ + if ((ret = __db_log_page(mdbp, + txn, &meta->dbmeta.lsn, dbp->meta_pgno, (PAGE *)meta)) != 0) + goto err; + + /* Reflect the group allocation. */ + if (DBENV_LOGGING(dbenv)) + if ((ret = __ham_groupalloc_log(mdbp, txn, + &LSN(mmeta), 0, &LSN(mmeta), + meta->spares[0], meta->max_bucket + 1, mmeta->free)) != 0) + goto err; + + /* Release the new meta-data page. */ + if ((ret = mpf->put(mpf, meta, DB_MPOOL_DIRTY)) != 0) + goto err; + meta = NULL; + + mmeta->last_pgno +=lpgno; + lpgno = mmeta->last_pgno; + + /* Now allocate the final hash bucket. */ + if ((ret = mpf->get(mpf, &lpgno, DB_MPOOL_CREATE, &h)) != 0) + goto err; + P_INIT(h, dbp->pgsize, lpgno, PGNO_INVALID, PGNO_INVALID, 0, P_HASH); + LSN(h) = LSN(mmeta); + if ((ret = mpf->put(mpf, h, DB_MPOOL_DIRTY)) != 0) + goto err; + + /* Now put the master-metadata page back. */ + if ((ret = mpf->put(mpf, mmeta, DB_MPOOL_DIRTY)) != 0) + goto err; + mmeta = NULL; + +err: + if (mmeta != NULL) + if ((t_ret = mpf->put(mpf, mmeta, 0)) != 0 && ret == 0) + ret = t_ret; + if (LOCK_ISSET(mmlock)) + if ((t_ret = __LPUT(dbc, mmlock)) != 0 && ret == 0) + ret = t_ret; + if (meta != NULL) + if ((t_ret = mpf->put(mpf, meta, 0)) != 0 && ret == 0) + ret = t_ret; + if (LOCK_ISSET(metalock)) + if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0) + ret = t_ret; + if (dbc != NULL) + if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0) + ret = t_ret; + return (ret); +} diff --git a/db/hmac/hmac.c b/db/hmac/hmac.c new file mode 100644 index 000000000..a4ac2bff3 --- /dev/null +++ b/db/hmac/hmac.c @@ -0,0 +1,207 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Some parts of this code originally written by Adam Stubblefield, + * astubble@rice.edu. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: hmac.c,v 1.24 2002/08/06 06:11:30 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/crypto.h" +#include "dbinc/db_page.h" /* for hash.h only */ +#include "dbinc/hash.h" +#include "dbinc/hmac.h" + +#define HMAC_OUTPUT_SIZE 20 +#define HMAC_BLOCK_SIZE 64 + +static void __db_hmac __P((u_int8_t *, u_int8_t *, size_t, u_int8_t *)); + +/* + * !!! + * All of these functions use a ctx structure on the stack. The __db_SHA1Init + * call does not initialize the 64-byte buffer portion of it. The + * underlying SHA1 functions will properly pad the buffer if the data length + * is less than 64-bytes, so there isn't a chance of reading uninitialized + * memory. Although it would be cleaner to do a memset(ctx.buffer, 0, 64) + * we do not want to incur that penalty if we don't have to for performance. + */ + +/* + * __db_hmac -- + * Do a hashed MAC. + */ +static void +__db_hmac(k, data, data_len, mac) + u_int8_t *k, *data, *mac; + size_t data_len; +{ + SHA1_CTX ctx; + u_int8_t key[HMAC_BLOCK_SIZE]; + u_int8_t ipad[HMAC_BLOCK_SIZE]; + u_int8_t opad[HMAC_BLOCK_SIZE]; + u_int8_t tmp[HMAC_OUTPUT_SIZE]; + int i; + + memset(key, 0x00, HMAC_BLOCK_SIZE); + memset(ipad, 0x36, HMAC_BLOCK_SIZE); + memset(opad, 0x5C, HMAC_BLOCK_SIZE); + + memcpy(key, k, HMAC_OUTPUT_SIZE); + + for (i = 0; i < HMAC_BLOCK_SIZE; i++) { + ipad[i] ^= key[i]; + opad[i] ^= key[i]; + } + + __db_SHA1Init(&ctx); + __db_SHA1Update(&ctx, ipad, HMAC_BLOCK_SIZE); + __db_SHA1Update(&ctx, data, data_len); + __db_SHA1Final(tmp, &ctx); + __db_SHA1Init(&ctx); + __db_SHA1Update(&ctx, opad, HMAC_BLOCK_SIZE); + __db_SHA1Update(&ctx, tmp, HMAC_OUTPUT_SIZE); + __db_SHA1Final(mac, &ctx); + return; +} + +/* + * __db_chksum -- + * Create a MAC/SHA1 checksum. + * + * PUBLIC: void __db_chksum __P((u_int8_t *, size_t, u_int8_t *, u_int8_t *)); + */ +void +__db_chksum(data, data_len, mac_key, store) + u_int8_t *data; + size_t data_len; + u_int8_t *mac_key; + u_int8_t *store; +{ + int sumlen; + u_int32_t hash4; + u_int8_t tmp[DB_MAC_KEY]; + + /* + * Since the checksum might be on a page of data we are checksumming + * we might be overwriting after checksumming, we zero-out the + * checksum value so that we can have a known value there when + * we verify the checksum. + */ + if (mac_key == NULL) + sumlen = sizeof(u_int32_t); + else + sumlen = DB_MAC_KEY; + memset(store, 0, sumlen); + if (mac_key == NULL) { + /* Just a hash, no MAC */ + hash4 = __ham_func4(NULL, data, data_len); + memcpy(store, &hash4, sumlen); + } else { + memset(tmp, 0, DB_MAC_KEY); + __db_hmac(mac_key, data, data_len, tmp); + memcpy(store, tmp, sumlen); + } + return; +} +/* + * __db_derive_mac -- + * Create a MAC/SHA1 key. + * + * PUBLIC: void __db_derive_mac __P((u_int8_t *, size_t, u_int8_t *)); + */ +void +__db_derive_mac(passwd, plen, mac_key) + u_int8_t *passwd; + size_t plen; + u_int8_t *mac_key; +{ + SHA1_CTX ctx; + + /* Compute the MAC key. mac_key must be 20 bytes. */ + __db_SHA1Init(&ctx); + __db_SHA1Update(&ctx, passwd, plen); + __db_SHA1Update(&ctx, (u_int8_t *)DB_MAC_MAGIC, strlen(DB_MAC_MAGIC)); + __db_SHA1Update(&ctx, passwd, plen); + __db_SHA1Final(mac_key, &ctx); + + return; +} + +/* + * __db_check_chksum -- + * Verify a checksum. + * + * Return 0 on success, >0 (errno) on error, -1 on checksum mismatch. + * + * PUBLIC: int __db_check_chksum __P((DB_ENV *, + * PUBLIC: DB_CIPHER *, u_int8_t *, void *, size_t, int)); + */ +int +__db_check_chksum(dbenv, db_cipher, chksum, data, data_len, is_hmac) + DB_ENV *dbenv; + DB_CIPHER *db_cipher; + u_int8_t *chksum; + void *data; + size_t data_len; + int is_hmac; +{ + int ret; + size_t sum_len; + u_int32_t hash4; + u_int8_t *mac_key, old[DB_MAC_KEY], new[DB_MAC_KEY]; + + /* + * If we are just doing checksumming and not encryption, then checksum + * is 4 bytes. Otherwise, it is DB_MAC_KEY size. Check for illegal + * combinations of crypto/non-crypto checksums. + */ + if (is_hmac == 0) { + if (db_cipher != NULL) { + __db_err(dbenv, + "Unencrypted checksum with a supplied encryption key"); + return (EINVAL); + } + sum_len = sizeof(u_int32_t); + mac_key = NULL; + } else { + if (db_cipher == NULL) { + __db_err(dbenv, + "Encrypted checksum: no encryption key specified"); + return (EINVAL); + } + sum_len = DB_MAC_KEY; + mac_key = db_cipher->mac_key; + } + + /* + * !!! + * Since the checksum might be on the page, we need to have known data + * there so that we can generate the same original checksum. We zero + * it out, just like we do in __db_chksum above. + */ + memcpy(old, chksum, sum_len); + memset(chksum, 0, sum_len); + if (mac_key == NULL) { + /* Just a hash, no MAC */ + hash4 = __ham_func4(NULL, data, data_len); + ret = memcmp((u_int32_t *)old, &hash4, sum_len) ? -1 : 0; + } else { + __db_hmac(mac_key, data, data_len, new); + ret = memcmp(old, new, sum_len) ? -1 : 0; + } + + return (ret); +} diff --git a/db/hmac/sha1.c b/db/hmac/sha1.c new file mode 100644 index 000000000..233f2672c --- /dev/null +++ b/db/hmac/sha1.c @@ -0,0 +1,294 @@ +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: sha1.c,v 1.13 2002/04/09 13:40:36 sue Exp "; +#endif /* not lint */ +/* +SHA-1 in C +By Steve Reid <sreid@sea-to-sky.net> +100% Public Domain + +----------------- +Modified 7/98 +By James H. Brown <jbrown@burgoyne.com> +Still 100% Public Domain + +Corrected a problem which generated improper hash values on 16 bit machines +Routine SHA1Update changed from + void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int +len) +to + void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned +long len) + +The 'len' parameter was declared an int which works fine on 32 bit machines. +However, on 16 bit machines an int is too small for the shifts being done +against +it. This caused the hash function to generate incorrect values if len was +greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update(). + +Since the file IO in main() reads 16K at a time, any file 8K or larger would +be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million +"a"s). + +I also changed the declaration of variables i & j in SHA1Update to +unsigned long from unsigned int for the same reason. + +These changes should make no difference to any 32 bit implementations since +an +int and a long are the same size in those environments. + +-- +I also corrected a few compiler warnings generated by Borland C. +1. Added #include <process.h> for exit() prototype +2. Removed unused variable 'j' in SHA1Final +3. Changed exit(0) to return(0) at end of main. + +ALL changes I made can be located by searching for comments containing 'JHB' +----------------- +Modified 8/98 +By Steve Reid <sreid@sea-to-sky.net> +Still 100% public domain + +1- Removed #include <process.h> and used return() instead of exit() +2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall) +3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net + +----------------- +Modified 4/01 +By Saul Kravitz <Saul.Kravitz@celera.com> +Still 100% PD +Modified to run on Compaq Alpha hardware. + + +*/ + +/* +Test Vectors (from FIPS PUB 180-1) +"abc" + A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D +"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 +A million repetitions of "a" + 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +#define SHA1HANDSOFF + +#ifndef NO_SYSTEM_INCLUDES +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/hmac.h" + +/* #include <process.h> */ /* prototype for exit() - JHB */ +/* Using return() instead of exit() - SWR */ + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* blk0() and blk() perform the initial expand. */ +/* I got the idea of expanding during the round function from SSLeay */ +#define blk0(i) is_bigendian ? block->l[i] : \ + (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ + |(rol(block->l[i],8)&0x00FF00FF)) +#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ + ^block->l[(i+2)&15]^block->l[i&15],1)) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + + +#ifdef VERBOSE /* SAK */ +static void __db_SHAPrintContext __P((SHA1_CTX *, char *)); +static void +__db_SHAPrintContext(context, msg) + SHA1_CTX *context; + char *msg; +{ + printf("%s (%d,%d) %x %x %x %x %x\n", + msg, + context->count[0], context->count[1], + context->state[0], + context->state[1], + context->state[2], + context->state[3], + context->state[4]); +} +#endif + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +/* + * __db_SHA1Transform -- + * + * PUBLIC: void __db_SHA1Transform __P((u_int32_t *, unsigned char *)); + */ +void +__db_SHA1Transform(state, buffer) + u_int32_t *state; + unsigned char *buffer; +{ +u_int32_t a, b, c, d, e; +typedef union { + unsigned char c[64]; + u_int32_t l[16]; +} CHAR64LONG16; +CHAR64LONG16* block; +static int is_bigendian = -1; +#ifdef SHA1HANDSOFF + unsigned char workspace[64]; + + block = (CHAR64LONG16*)workspace; + memcpy(block, buffer, 64); +#else + block = (CHAR64LONG16*)buffer; +#endif + if (is_bigendian == -1) + is_bigendian = __db_isbigendian(); + /* Copy context->state[] to working vars */ + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + /* Wipe variables */ + a = b = c = d = e = 0; +} + + +/* SHA1Init - Initialize new context */ + +/* + * __db_SHA1Init -- + * Initialize new context + * + * PUBLIC: void __db_SHA1Init __P((SHA1_CTX *)); + */ +void +__db_SHA1Init(context) + SHA1_CTX *context; +{ + /* SHA1 initialization constants */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; + context->count[0] = context->count[1] = 0; +} + + +/* Run your data through this. */ + +/* + * __db_SHA1Update -- + * Run your data through this. + * + * PUBLIC: void __db_SHA1Update __P((SHA1_CTX *, unsigned char *, + * PUBLIC: size_t)); + */ +void +__db_SHA1Update(context, data, len) + SHA1_CTX *context; + unsigned char *data; + size_t len; +{ +u_int32_t i, j; /* JHB */ + +#ifdef VERBOSE + __db_SHAPrintContext(context, "before"); +#endif + j = (context->count[0] >> 3) & 63; + if ((context->count[0] += (u_int32_t)len << 3) < (len << 3)) context->count[1]++; + context->count[1] += (u_int32_t)(len >> 29); + if ((j + len) > 63) { + memcpy(&context->buffer[j], data, (i = 64-j)); + __db_SHA1Transform(context->state, context->buffer); + for ( ; i + 63 < len; i += 64) { + __db_SHA1Transform(context->state, &data[i]); + } + j = 0; + } + else i = 0; + memcpy(&context->buffer[j], &data[i], len - i); +#ifdef VERBOSE + __db_SHAPrintContext(context, "after "); +#endif +} + + +/* Add padding and return the message digest. */ + +/* + * __db_SHA1Final -- + * Add padding and return the message digest. + * + * PUBLIC: void __db_SHA1Final __P((unsigned char *, SHA1_CTX *)); + */ +void +__db_SHA1Final(digest, context) + unsigned char *digest; + SHA1_CTX *context; +{ +u_int32_t i; /* JHB */ +unsigned char finalcount[8]; + + for (i = 0; i < 8; i++) { + finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] + >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ + } + __db_SHA1Update(context, (unsigned char *)"\200", 1); + while ((context->count[0] & 504) != 448) { + __db_SHA1Update(context, (unsigned char *)"\0", 1); + } + __db_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() +*/ + for (i = 0; i < 20; i++) { + digest[i] = (unsigned char) + ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); + } + /* Wipe variables */ + i = 0; /* JHB */ + memset(context->buffer, 0, 64); + memset(context->state, 0, 20); + memset(context->count, 0, 8); + memset(finalcount, 0, 8); /* SWR */ +#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ + __db_SHA1Transform(context->state, context->buffer); +#endif +} + +/*************************************************************/ + diff --git a/db/java/src/com/sleepycat/db/DbAppDispatch.java b/db/java/src/com/sleepycat/db/DbAppDispatch.java new file mode 100644 index 000000000..2b9116dbc --- /dev/null +++ b/db/java/src/com/sleepycat/db/DbAppDispatch.java @@ -0,0 +1,22 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbAppDispatch.java,v 11.6 2002/02/26 16:23:02 krinsky Exp + */ + +package com.sleepycat.db; + +/* + * This interface is used by DbEnv.set_app_dispatch() + * + */ +public interface DbAppDispatch +{ + // The value of recops is one of the Db.DB_TXN_* constants + public abstract int app_dispatch(DbEnv env, Dbt dbt, DbLsn lsn, int recops); +} + +// end of DbAppDispatch.java diff --git a/db/java/src/com/sleepycat/db/DbRepStat.java b/db/java/src/com/sleepycat/db/DbRepStat.java new file mode 100644 index 000000000..534d488ee --- /dev/null +++ b/db/java/src/com/sleepycat/db/DbRepStat.java @@ -0,0 +1,43 @@ +// DO NOT EDIT: automatically built by dist/s_java. + +package com.sleepycat.db; + +public class DbRepStat +{ + public int st_status; + public DbLsn st_next_lsn; + public DbLsn st_waiting_lsn; + public int st_dupmasters; + public int st_env_id; + public int st_env_priority; + public int st_gen; + public int st_log_duplicated; + public int st_log_queued; + public int st_log_queued_max; + public int st_log_queued_total; + public int st_log_records; + public int st_log_requested; + public int st_master; + public int st_master_changes; + public int st_msgs_badgen; + public int st_msgs_processed; + public int st_msgs_recover; + public int st_msgs_send_failures; + public int st_msgs_sent; + public int st_newsites; + public int st_nsites; + public int st_nthrottles; + public int st_outdated; + public int st_txns_applied; + public int st_elections; + public int st_elections_won; + public int st_election_cur_winner; + public int st_election_gen; + public DbLsn st_election_lsn; + public int st_election_nsites; + public int st_election_priority; + public int st_election_status; + public int st_election_tiebreaker; + public int st_election_votes; +} +// end of DbRepStat.java diff --git a/db/java/src/com/sleepycat/db/xa/DbXAResource.java b/db/java/src/com/sleepycat/db/xa/DbXAResource.java new file mode 100644 index 000000000..a1eaf50c4 --- /dev/null +++ b/db/java/src/com/sleepycat/db/xa/DbXAResource.java @@ -0,0 +1,190 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbXAResource.java,v 1.2 2002/08/09 01:54:57 bostic Exp + */ + +package com.sleepycat.db.xa; + +import com.sleepycat.db.Db; +import com.sleepycat.db.DbEnv; +import com.sleepycat.db.DbTxn; +import javax.transaction.xa.XAResource; +import javax.transaction.xa.XAException; +import javax.transaction.xa.Xid; + +public class DbXAResource implements XAResource +{ + public DbXAResource(String home, int rmid, int flags) + throws XAException + { + this.home = home; + this.rmid = rmid; + + // We force single-threading for calls to _init/_close. + // This makes our internal code much easier, and + // should not be a performance burden. + synchronized (DbXAResource.class) { + _init(home, rmid, flags); + } + } + + // + // Alternate constructor for convenience. + // Uses an rmid that is unique within this JVM, + // numbered started at 0. + // + public DbXAResource(String home) + throws XAException + { + this(home, get_unique_rmid(), 0); + } + + private native void _init(String home, int rmid, int flags); + + public void close(int flags) + throws XAException + { + // We force single-threading for calls to _init/_close. + // This makes our internal code much easier, and + // should not be a performance burden. + synchronized (DbXAResource.class) { + _close(home, rmid, flags); + } + } + + private native void _close(String home, int rmid, int flags); + + public void commit(Xid xid, boolean onePhase) + throws XAException + { + _commit(xid, rmid, onePhase); + } + + private native void _commit(Xid xid, int rmid, boolean onePhase); + + public void end(Xid xid, int flags) + throws XAException + { + _end(xid, rmid, flags); + } + + private native void _end(Xid xid, int rmid, int flags); + + public void forget(Xid xid) + throws XAException + { + _forget(xid, rmid); + } + + private native void _forget(Xid xid, int rmid); + + public int getTransactionTimeout() + throws XAException + { + return transactionTimeout; + } + + public boolean isSameRM(XAResource xares) + throws XAException + { + if (!(xares instanceof DbXAResource)) + return false; + return (this.rmid == ((DbXAResource)xares).rmid); + } + + public int prepare(Xid xid) + throws XAException + { + return _prepare(xid, rmid); + } + + private native int _prepare(Xid xid, int rmid); + + public Xid [] recover(int flag) + throws XAException + { + return _recover(rmid, flag); + } + + private native Xid[] _recover(int rmid, int flags); + + public void rollback(Xid xid) + throws XAException + { + _rollback(xid, rmid); + System.err.println("DbXAResource.rollback returned"); + } + + private native void _rollback(Xid xid, int rmid); + + public boolean setTransactionTimeout(int seconds) + throws XAException + { + // XXX we are not using the transaction timeout. + transactionTimeout = seconds; + return true; + } + + public void start(Xid xid, int flags) + throws XAException + { + _start(xid, rmid, flags); + } + + private native void _start(Xid xid, int rmid, int flags); + + private static synchronized int get_unique_rmid() + { + return unique_rmid++; + } + + public interface DbAttach + { + public DbEnv get_env(); + public DbTxn get_txn(); + } + + protected static class DbAttachImpl implements DbAttach + { + private DbEnv env; + private DbTxn txn; + + DbAttachImpl(DbEnv env, DbTxn txn) + { + this.env = env; + this.txn = txn; + } + + public DbTxn get_txn() + { + return txn; + } + + public DbEnv get_env() + { + return env; + } + } + + public static native DbAttach xa_attach(Xid xid, Integer rmid); + + //////////////////////////////////////////////////////////////// + // + // private data + // + private long private_dbobj_ = 0; + private int transactionTimeout = 0; + private String home; + private int rmid; + + private static int unique_rmid = 0; + + static + { + Db.load_db(); + } +} diff --git a/db/java/src/com/sleepycat/db/xa/DbXid.java b/db/java/src/com/sleepycat/db/xa/DbXid.java new file mode 100644 index 000000000..08875ea1a --- /dev/null +++ b/db/java/src/com/sleepycat/db/xa/DbXid.java @@ -0,0 +1,49 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbXid.java,v 1.2 2002/08/09 01:54:58 bostic Exp + */ + +package com.sleepycat.db.xa; + +import com.sleepycat.db.DbException; +import com.sleepycat.db.DbTxn; +import javax.transaction.xa.XAException; +import javax.transaction.xa.Xid; + +public class DbXid implements Xid +{ + public DbXid(int formatId, byte[] gtrid, byte[] bqual) + throws XAException + { + this.formatId = formatId; + this.gtrid = gtrid; + this.bqual = bqual; + } + + public int getFormatId() + { + return formatId; + } + + public byte[] getGlobalTransactionId() + { + return gtrid; + } + + public byte[] getBranchQualifier() + { + return bqual; + } + + //////////////////////////////////////////////////////////////// + // + // private data + // + private byte[] gtrid; + private byte[] bqual; + private int formatId; +} diff --git a/db/libdb_java/com_sleepycat_db_xa_DbXAResource.h b/db/libdb_java/com_sleepycat_db_xa_DbXAResource.h new file mode 100644 index 000000000..b9bd78a2a --- /dev/null +++ b/db/libdb_java/com_sleepycat_db_xa_DbXAResource.h @@ -0,0 +1,101 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sleepycat_db_xa_DbXAResource */ + +#ifndef _Included_com_sleepycat_db_xa_DbXAResource +#define _Included_com_sleepycat_db_xa_DbXAResource +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _create_xid + * Signature: (I[B[B)Lcom/sleepycat/db/xa/DbXid; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_xa_DbXAResource__1create_1xid + (JNIEnv *, jobject, jint, jbyteArray, jbyteArray); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _init + * Signature: (Ljava/lang/String;II)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1init + (JNIEnv *, jobject, jstring, jint, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _close + * Signature: (Ljava/lang/String;II)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1close + (JNIEnv *, jobject, jstring, jint, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _commit + * Signature: (Ljavax/transaction/xa/Xid;IZ)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1commit + (JNIEnv *, jobject, jobject, jint, jboolean); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _end + * Signature: (Ljavax/transaction/xa/Xid;II)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1end + (JNIEnv *, jobject, jobject, jint, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _forget + * Signature: (Ljavax/transaction/xa/Xid;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1forget + (JNIEnv *, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _prepare + * Signature: (Ljavax/transaction/xa/Xid;I)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_xa_DbXAResource__1prepare + (JNIEnv *, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _recover + * Signature: (II)[Ljavax/transaction/xa/Xid; + */ +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_xa_DbXAResource__1recover + (JNIEnv *, jobject, jint, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _rollback + * Signature: (Ljavax/transaction/xa/Xid;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1rollback + (JNIEnv *, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: _start + * Signature: (Ljavax/transaction/xa/Xid;II)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1start + (JNIEnv *, jobject, jobject, jint, jint); + +/* + * Class: com_sleepycat_db_xa_DbXAResource + * Method: xa_attach + * Signature: (Ljavax/transaction/xa/Xid;Ljava/lang/Integer;)Lcom/sleepycat/db/xa/DbXAResource$DbAttach + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_xa_DbXAResource_xa_1attach + (JNIEnv *, jclass, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/db/libdb_java/java_DbXAResource.c b/db/libdb_java/java_DbXAResource.c new file mode 100644 index 000000000..dab90e97f --- /dev/null +++ b/db/libdb_java/java_DbXAResource.c @@ -0,0 +1,288 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2001 + * Sleepycat Software. All rights reserved. + */ +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: java_DbXAResource.c,v 11.6 2002/08/06 05:19:06 bostic Exp "; +#endif /* not lint */ + +#include <jni.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#ifdef DIAGNOSTIC +#include <stdio.h> +#endif + +#include "db_int.h" +#include "java_util.h" +#include "dbinc/xa.h" +#include "dbinc_auto/xa_ext.h" +#include "com_sleepycat_db_xa_DbXAResource.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1init + (JNIEnv *jnienv, jobject jthis, jstring home, jint rmid, jint flags) +{ + int err; + LOCKED_STRING ls_home; + jclass cl; + jmethodID mid; + + COMPQUIET(jthis, NULL); + if (locked_string_get(&ls_home, jnienv, home) != 0) + goto out; + if ((err = __db_xa_open((char *)ls_home.string, + rmid, flags)) != XA_OK) { + verify_return(jnienv, err, EXCEPTION_XA); + } + + /* + * Now create the DbEnv object, it will get attached + * to the DB_ENV just made in __db_xa_open. + */ + if ((cl = get_class(jnienv, name_DB_ENV)) == NULL) + goto out; + + mid = (*jnienv)->GetStaticMethodID(jnienv, cl, + "_create_DbEnv_for_XA", "(II)V"); + (*jnienv)->CallStaticVoidMethod(jnienv, cl, mid, 0, rmid); + + out: + locked_string_put(&ls_home, jnienv); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1close + (JNIEnv *jnienv, jobject jthis, jstring home, jint rmid, jint flags) +{ + int err; + LOCKED_STRING ls_home; + + COMPQUIET(jthis, NULL); + if (locked_string_get(&ls_home, jnienv, home) != 0) + goto out; + if ((err = __db_xa_close((char *)ls_home.string, + rmid, flags)) != XA_OK) + verify_return(jnienv, err, EXCEPTION_XA); + out: + locked_string_put(&ls_home, jnienv); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1commit + (JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid, + jboolean onePhase) +{ + XID xid; + long flags; + int err; + + COMPQUIET(jthis, NULL); + if (!get_XID(jnienv, jxid, &xid)) + return; + flags = 0; + if (onePhase == JNI_TRUE) + flags |= TMONEPHASE; + if ((err = __db_xa_commit(&xid, rmid, flags)) != XA_OK) + verify_return(jnienv, err, EXCEPTION_XA); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1end + (JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid, jint flags) +{ + XID xid; + int err; + + COMPQUIET(jthis, NULL); + if (!get_XID(jnienv, jxid, &xid)) + return; + if ((err = __db_xa_end(&xid, rmid, flags)) != XA_OK) + verify_return(jnienv, err, EXCEPTION_XA); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1forget + (JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid) +{ + XID xid; + int err; + + COMPQUIET(jthis, NULL); + if (!get_XID(jnienv, jxid, &xid)) + return; + if ((err = __db_xa_forget(&xid, rmid, 0)) != XA_OK) + verify_return(jnienv, err, EXCEPTION_XA); +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_xa_DbXAResource__1prepare + (JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid) +{ + XID xid; + int err; + + COMPQUIET(jthis, NULL); + if (!get_XID(jnienv, jxid, &xid)) + return (0); + err = __db_xa_prepare(&xid, rmid, 0); + if (err != XA_OK && err != XA_RDONLY) + verify_return(jnienv, err, EXCEPTION_XA); + + return (err); +} + +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_xa_DbXAResource__1recover + (JNIEnv *jnienv, jobject jthis, jint rmid, jint flags) +{ + XID *xids; + int err; + int total; + int cnt; + int i; + int curflags; + size_t nbytes; + jclass xid_class; + jmethodID mid; + jobject obj; + jobjectArray retval; + + COMPQUIET(jthis, NULL); + total = 0; + cnt = 0; + xids = NULL; + flags &= ~(DB_FIRST | DB_LAST | DB_NEXT); + + /* Repeatedly call __db_xa_recover to fill up an array of XIDs */ + curflags = flags | DB_FIRST; + do { + total += cnt; + nbytes = sizeof(XID) * (total + 10); + if ((err = __os_realloc(NULL, nbytes, &xids)) != 0) { + if (xids != NULL) + __os_free(NULL, xids); + verify_return(jnienv, XAER_NOTA, EXCEPTION_XA); + return (NULL); + } + cnt = __db_xa_recover(&xids[total], 10, rmid, curflags); + curflags = flags | DB_NEXT; + } while (cnt > 0); + + if (xids != NULL) + __os_free(NULL, xids); + + if (cnt < 0) { + verify_return(jnienv, cnt, EXCEPTION_XA); + return (NULL); + } + + /* Create the java DbXid array and fill it up */ + if ((xid_class = get_class(jnienv, name_DB_XID)) == NULL) + return (NULL); + mid = (*jnienv)->GetMethodID(jnienv, xid_class, "<init>", + "(I[B[B)V"); + if ((retval = (*jnienv)->NewObjectArray(jnienv, total, xid_class, 0)) + == NULL) + goto out; + + for (i = 0; i < total; i++) { + jobject gtrid; + jobject bqual; + jsize gtrid_len; + jsize bqual_len; + + gtrid_len = (jsize)xids[i].gtrid_length; + bqual_len = (jsize)xids[i].bqual_length; + gtrid = (*jnienv)->NewByteArray(jnienv, gtrid_len); + bqual = (*jnienv)->NewByteArray(jnienv, bqual_len); + if (gtrid == NULL || bqual == NULL) + goto out; + (*jnienv)->SetByteArrayRegion(jnienv, gtrid, 0, gtrid_len, + (jbyte *)&xids[i].data[0]); + (*jnienv)->SetByteArrayRegion(jnienv, bqual, 0, bqual_len, + (jbyte *)&xids[i].data[gtrid_len]); + if ((obj = (*jnienv)->NewObject(jnienv, xid_class, mid, + (jint)xids[i].formatID, gtrid, bqual)) == NULL) + goto out; + (*jnienv)->SetObjectArrayElement(jnienv, retval, i, obj); + } +out: return (retval); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1rollback + (JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid) +{ + XID xid; + int err; + + COMPQUIET(jthis, NULL); + if (!get_XID(jnienv, jxid, &xid)) + return; + if ((err = __db_xa_rollback(&xid, rmid, 0)) != XA_OK) + verify_return(jnienv, err, EXCEPTION_XA); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1start + (JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid, jint flags) +{ + XID xid; + int err; + + COMPQUIET(jthis, NULL); + if (!get_XID(jnienv, jxid, &xid)) + return; + + if ((err = __db_xa_start(&xid, rmid, flags)) != XA_OK) + verify_return(jnienv, err, EXCEPTION_XA); +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_xa_DbXAResource_xa_1attach + (JNIEnv *jnienv, jclass jthisclass, jobject jxid, jobject jrmid) +{ + XID xid; + XID *xidp; + int ret; + DB_ENV *env; + DB_TXN *txn; + int rmid; + int *rmidp; + jobject jtxn; + jobject jenv; + jclass cl; + jmethodID mid; + + COMPQUIET(jthisclass, NULL); + if (jxid == NULL) { + xidp = NULL; + } + else { + xidp = &xid; + if (!get_XID(jnienv, jxid, &xid)) + return (NULL); + } + if (jrmid == NULL) { + rmidp = NULL; + } + else { + rmidp = &rmid; + rmid = (int)(*jnienv)->CallIntMethod(jnienv, jrmid, + mid_Integer_intValue); + } + + if ((ret = db_env_xa_attach(rmidp, xidp, &env, &txn)) != 0) { + /* + * DB_NOTFOUND is a normal return, it means we + * have no current transaction, + */ + if (ret != DB_NOTFOUND) + verify_return(jnienv, ret, 0); + return (NULL); + } + + jenv = ((DB_ENV_JAVAINFO *)env->api2_internal)->jenvref; + jtxn = get_DbTxn(jnienv, txn); + if ((cl = get_class(jnienv, name_DB_XAATTACH)) == NULL) + return (NULL); + mid = (*jnienv)->GetMethodID(jnienv, cl, "<init>", + "(Lcom/sleepycat/db/DbEnv;Lcom/sleepycat/db/DbTxn;)V"); + return (*jnienv)->NewObject(jnienv, cl, mid, jenv, jtxn); +} diff --git a/db/libdb_java/java_stat_auto.c b/db/libdb_java/java_stat_auto.c new file mode 100644 index 000000000..8fa4eb418 --- /dev/null +++ b/db/libdb_java/java_stat_auto.c @@ -0,0 +1,207 @@ +// DO NOT EDIT: automatically built by dist/s_java. +#include "java_util.h" +int __jv_fill_bt_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_bt_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_magic); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_version); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_metaflags); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_nkeys); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_ndata); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_pagesize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_maxkey); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_minkey); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_re_len); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_re_pad); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_levels); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_int_pg); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_leaf_pg); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_dup_pg); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_over_pg); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_free); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_int_pgfree); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_leaf_pgfree); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_dup_pgfree); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_over_pgfree); + return (0); +} +int __jv_fill_h_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_h_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_magic); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_version); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_metaflags); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_nkeys); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_ndata); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_pagesize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_ffactor); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_buckets); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_free); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_bfree); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_bigpages); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_big_bfree); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_overflows); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_ovfl_free); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_dup); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_dup_free); + return (0); +} +int __jv_fill_lock_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_lock_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_id); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cur_maxid); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxlocks); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxlockers); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxobjects); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nmodes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nlocks); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnlocks); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nlockers); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnlockers); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nobjects); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnobjects); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nconflicts); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nrequests); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nreleases); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nnowaits); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ndeadlocks); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_locktimeout); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nlocktimeouts); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_txntimeout); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ntxntimeouts); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize); + return (0); +} +int __jv_fill_log_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_log_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_magic); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_version); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_mode); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_lg_bsize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_lg_size); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_w_bytes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_w_mbytes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wc_bytes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wc_mbytes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wcount); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wcount_fill); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_scount); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cur_file); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cur_offset); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_disk_file); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_disk_offset); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxcommitperflush); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_mincommitperflush); + return (0); +} +int __jv_fill_mpool_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_mpool_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_gbytes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_bytes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ncache); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_map); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cache_hit); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cache_miss); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_create); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_in); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_out); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ro_evict); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_rw_evict); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_trickle); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_pages); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_clean); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_dirty); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_buckets); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_searches); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_longest); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_examined); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_nowait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_wait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_max_wait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_buckets); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_max_buckets); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_pages); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_max_pages); + return (0); +} +int __jv_fill_qam_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_qam_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_magic); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_version); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_metaflags); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_nkeys); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_ndata); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_pagesize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_extentsize); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_pages); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_re_len); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_re_pad); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_pgfree); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_first_recno); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_cur_recno); + return (0); +} +int __jv_fill_rep_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_rep_stat *statp) { + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_status); + JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_next_lsn); + JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_waiting_lsn); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_dupmasters); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_env_id); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_env_priority); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_gen); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_duplicated); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_queued); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_queued_max); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_queued_total); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_records); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_requested); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_master); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_master_changes); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_badgen); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_processed); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_recover); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_send_failures); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_sent); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_newsites); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nsites); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nthrottles); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_outdated); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_txns_applied); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_elections); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_elections_won); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_cur_winner); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_gen); + JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_election_lsn); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_nsites); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_priority); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_status); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_tiebreaker); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_votes); + return (0); +} +int __jv_fill_txn_stat(JNIEnv *jnienv, jclass cl, + jobject jobj, struct __db_txn_stat *statp) { + JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_last_ckp); + JAVADB_STAT_LONG(jnienv, cl, jobj, statp, st_time_ckp); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_last_txnid); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxtxns); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_naborts); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nbegins); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ncommits); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nactive); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nrestores); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnactive); + JAVADB_STAT_ACTIVE(jnienv, cl, jobj, statp, st_txnarray); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait); + JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize); + return (0); +} diff --git a/db/libdb_java/java_stat_auto.h b/db/libdb_java/java_stat_auto.h new file mode 100644 index 000000000..a2a07711a --- /dev/null +++ b/db/libdb_java/java_stat_auto.h @@ -0,0 +1,9 @@ +// DO NOT EDIT: automatically built by dist/s_java. +extern int __jv_fill_bt_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_bt_stat *statp); +extern int __jv_fill_h_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_h_stat *statp); +extern int __jv_fill_lock_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_lock_stat *statp); +extern int __jv_fill_log_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_log_stat *statp); +extern int __jv_fill_mpool_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_mpool_stat *statp); +extern int __jv_fill_qam_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_qam_stat *statp); +extern int __jv_fill_rep_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_rep_stat *statp); +extern int __jv_fill_txn_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_txn_stat *statp); diff --git a/db/mutex/mut_win32.c b/db/mutex/mut_win32.c new file mode 100644 index 000000000..00eddc44a --- /dev/null +++ b/db/mutex/mut_win32.c @@ -0,0 +1,241 @@ +/* + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: mut_win32.c,v 1.6 2002/07/12 04:05:00 mjc Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#include <unistd.h> +#endif + +/* + * This is where we load in the actual test-and-set mutex code. + */ +#define LOAD_ACTUAL_MUTEX_CODE +#include "db_int.h" + +#define GET_HANDLE(mutexp, event) do { \ + int i; \ + char idbuf[13]; \ + \ + if (F_ISSET(mutexp, MUTEX_THREAD)) { \ + event = mutexp->event; \ + return (0); \ + } \ + \ + for (i = 0; i < 8; i++) \ + idbuf[(sizeof(idbuf) - 1) - i] = \ + "0123456789abcdef"[(mutexp->id >> (i * 4)) & 0xf]; \ + event = CreateEvent(NULL, TRUE, FALSE, idbuf); \ + if (event == NULL) \ + return (__os_win32_errno()); \ +} while (0) + +#define RELEASE_HANDLE(mutexp, event) \ + if (!F_ISSET(mutexp, MUTEX_THREAD) && event != NULL) { \ + CloseHandle(event); \ + event = NULL; \ + } + +/* + * __db_win32_mutex_init -- + * Initialize a DB_MUTEX. + * + * PUBLIC: int __db_win32_mutex_init __P((DB_ENV *, DB_MUTEX *, u_int32_t)); + */ +int +__db_win32_mutex_init(dbenv, mutexp, flags) + DB_ENV *dbenv; + DB_MUTEX *mutexp; + u_int32_t flags; +{ + u_int32_t save; + + /* + * The only setting/checking of the MUTEX_MPOOL flags is in the mutex + * mutex allocation code (__db_mutex_alloc/free). Preserve only that + * flag. This is safe because even if this flag was never explicitly + * set, but happened to be set in memory, it will never be checked or + * acted upon. + */ + save = F_ISSET(mutexp, MUTEX_MPOOL); + memset(mutexp, 0, sizeof(*mutexp)); + F_SET(mutexp, save); + + /* + * If this is a thread lock or the process has told us that there are + * no other processes in the environment, use thread-only locks, they + * are faster in some cases. + * + * This is where we decide to ignore locks we don't need to set -- if + * the application isn't threaded, there aren't any threads to block. + */ + if (LF_ISSET(MUTEX_THREAD) || F_ISSET(dbenv, DB_ENV_PRIVATE)) { + if (!F_ISSET(dbenv, DB_ENV_THREAD)) { + F_SET(mutexp, MUTEX_IGNORE); + return (0); + } + F_SET(mutexp, MUTEX_THREAD); + mutexp->event = CreateEvent(NULL, TRUE, FALSE, NULL); + if (mutexp->event == NULL) + return (__os_win32_errno()); + } else + mutexp->id = ((getpid() & 0xffff) << 16) ^ (u_int32_t)mutexp; + + mutexp->spins = __os_spin(dbenv); + F_SET(mutexp, MUTEX_INITED); + + return (0); +} + +/* + * __db_win32_mutex_lock + * Lock on a mutex, logically blocking if necessary. + * + * PUBLIC: int __db_win32_mutex_lock __P((DB_ENV *, DB_MUTEX *)); + */ +int +__db_win32_mutex_lock(dbenv, mutexp) + DB_ENV *dbenv; + DB_MUTEX *mutexp; +{ + HANDLE event; + u_long ms; + int nspins; + + if (F_ISSET(dbenv, DB_ENV_NOLOCKING) || F_ISSET(mutexp, MUTEX_IGNORE)) + return (0); + + event = NULL; + ms = 50; + +loop: /* Attempt to acquire the resource for N spins. */ + for (nspins = mutexp->spins; nspins > 0; --nspins) { + if (!MUTEX_SET(&mutexp->tas)) + continue; + + if (mutexp->locked) { + /* + * If we are about to block for the first time, + * increment the waiter count while we still hold + * the mutex. + */ + if (nspins == 1 && event == NULL) + ++mutexp->nwaiters; + MUTEX_UNSET(&mutexp->tas); + continue; + } + + mutexp->locked = 1; + + if (event == NULL) + ++mutexp->mutex_set_nowait; + else { + ++mutexp->mutex_set_wait; + --mutexp->nwaiters; + } + MUTEX_UNSET(&mutexp->tas); + RELEASE_HANDLE(mutexp, event); + + return (0); + } + + /* + * Yield the processor; wait 50 ms initially, up to 1 second. + * This loop is needed to work around an unlikely race where the signal + * from the unlocking thread gets lost. + */ + if (event == NULL) + GET_HANDLE(mutexp, event); + if (WaitForSingleObject(event, ms) == WAIT_FAILED) + return (__os_win32_errno()); + + if ((ms <<= 1) > MS_PER_SEC) + ms = MS_PER_SEC; + + goto loop; +} + +/* + * __db_win32_mutex_unlock -- + * Release a lock. + * + * PUBLIC: int __db_win32_mutex_unlock __P((DB_ENV *, DB_MUTEX *)); + */ +int +__db_win32_mutex_unlock(dbenv, mutexp) + DB_ENV *dbenv; + DB_MUTEX *mutexp; +{ + int ret; + HANDLE event; + + if (F_ISSET(dbenv, DB_ENV_NOLOCKING) || F_ISSET(mutexp, MUTEX_IGNORE)) + return (0); + +#ifdef DIAGNOSTIC + if (!mutexp->locked) + __db_err(dbenv, + "__db_win32_mutex_unlock: ERROR: lock already unlocked"); +#endif + + ret = 0; + + /* We have to drop the mutex inside a critical section */ + while (!MUTEX_SET(&mutexp->tas)) + ; + mutexp->locked = 0; + MUTEX_UNSET(&mutexp->tas); + + if (mutexp->nwaiters > 0) { + GET_HANDLE(mutexp, event); + + if (!PulseEvent(event)) + ret = __os_win32_errno(); + + RELEASE_HANDLE(mutexp, event); + } + +#ifdef DIAGNOSTIC + if (ret) + __db_err(dbenv, + "__db_win32_mutex_unlock: ERROR: unlock failed"); +#endif + + return (ret); +} + +/* + * __db_win32_mutex_destroy -- + * Destroy a DB_MUTEX. + * + * PUBLIC: int __db_win32_mutex_destroy __P((DB_MUTEX *)); + */ +int +__db_win32_mutex_destroy(mutexp) + DB_MUTEX *mutexp; +{ + int ret; + + if (F_ISSET(mutexp, MUTEX_IGNORE) || !F_ISSET(mutexp, MUTEX_THREAD)) + return (0); + + ret = 0; + if (mutexp->event != NULL) { + if (!CloseHandle(mutexp->event)) + ret = __os_win32_errno(); + mutexp->event = NULL; + } + + return (ret); +} diff --git a/db/os/os_config.c b/db/os/os_config.c new file mode 100644 index 000000000..1879f6d70 --- /dev/null +++ b/db/os/os_config.c @@ -0,0 +1,31 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_config.c,v 11.13 2002/01/31 19:54:12 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#endif + +#include "db_int.h" + +/* + * __os_fs_notzero -- + * Return 1 if allocated filesystem blocks are not zeroed. + * + * PUBLIC: int __os_fs_notzero __P((void)); + */ +int +__os_fs_notzero() +{ + /* Most filesystems zero out implicitly created pages. */ + return (0); +} diff --git a/db/os/os_id.c b/db/os/os_id.c new file mode 100644 index 000000000..ae0339ca0 --- /dev/null +++ b/db/os/os_id.c @@ -0,0 +1,47 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_id.c,v 1.2 2002/01/11 15:52:59 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <unistd.h> +#endif + +#include "db_int.h" + +/* + * __os_id -- + * Return a 32-bit value identifying the current thread of control. + * + * PUBLIC: void __os_id __P((u_int32_t *)); + */ +void +__os_id(idp) + u_int32_t *idp; +{ + /* + * By default, use the process ID. + * + * getpid() returns a pid_t which we convert to a u_int32_t. I have + * not yet seen a system where a pid_t has 64-bits, but I'm sure they + * exist. Since we're returning only the bottom 32-bits, you cannot + * use the return of __os_id to reference a process (for example, you + * cannot send a signal to the value returned by __os_id). To send a + * signal to the current process, use raise(3) instead. + */ +#ifdef HAVE_VXWORKS + *idp = taskIdSelf(); +#else + *idp = getpid(); +#endif +} diff --git a/db/os_vxworks/os_vx_config.c b/db/os_vxworks/os_vx_config.c new file mode 100644 index 000000000..a25583832 --- /dev/null +++ b/db/os_vxworks/os_vx_config.c @@ -0,0 +1,31 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_vx_config.c,v 1.4 2002/01/11 15:53:03 bostic Exp "; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_fs_notzero -- + * Return 1 if allocated filesystem blocks are not zeroed. + * + * PUBLIC: int __os_fs_notzero __P((void)); + */ +int +__os_fs_notzero() +{ + /* + * Some VxWorks FS drivers do not zero-fill pages that were never + * explicitly written to the file, they give you random garbage, + * and that breaks Berkeley DB. + */ + return (1); +} diff --git a/db/os_win32/os_config.c b/db/os_win32/os_config.c new file mode 100644 index 000000000..093c5afe9 --- /dev/null +++ b/db/os_win32/os_config.c @@ -0,0 +1,29 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_config.c,v 11.13 2002/01/11 15:53:06 bostic Exp "; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_fs_notzero -- + * Return 1 if allocated filesystem blocks are not zeroed. + */ +int +__os_fs_notzero() +{ + /* + * Windows/NT zero-fills pages that were never explicitly written to + * the file. Windows 95/98 gives you random garbage, and that breaks + * Berkeley DB. + */ + return (__os_is_winnt() ? 0 : 1); +} diff --git a/db/os_win32/os_fsync.c b/db/os_win32/os_fsync.c new file mode 100644 index 000000000..29e68adf8 --- /dev/null +++ b/db/os_win32/os_fsync.c @@ -0,0 +1,59 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_fsync.c,v 11.15 2002/07/12 18:56:54 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <fcntl.h> /* XXX: Required by __hp3000s900 */ +#include <unistd.h> +#include <string.h> +#endif + +#include "db_int.h" + +/* + * __os_fsync -- + * Flush a file descriptor. + * + * PUBLIC: int __os_fsync __P((DB_ENV *, DB_FH *)); + */ +int +__os_fsync(dbenv, fhp) + DB_ENV *dbenv; + DB_FH *fhp; +{ + BOOL success; + int ret; + + /* + * Do nothing if the file descriptor has been marked as not requiring + * any sync to disk. + */ + if (F_ISSET(fhp, DB_FH_NOSYNC)) + return (0); + + ret = 0; + do { + if (DB_GLOBAL(j_fsync) != NULL) + success = (DB_GLOBAL(j_fsync)(fhp->fd) == 0); + else { + success = FlushFileBuffers(fhp->handle); + if (!success) + __os_set_errno(__os_win32_errno()); + } + } while (!success && (ret = __os_get_errno()) == EINTR); + + if (ret != 0) + __db_err(dbenv, "fsync %s", strerror(ret)); + return (ret); +} diff --git a/db/os_win32/os_handle.c b/db/os_win32/os_handle.c new file mode 100644 index 000000000..b664170a6 --- /dev/null +++ b/db/os_win32/os_handle.c @@ -0,0 +1,126 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_handle.c,v 11.30 2002/07/12 18:56:54 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#endif + +#include "db_int.h" + +/* + * __os_openhandle -- + * Open a file, using POSIX 1003.1 open flags. + * + * PUBLIC: int __os_openhandle __P((DB_ENV *, const char *, int, int, DB_FH *)); + */ +int +__os_openhandle(dbenv, name, flags, mode, fhp) + DB_ENV *dbenv; + const char *name; + int flags, mode; + DB_FH *fhp; +{ + int ret, nrepeat; + + memset(fhp, 0, sizeof(*fhp)); + fhp->handle = INVALID_HANDLE_VALUE; + + /* If the application specified an interface, use it. */ + if (DB_GLOBAL(j_open) != NULL) { + if ((fhp->fd = DB_GLOBAL(j_open)(name, flags, mode)) == -1) + return (__os_get_errno()); + F_SET(fhp, DB_FH_VALID); + return (0); + } + + for (nrepeat = 1; nrepeat < 4; ++nrepeat) { + ret = 0; + fhp->fd = open(name, flags, mode); + + if (fhp->fd == -1) { + /* + * If it's a "temporary" error, we retry up to 3 times, + * waiting up to 12 seconds. While it's not a problem + * if we can't open a database, an inability to open a + * log file is cause for serious dismay. + */ + ret = __os_get_errno(); + if (ret == ENFILE || ret == EMFILE || ret == ENOSPC) { + (void)__os_sleep(dbenv, nrepeat * 2, 0); + continue; + } + + /* + * If it was an EINTR it's reasonable to retry + * immediately, and arbitrarily often. + */ + if (ret == EINTR) { + --nrepeat; + continue; + } + } else { + F_SET(fhp, DB_FH_VALID); + } + break; + } + + return (ret); +} + +/* + * __os_closehandle -- + * Close a file. + * + * PUBLIC: int __os_closehandle __P((DB_ENV *, DB_FH *)); + */ +int +__os_closehandle(dbenv, fhp) + DB_ENV *dbenv; + DB_FH *fhp; +{ + BOOL success; + int ret; + + COMPQUIET(dbenv, NULL); + /* Don't close file descriptors that were never opened. */ + DB_ASSERT(F_ISSET(fhp, DB_FH_VALID) && + ((fhp->fd != -1) || (fhp->handle != INVALID_HANDLE_VALUE))); + + ret = 0; + + do { + if (DB_GLOBAL(j_close) != NULL) + success = (DB_GLOBAL(j_close)(fhp->fd) == 0); + else if (fhp->handle != INVALID_HANDLE_VALUE) { + success = CloseHandle(fhp->handle); + if (!success) + __os_set_errno(__os_win32_errno()); + } + else + success = (close(fhp->fd) == 0); + } while (!success && (ret = __os_get_errno()) == EINTR); + + /* + * Smash the POSIX file descriptor -- it's never tested, but we want + * to catch any mistakes. + */ + fhp->fd = -1; + fhp->handle = INVALID_HANDLE_VALUE; + F_CLR(fhp, DB_FH_VALID); + + return (ret); +} diff --git a/db/os_win32/os_rw.c b/db/os_win32/os_rw.c new file mode 100644 index 000000000..038e4581a --- /dev/null +++ b/db/os_win32/os_rw.c @@ -0,0 +1,182 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_rw.c,v 11.28 2002/08/06 04:56:19 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#include <unistd.h> +#endif + +#include "db_int.h" + +/* + * __os_io -- + * Do an I/O. + * + * PUBLIC: int __os_io __P((DB_ENV *, DB_IO *, int, size_t *)); + */ +int +__os_io(dbenv, db_iop, op, niop) + DB_ENV *dbenv; + DB_IO *db_iop; + int op; + size_t *niop; +{ + int ret; + + if (__os_is_winnt()) { + ULONG64 off = (ULONG64)db_iop->pagesize * db_iop->pgno; + OVERLAPPED over; + DWORD nbytes; + over.Offset = (DWORD)(off & 0xffffffff); + over.OffsetHigh = (DWORD)(off >> 32); + over.hEvent = 0; /* we don't want asynchronous notifications */ + + switch (op) { + case DB_IO_READ: + if (DB_GLOBAL(j_read) != NULL) + goto slow; + if (!ReadFile(db_iop->fhp->handle, + db_iop->buf, (DWORD)db_iop->bytes, &nbytes, &over)) + goto slow; + break; + case DB_IO_WRITE: + if (DB_GLOBAL(j_write) != NULL) + goto slow; + if (!WriteFile(db_iop->fhp->handle, + db_iop->buf, (DWORD)db_iop->bytes, &nbytes, &over)) + goto slow; + break; + } + if (nbytes == db_iop->bytes) { + *niop = (size_t)nbytes; + return (0); + } + } + +slow: MUTEX_THREAD_LOCK(dbenv, db_iop->mutexp); + + if ((ret = __os_seek(dbenv, db_iop->fhp, + db_iop->pagesize, db_iop->pgno, 0, 0, DB_OS_SEEK_SET)) != 0) + goto err; + + switch (op) { + case DB_IO_READ: + ret = __os_read(dbenv, + db_iop->fhp, db_iop->buf, db_iop->bytes, niop); + break; + case DB_IO_WRITE: + ret = __os_write(dbenv, + db_iop->fhp, db_iop->buf, db_iop->bytes, niop); + break; + } + +err: MUTEX_THREAD_UNLOCK(dbenv, db_iop->mutexp); + + return (ret); +} + +/* + * __os_read -- + * Read from a file handle. + * + * PUBLIC: int __os_read __P((DB_ENV *, DB_FH *, void *, size_t, size_t *)); + */ +int +__os_read(dbenv, fhp, addr, len, nrp) + DB_ENV *dbenv; + DB_FH *fhp; + void *addr; + size_t len; + size_t *nrp; +{ + size_t offset; + DWORD nr; + int ret; + BOOL success; + u_int8_t *taddr; + + for (taddr = addr, + offset = 0; offset < len; taddr += nr, offset += nr) { +retry: if (DB_GLOBAL(j_read) != NULL) { + nr = (DWORD)DB_GLOBAL(j_read)(fhp->fd, + taddr, len - offset); + success = (nr >= 0); + } else { + success = ReadFile(fhp->handle, + taddr, (DWORD)(len - offset), &nr, NULL); + if (!success) + __os_set_errno(__os_win32_errno()); + } + + if (!success) { + if ((ret = __os_get_errno()) == EINTR) + goto retry; + __db_err(dbenv, "read: 0x%lx, %lu: %s", + P_TO_ULONG(taddr), + (u_long)len - offset, strerror(ret)); + return (ret); + } + if (nr == 0) + break; + } + *nrp = taddr - (u_int8_t *)addr; + return (0); +} + +/* + * __os_write -- + * Write to a file handle. + * + * PUBLIC: int __os_write __P((DB_ENV *, DB_FH *, void *, size_t, size_t *)); + */ +int +__os_write(dbenv, fhp, addr, len, nwp) + DB_ENV *dbenv; + DB_FH *fhp; + void *addr; + size_t len; + size_t *nwp; +{ + size_t offset; + DWORD nw; + int ret; + BOOL success; + u_int8_t *taddr; + + for (taddr = addr, + offset = 0; offset < len; taddr += nw, offset += nw) { +retry: if (DB_GLOBAL(j_write) != NULL) { + nw = (DWORD)DB_GLOBAL(j_write)(fhp->fd, + taddr, len - offset); + success = (nw >= 0); + } else { + success = WriteFile(fhp->handle, + taddr, (DWORD)(len - offset), &nw, NULL); + if (!success) + __os_set_errno(__os_win32_errno()); + } + + if (!success) { + if ((ret = __os_get_errno()) == EINTR) + goto retry; + __db_err(dbenv, "write: 0x%x, %lu: %s", taddr, + (u_long)len-offset, strerror(ret)); + return (ret); + } + } + + *nwp = len; + return (0); +} diff --git a/db/os_win32/os_stat.c b/db/os_win32/os_stat.c new file mode 100644 index 000000000..b9d122c1f --- /dev/null +++ b/db/os_win32/os_stat.c @@ -0,0 +1,100 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: os_stat.c,v 11.22 2002/07/12 18:56:56 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#include <sys/stat.h> + +#include <string.h> +#endif + +#include "db_int.h" + +/* + * __os_exists -- + * Return if the file exists. + * + * PUBLIC: int __os_exists __P((const char *, int *)); + */ +int +__os_exists(path, isdirp) + const char *path; + int *isdirp; +{ + int ret; + DWORD attrs; + + if (DB_GLOBAL(j_exists) != NULL) + return (DB_GLOBAL(j_exists)(path, isdirp)); + + ret = 0; + do { + attrs = GetFileAttributes(path); + if (attrs == (DWORD)-1) + ret = __os_win32_errno(); + } while (ret == EINTR); + + if (ret != 0) + return (ret); + + if (isdirp != NULL) + *isdirp = (attrs & FILE_ATTRIBUTE_DIRECTORY); + + return (0); +} + +/* + * __os_ioinfo -- + * Return file size and I/O size; abstracted to make it easier + * to replace. + * + * PUBLIC: int __os_ioinfo __P((DB_ENV *, const char *, + * PUBLIC: DB_FH *, u_int32_t *, u_int32_t *, u_int32_t *)); + */ +int +__os_ioinfo(dbenv, path, fhp, mbytesp, bytesp, iosizep) + DB_ENV *dbenv; + const char *path; + DB_FH *fhp; + u_int32_t *mbytesp, *bytesp, *iosizep; +{ + int ret; + BY_HANDLE_FILE_INFORMATION bhfi; + unsigned __int64 filesize; + + if (DB_GLOBAL(j_ioinfo) != NULL) + return (DB_GLOBAL(j_ioinfo)(path, + fhp->fd, mbytesp, bytesp, iosizep)); + +retry: if (!GetFileInformationByHandle(fhp->handle, &bhfi)) { + if ((ret = __os_win32_errno()) == EINTR) + goto retry; + __db_err(dbenv, + "GetFileInformationByHandle: %s", strerror(ret)); + return (ret); + } + + filesize = ((unsigned __int64)bhfi.nFileSizeHigh << 32) + + bhfi.nFileSizeLow; + + /* Return the size of the file. */ + if (mbytesp != NULL) + *mbytesp = (u_int32_t)(filesize / MEGABYTE); + if (bytesp != NULL) + *bytesp = (u_int32_t)(filesize % MEGABYTE); + + /* The filesystem blocksize is not easily available. */ + if (iosizep != NULL) + *iosizep = DB_DEF_IOSIZE; + return (0); +} diff --git a/db/perl/BerkeleyDB/hints/dec_osf.pl b/db/perl/BerkeleyDB/hints/dec_osf.pl new file mode 100644 index 000000000..6d7faeed2 --- /dev/null +++ b/db/perl/BerkeleyDB/hints/dec_osf.pl @@ -0,0 +1 @@ +$self->{LIBS} = [ "@{$self->{LIBS}} -lpthreads" ]; diff --git a/db/perl/BerkeleyDB/ppport.h b/db/perl/BerkeleyDB/ppport.h new file mode 100644 index 000000000..f73adb28c --- /dev/null +++ b/db/perl/BerkeleyDB/ppport.h @@ -0,0 +1,282 @@ +/* This file is Based on output from + * Perl/Pollution/Portability Version 2.0000 */ + +#ifndef _P_P_PORTABILITY_H_ +#define _P_P_PORTABILITY_H_ + +#ifndef PERL_REVISION +# ifndef __PATCHLEVEL_H_INCLUDED__ +# include "patchlevel.h" +# endif +# ifndef PERL_REVISION +# define PERL_REVISION (5) + /* Replace: 1 */ +# define PERL_VERSION PATCHLEVEL +# define PERL_SUBVERSION SUBVERSION + /* Replace PERL_PATCHLEVEL with PERL_VERSION */ + /* Replace: 0 */ +# endif +#endif + +#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) + +#ifndef ERRSV +# define ERRSV perl_get_sv("@",FALSE) +#endif + +#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)) +/* Replace: 1 */ +# define PL_Sv Sv +# define PL_compiling compiling +# define PL_copline copline +# define PL_curcop curcop +# define PL_curstash curstash +# define PL_defgv defgv +# define PL_dirty dirty +# define PL_hints hints +# define PL_na na +# define PL_perldb perldb +# define PL_rsfp_filters rsfp_filters +# define PL_rsfpv rsfp +# define PL_stdingv stdingv +# define PL_sv_no sv_no +# define PL_sv_undef sv_undef +# define PL_sv_yes sv_yes +/* Replace: 0 */ +#endif + +#ifndef pTHX +# define pTHX +# define pTHX_ +# define aTHX +# define aTHX_ +#endif + +#ifndef PTR2IV +# define PTR2IV(d) (IV)(d) +#endif + +#ifndef INT2PTR +# define INT2PTR(any,d) (any)(d) +#endif + +#ifndef dTHR +# ifdef WIN32 +# define dTHR extern int Perl___notused +# else +# define dTHR extern int errno +# endif +#endif + +#ifndef boolSV +# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) +#endif + +#ifndef gv_stashpvn +# define gv_stashpvn(str,len,flags) gv_stashpv(str,flags) +#endif + +#ifndef newSVpvn +# define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0)) +#endif + +#ifndef newRV_inc +/* Replace: 1 */ +# define newRV_inc(sv) newRV(sv) +/* Replace: 0 */ +#endif + +/* DEFSV appears first in 5.004_56 */ +#ifndef DEFSV +# define DEFSV GvSV(PL_defgv) +#endif + +#ifndef SAVE_DEFSV +# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) +#endif + +#ifndef newRV_noinc +# ifdef __GNUC__ +# define newRV_noinc(sv) \ + ({ \ + SV *nsv = (SV*)newRV(sv); \ + SvREFCNT_dec(sv); \ + nsv; \ + }) +# else +# if defined(CRIPPLED_CC) || defined(USE_THREADS) +static SV * newRV_noinc (SV * sv) +{ + SV *nsv = (SV*)newRV(sv); + SvREFCNT_dec(sv); + return nsv; +} +# else +# define newRV_noinc(sv) \ + ((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv) +# endif +# endif +#endif + +/* Provide: newCONSTSUB */ + +/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ +#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63)) + +#if defined(NEED_newCONSTSUB) +static +#else +extern void newCONSTSUB _((HV * stash, char * name, SV *sv)); +#endif + +#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) +void +newCONSTSUB(stash,name,sv) +HV *stash; +char *name; +SV *sv; +{ + U32 oldhints = PL_hints; + HV *old_cop_stash = PL_curcop->cop_stash; + HV *old_curstash = PL_curstash; + line_t oldline = PL_curcop->cop_line; + PL_curcop->cop_line = PL_copline; + + PL_hints &= ~HINT_BLOCK_SCOPE; + if (stash) + PL_curstash = PL_curcop->cop_stash = stash; + + newSUB( + +#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22)) + /* before 5.003_22 */ + start_subparse(), +#else +# if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22) + /* 5.003_22 */ + start_subparse(0), +# else + /* 5.003_23 onwards */ + start_subparse(FALSE, 0), +# endif +#endif + + newSVOP(OP_CONST, 0, newSVpv(name,0)), + newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ + newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) + ); + + PL_hints = oldhints; + PL_curcop->cop_stash = old_cop_stash; + PL_curstash = old_curstash; + PL_curcop->cop_line = oldline; +} +#endif + +#endif /* newCONSTSUB */ + + +#ifndef START_MY_CXT + +/* + * Boilerplate macros for initializing and accessing interpreter-local + * data from C. All statics in extensions should be reworked to use + * this, if you want to make the extension thread-safe. See ext/re/re.xs + * for an example of the use of these macros. + * + * Code that uses these macros is responsible for the following: + * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" + * 2. Declare a typedef named my_cxt_t that is a structure that contains + * all the data that needs to be interpreter-local. + * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. + * 4. Use the MY_CXT_INIT macro such that it is called exactly once + * (typically put in the BOOT: section). + * 5. Use the members of the my_cxt_t structure everywhere as + * MY_CXT.member. + * 6. Use the dMY_CXT macro (a declaration) in all the functions that + * access MY_CXT. + */ + +#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ + defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) + +/* This must appear in all extensions that define a my_cxt_t structure, + * right after the definition (i.e. at file scope). The non-threads + * case below uses it to declare the data as static. */ +#define START_MY_CXT + +#if PERL_REVISION == 5 && \ + (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 )) +/* Fetches the SV that keeps the per-interpreter data. */ +#define dMY_CXT_SV \ + SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE) +#else /* >= perl5.004_68 */ +#define dMY_CXT_SV \ + SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ + sizeof(MY_CXT_KEY)-1, TRUE) +#endif /* < perl5.004_68 */ + +/* This declaration should be used within all functions that use the + * interpreter-local data. */ +#define dMY_CXT \ + dMY_CXT_SV; \ + my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) + +/* Creates and zeroes the per-interpreter data. + * (We allocate my_cxtp in a Perl SV so that it will be released when + * the interpreter goes away.) */ +#define MY_CXT_INIT \ + dMY_CXT_SV; \ + /* newSV() allocates one more than needed */ \ + my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ + Zero(my_cxtp, 1, my_cxt_t); \ + sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) + +/* This macro must be used to access members of the my_cxt_t structure. + * e.g. MYCXT.some_data */ +#define MY_CXT (*my_cxtp) + +/* Judicious use of these macros can reduce the number of times dMY_CXT + * is used. Use is similar to pTHX, aTHX etc. */ +#define pMY_CXT my_cxt_t *my_cxtp +#define pMY_CXT_ pMY_CXT, +#define _pMY_CXT ,pMY_CXT +#define aMY_CXT my_cxtp +#define aMY_CXT_ aMY_CXT, +#define _aMY_CXT ,aMY_CXT + +#else /* single interpreter */ + +#ifndef NOOP +# define NOOP (void)0 +#endif + +#ifdef HASATTRIBUTE +# define PERL_UNUSED_DECL __attribute__((unused)) +#else +# define PERL_UNUSED_DECL +#endif + +#ifndef dNOOP +# define dNOOP extern int Perl___notused PERL_UNUSED_DECL +#endif + +#define START_MY_CXT static my_cxt_t my_cxt; +#define dMY_CXT_SV dNOOP +#define dMY_CXT dNOOP +#define MY_CXT_INIT NOOP +#define MY_CXT my_cxt + +#define pMY_CXT void +#define pMY_CXT_ +#define _pMY_CXT +#define aMY_CXT +#define aMY_CXT_ +#define _aMY_CXT + +#endif + +#endif /* START_MY_CXT */ + + +#endif /* _P_P_PORTABILITY_H_ */ diff --git a/db/perl/BerkeleyDB/scan b/db/perl/BerkeleyDB/scan new file mode 100644 index 000000000..eb064950b --- /dev/null +++ b/db/perl/BerkeleyDB/scan @@ -0,0 +1,229 @@ +#!/usr/local/bin/perl + +my $ignore_re = '^(' . join("|", + qw( + _ + [a-z] + DBM + DBC + DB_AM_ + DB_BT_ + DB_RE_ + DB_HS_ + DB_FUNC_ + DB_DBT_ + DB_DBM + DB_TSL + MP + TXN + )) . ')' ; + +my %ignore_def = map {$_, 1} qw() ; + +%ignore_enums = map {$_, 1} qw( ACTION db_status_t db_notices db_lockmode_t ) ; + +my $filler = ' ' x 26 ; + +chdir "libraries" || die "Cannot chdir into './libraries': $!\n"; + +foreach my $name (sort tuple glob "[2-9]*") +{ + my $inc = "$name/include/db.h" ; + next unless -f $inc ; + + my $file = readFile($inc) ; + StripCommentsAndStrings($file) ; + my $result = scan($name, $file) ; + print "\n\t#########\n\t# $name\n\t#########\n\n$result" + if $result; +} +exit ; + + +sub scan +{ + my $version = shift ; + my $file = shift ; + + my %seen_define = () ; + my $result = "" ; + + if (1) { + # Preprocess all tri-graphs + # including things stuck in quoted string constants. + $file =~ s/\?\?=/#/g; # | ??=| #| + $file =~ s/\?\?\!/|/g; # | ??!| || + $file =~ s/\?\?'/^/g; # | ??'| ^| + $file =~ s/\?\?\(/[/g; # | ??(| [| + $file =~ s/\?\?\)/]/g; # | ??)| ]| + $file =~ s/\?\?\-/~/g; # | ??-| ~| + $file =~ s/\?\?\//\\/g; # | ??/| \| + $file =~ s/\?\?</{/g; # | ??<| {| + $file =~ s/\?\?>/}/g; # | ??>| }| + } + + while ( $file =~ /^\s*#\s*define\s+([\$\w]+)\b(?!\()\s*(.*)/gm ) + { + my $def = $1; + my $rest = $2; + my $ignore = 0 ; + + $ignore = 1 if $ignore_def{$def} || $def =~ /$ignore_re/o ; + + # Cannot do: (-1) and ((LHANDLE)3) are OK: + #print("Skip non-wordy $def => $rest\n"), + + $rest =~ s/\s*$//; + #next if $rest =~ /[^\w\$]/; + + #print "Matched $_ ($def)\n" ; + + next if $before{$def} ++ ; + + if ($ignore) + { $seen_define{$def} = 'IGNORE' } + elsif ($rest =~ /"/) + { $seen_define{$def} = 'STRING' } + else + { $seen_define{$def} = 'DEFINE' } + } + + foreach $define (sort keys %seen_define) + { + my $out = $filler ; + substr($out,0, length $define) = $define; + $result .= "\t$out => $seen_define{$define},\n" ; + } + + while ($file =~ /\btypedef\s+enum\s*{(.*?)}\s*(\w+)/gs ) + { + my $enum = $1 ; + my $name = $2 ; + my $ignore = 0 ; + + $ignore = 1 if $ignore_enums{$name} ; + + #$enum =~ s/\s*=\s*\S+\s*(,?)\s*\n/$1/g; + $enum =~ s/^\s*//; + $enum =~ s/\s*$//; + + my @tokens = map { s/\s*=.*// ; $_} split /\s*,\s*/, $enum ; + my @new = grep { ! $Enums{$_}++ } @tokens ; + if (@new) + { + my $value ; + if ($ignore) + { $value = "IGNORE, # $version" } + else + { $value = "'$version'," } + + $result .= "\n\t# enum $name\n"; + my $out = $filler ; + foreach $name (@new) + { + $out = $filler ; + substr($out,0, length $name) = $name; + $result .= "\t$out => $value\n" ; + } + } + } + + return $result ; +} + + +sub StripCommentsAndStrings +{ + + # Strip C & C++ coments + # From the perlfaq + $_[0] =~ + + s{ + /\* ## Start of /* ... */ comment + [^*]*\*+ ## Non-* followed by 1-or-more *'s + ( + [^/*][^*]*\*+ + )* ## 0-or-more things which don't start with / + ## but do end with '*' + / ## End of /* ... */ comment + + | ## OR C++ Comment + // ## Start of C++ comment // + [^\n]* ## followed by 0-or-more non end of line characters + + | ## OR various things which aren't comments: + + ( + " ## Start of " ... " string + ( + \\. ## Escaped char + | ## OR + [^"\\] ## Non "\ + )* + " ## End of " ... " string + + | ## OR + + ' ## Start of ' ... ' string + ( + \\. ## Escaped char + | ## OR + [^'\\] ## Non '\ + )* + ' ## End of ' ... ' string + + | ## OR + + . ## Anything other char + [^/"'\\]* ## Chars which doesn't start a comment, string or escape + ) + }{$2}gxs; + + + + # Remove double-quoted strings. + #$_[0] =~ s#"(\\.|[^"\\])*"##g; + + # Remove single-quoted strings. + #$_[0] =~ s#'(\\.|[^'\\])*'##g; + + # Remove leading whitespace. + $_[0] =~ s/\A\s+//m ; + + # Remove trailing whitespace. + $_[0] =~ s/\s+\Z//m ; + + # Replace all multiple whitespace by a single space. + #$_[0] =~ s/\s+/ /g ; +} + + +sub readFile +{ + my $filename = shift ; + open F, "<$filename" || die "Cannot open $filename: $!\n" ; + local $/ ; + my $x = <F> ; + close F ; + return $x ; +} + +sub tuple +{ + my (@a) = split(/\./, $a) ; + my (@b) = split(/\./, $b) ; + if (@a != @b) { + my $diff = @a - @b ; + push @b, (0 x $diff) if $diff > 0 ; + push @a, (0 x -$diff) if $diff < 0 ; + } + foreach $A (@a) { + $B = shift @b ; + $A == $B or return $A <=> $B ; + } + return 0; +} + +__END__ + diff --git a/db/perl/BerkeleyDB/t/db-3.3.t b/db/perl/BerkeleyDB/t/db-3.3.t new file mode 100644 index 000000000..e18686343 --- /dev/null +++ b/db/perl/BerkeleyDB/t/db-3.3.t @@ -0,0 +1,174 @@ +#!./perl -w + +# ID: %I%, %G% + +use strict ; + +BEGIN { + unless(grep /blib/, @INC) { + chdir 't' if -d 't'; + @INC = '../lib' if -d '../lib'; + } +} + +use BerkeleyDB; +use t::util ; + +BEGIN +{ + if ($BerkeleyDB::db_version < 3.3) { + print "1..0 # Skipping test, this needs Berkeley DB 3.3.x or better\n" ; + exit 0 ; + } +} + +umask(0); + +print "1..37\n"; + +{ + # db->truncate + + my $Dfile; + my $lex = new LexFile $Dfile ; + my %hash ; + my ($k, $v) ; + ok 1, my $db = new BerkeleyDB::Hash -Filename => $Dfile, + -Flags => DB_CREATE ; + + # create some data + my %data = ( + "red" => 2, + "green" => "house", + "blue" => "sea", + ) ; + + my $ret = 0 ; + while (($k, $v) = each %data) { + $ret += $db->db_put($k, $v) ; + } + ok 2, $ret == 0 ; + + # check there are three records + ok 3, countRecords($db) == 3 ; + + # now truncate the database + my $count = 0; + ok 4, $db->truncate($count) == 0 ; + + ok 5, $count == 3 ; + ok 6, countRecords($db) == 0 ; + +} + +{ + # db->associate -- secondary keys + + sub sec_key + { + #print "in sec_key\n"; + my $pkey = shift ; + my $pdata = shift ; + + $_[0] = $pdata ; + return 0; + } + + my ($Dfile1, $Dfile2); + my $lex = new LexFile $Dfile1, $Dfile2 ; + my %hash ; + my $status; + my ($k, $v, $pk) = ('','',''); + + # create primary database + ok 7, my $primary = new BerkeleyDB::Hash -Filename => $Dfile1, + -Flags => DB_CREATE ; + + # create secondary database + ok 8, my $secondary = new BerkeleyDB::Hash -Filename => $Dfile2, + -Flags => DB_CREATE ; + + # associate primary with secondary + ok 9, $primary->associate($secondary, \&sec_key) == 0; + + # add data to the primary + my %data = ( + "red" => "flag", + "green" => "house", + "blue" => "sea", + ) ; + + my $ret = 0 ; + while (($k, $v) = each %data) { + my $r = $primary->db_put($k, $v) ; + #print "put $r $BerkeleyDB::Error\n"; + $ret += $r; + } + ok 10, $ret == 0 ; + + # check the records in the secondary + ok 11, countRecords($secondary) == 3 ; + + ok 12, $secondary->db_get("house", $v) == 0; + ok 13, $v eq "house"; + + ok 14, $secondary->db_get("sea", $v) == 0; + ok 15, $v eq "sea"; + + ok 16, $secondary->db_get("flag", $v) == 0; + ok 17, $v eq "flag"; + + # pget to primary database is illegal + ok 18, $primary->db_pget('red', $pk, $v) != 0 ; + + # pget to secondary database is ok + ok 19, $secondary->db_pget('house', $pk, $v) == 0 ; + ok 20, $pk eq 'green'; + ok 21, $v eq 'house'; + + ok 22, my $p_cursor = $primary->db_cursor(); + ok 23, my $s_cursor = $secondary->db_cursor(); + + # c_get from primary + $k = 1; + ok 24, $p_cursor->c_get($k, $v, DB_FIRST) == 0; + + # c_get from secondary + ok 25, $s_cursor->c_get($k, $v, DB_FIRST) == 0; + + # c_pget from primary database should fail + $k = 1; + ok 26, $p_cursor->c_pget($k, $pk, $v, DB_FIRST) != 0; + + # c_pget from secondary database + ok 27, $s_cursor->c_pget($k, $pk, $v, DB_FIRST) == 0; + + # check put to secondary is illegal + ok 28, $secondary->db_put("tom", "dick") != 0; + ok 29, countRecords($secondary) == 3 ; + + # delete from primary + ok 30, $primary->db_del("green") == 0 ; + ok 31, countRecords($primary) == 2 ; + + # check has been deleted in secondary + ok 32, $secondary->db_get("house", $v) != 0; + ok 33, countRecords($secondary) == 2 ; + + # delete from secondary + ok 34, $secondary->db_del('flag') == 0 ; + ok 35, countRecords($secondary) == 1 ; + + + # check deleted from primary + ok 36, $primary->db_get("red", $v) != 0; + ok 37, countRecords($primary) == 1 ; + +} + + + # db->associate -- multiple secondary keys + + + # db->associate -- same again but when DB_DUP is specified. + diff --git a/db/rpc_server/c/db_server_proc.c b/db/rpc_server/c/db_server_proc.c new file mode 100644 index 000000000..207e160c3 --- /dev/null +++ b/db/rpc_server/c/db_server_proc.c @@ -0,0 +1,2500 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifdef HAVE_RPC +#ifndef lint +static const char revid[] = "Id: db_server_proc.c,v 1.92 2002/07/29 15:21:20 sue Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <rpc/rpc.h> + +#include <string.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" + +/* BEGIN __env_cachesize_proc */ +/* + * PUBLIC: void __env_cachesize_proc __P((long, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, __env_cachesize_reply *)); + */ +void +__env_cachesize_proc(dbenvcl_id, gbytes, bytes, + ncache, replyp) + long dbenvcl_id; + u_int32_t gbytes; + u_int32_t bytes; + u_int32_t ncache; + __env_cachesize_reply *replyp; +/* END __env_cachesize_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_cachesize(dbenv, gbytes, bytes, ncache); + + replyp->status = ret; + return; +} + +/* BEGIN __env_close_proc */ +/* + * PUBLIC: void __env_close_proc __P((long, u_int32_t, __env_close_reply *)); + */ +void +__env_close_proc(dbenvcl_id, flags, replyp) + long dbenvcl_id; + u_int32_t flags; + __env_close_reply *replyp; +/* END __env_close_proc */ +{ + ct_entry *dbenv_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + replyp->status = __dbenv_close_int(dbenvcl_id, flags, 0); + return; +} + +/* BEGIN __env_create_proc */ +/* + * PUBLIC: void __env_create_proc __P((u_int32_t, __env_create_reply *)); + */ +void +__env_create_proc(timeout, replyp) + u_int32_t timeout; + __env_create_reply *replyp; +/* END __env_create_proc */ +{ + DB_ENV *dbenv; + ct_entry *ctp; + int ret; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + if ((ret = db_env_create(&dbenv, 0)) == 0) { + ctp->ct_envp = dbenv; + ctp->ct_type = CT_ENV; + ctp->ct_parent = NULL; + ctp->ct_envparent = ctp; + __dbsrv_settimeout(ctp, timeout); + __dbsrv_active(ctp); + replyp->envcl_id = ctp->ct_id; + } else + __dbclear_ctp(ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __env_dbremove_proc */ +/* + * PUBLIC: void __env_dbremove_proc __P((long, long, char *, char *, u_int32_t, + * PUBLIC: __env_dbremove_reply *)); + */ +void +__env_dbremove_proc(dbenvcl_id, txnpcl_id, name, + subdb, flags, replyp) + long dbenvcl_id; + long txnpcl_id; + char *name; + char *subdb; + u_int32_t flags; + __env_dbremove_reply *replyp; +/* END __env_dbremove_proc */ +{ + int ret; + DB_ENV * dbenv; + ct_entry *dbenv_ctp; + DB_TXN * txnp; + ct_entry *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbremove(dbenv, txnp, name, subdb, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_dbrename_proc */ +/* + * PUBLIC: void __env_dbrename_proc __P((long, long, char *, char *, char *, + * PUBLIC: u_int32_t, __env_dbrename_reply *)); + */ +void +__env_dbrename_proc(dbenvcl_id, txnpcl_id, name, + subdb, newname, flags, replyp) + long dbenvcl_id; + long txnpcl_id; + char *name; + char *subdb; + char *newname; + u_int32_t flags; + __env_dbrename_reply *replyp; +/* END __env_dbrename_proc */ +{ + int ret; + DB_ENV * dbenv; + ct_entry *dbenv_ctp; + DB_TXN * txnp; + ct_entry *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbrename(dbenv, txnp, name, subdb, newname, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_encrypt_proc */ +/* + * PUBLIC: void __env_encrypt_proc __P((long, char *, u_int32_t, + * PUBLIC: __env_encrypt_reply *)); + */ +void +__env_encrypt_proc(dbenvcl_id, passwd, flags, replyp) + long dbenvcl_id; + char *passwd; + u_int32_t flags; + __env_encrypt_reply *replyp; +/* END __env_encrypt_proc */ +{ + int ret; + DB_ENV * dbenv; + ct_entry *dbenv_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_encrypt(dbenv, passwd, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_flags_proc */ +/* + * PUBLIC: void __env_flags_proc __P((long, u_int32_t, u_int32_t, + * PUBLIC: __env_flags_reply *)); + */ +void +__env_flags_proc(dbenvcl_id, flags, onoff, replyp) + long dbenvcl_id; + u_int32_t flags; + u_int32_t onoff; + __env_flags_reply *replyp; +/* END __env_flags_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_flags(dbenv, flags, onoff); + if (onoff) + dbenv_ctp->ct_envdp.onflags = flags; + else + dbenv_ctp->ct_envdp.offflags = flags; + + replyp->status = ret; + return; +} +/* BEGIN __env_open_proc */ +/* + * PUBLIC: void __env_open_proc __P((long, char *, u_int32_t, u_int32_t, + * PUBLIC: __env_open_reply *)); + */ +void +__env_open_proc(dbenvcl_id, home, flags, + mode, replyp) + long dbenvcl_id; + char *home; + u_int32_t flags; + u_int32_t mode; + __env_open_reply *replyp; +/* END __env_open_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp, *new_ctp; + u_int32_t newflags, shareflags; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + fullhome = get_home(home); + if (fullhome == NULL) { + ret = DB_NOSERVER_HOME; + goto out; + } + + /* + * If they are using locking do deadlock detection for them, + * internally. + */ + if ((flags & DB_INIT_LOCK) && + (ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) + goto out; + + if (__dbsrv_verbose) { + dbenv->set_errfile(dbenv, stderr); + dbenv->set_errpfx(dbenv, fullhome->home); + } + + /* + * Mask off flags we ignore + */ + newflags = (flags & ~DB_SERVER_FLAGMASK); + shareflags = (newflags & DB_SERVER_ENVFLAGS); + /* + * Check now whether we can share a handle for this env. + */ + replyp->envcl_id = dbenvcl_id; + if ((new_ctp = __dbsrv_shareenv(dbenv_ctp, fullhome, shareflags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing env ID %ld\n", new_ctp->ct_id); + replyp->envcl_id = new_ctp->ct_id; + ret = __dbenv_close_int(dbenvcl_id, 0, 0); + } else { + ret = dbenv->open(dbenv, fullhome->home, newflags, mode); + dbenv_ctp->ct_envdp.home = fullhome; + dbenv_ctp->ct_envdp.envflags = shareflags; + } +out: replyp->status = ret; + return; +} + +/* BEGIN __env_remove_proc */ +/* + * PUBLIC: void __env_remove_proc __P((long, char *, u_int32_t, + * PUBLIC: __env_remove_reply *)); + */ +void +__env_remove_proc(dbenvcl_id, home, flags, replyp) + long dbenvcl_id; + char *home; + u_int32_t flags; + __env_remove_reply *replyp; +/* END __env_remove_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + fullhome = get_home(home); + if (fullhome == NULL) { + replyp->status = DB_NOSERVER_HOME; + return; + } + + ret = dbenv->remove(dbenv, fullhome->home, flags); + __dbdel_ctp(dbenv_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_abort_proc */ +/* + * PUBLIC: void __txn_abort_proc __P((long, __txn_abort_reply *)); + */ +void +__txn_abort_proc(txnpcl_id, replyp) + long txnpcl_id; + __txn_abort_reply *replyp; +/* END __txn_abort_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->abort(txnp); + __dbdel_ctp(txnp_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_begin_proc */ +/* + * PUBLIC: void __txn_begin_proc __P((long, long, u_int32_t, + * PUBLIC: __txn_begin_reply *)); + */ +void +__txn_begin_proc(dbenvcl_id, parentcl_id, + flags, replyp) + long dbenvcl_id; + long parentcl_id; + u_int32_t flags; + __txn_begin_reply *replyp; +/* END __txn_begin_proc */ +{ + DB_ENV *dbenv; + DB_TXN *parent, *txnp; + ct_entry *ctp, *dbenv_ctp, *parent_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + parent_ctp = NULL; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + + if (parentcl_id != 0) { + ACTIVATE_CTP(parent_ctp, parentcl_id, CT_TXN); + parent = (DB_TXN *)parent_ctp->ct_anyp; + ctp->ct_activep = parent_ctp->ct_activep; + } else + parent = NULL; + + ret = dbenv->txn_begin(dbenv, parent, &txnp, flags); + if (ret == 0) { + ctp->ct_txnp = txnp; + ctp->ct_type = CT_TXN; + ctp->ct_parent = parent_ctp; + ctp->ct_envparent = dbenv_ctp; + replyp->txnidcl_id = ctp->ct_id; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + } else + __dbclear_ctp(ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_commit_proc */ +/* + * PUBLIC: void __txn_commit_proc __P((long, u_int32_t, + * PUBLIC: __txn_commit_reply *)); + */ +void +__txn_commit_proc(txnpcl_id, flags, replyp) + long txnpcl_id; + u_int32_t flags; + __txn_commit_reply *replyp; +/* END __txn_commit_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->commit(txnp, flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_discard_proc */ +/* + * PUBLIC: void __txn_discard_proc __P((long, u_int32_t, + * PUBLIC: __txn_discard_reply *)); + */ +void +__txn_discard_proc(txnpcl_id, flags, replyp) + long txnpcl_id; + u_int32_t flags; + __txn_discard_reply *replyp; +/* END __txn_discard_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->discard(txnp, flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_prepare_proc */ +/* + * PUBLIC: void __txn_prepare_proc __P((long, u_int8_t *, + * PUBLIC: __txn_prepare_reply *)); + */ +void +__txn_prepare_proc(txnpcl_id, gid, replyp) + long txnpcl_id; + u_int8_t *gid; + __txn_prepare_reply *replyp; +/* END __txn_prepare_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->prepare(txnp, gid); + replyp->status = ret; + return; +} + +/* BEGIN __txn_recover_proc */ +/* + * PUBLIC: void __txn_recover_proc __P((long, u_int32_t, u_int32_t, + * PUBLIC: __txn_recover_reply *, int *)); + */ +void +__txn_recover_proc(dbenvcl_id, count, + flags, replyp, freep) + long dbenvcl_id; + u_int32_t count; + u_int32_t flags; + __txn_recover_reply *replyp; + int * freep; +/* END __txn_recover_proc */ +{ + DB_ENV *dbenv; + DB_PREPLIST *dbprep, *p; + ct_entry *dbenv_ctp, *ctp; + long erri, i, retcount; + u_int32_t *txnidp; + int ret; + u_int8_t *gid; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + dbprep = NULL; + *freep = 0; + + if ((ret = + __os_malloc(dbenv, count * sizeof(DB_PREPLIST), &dbprep)) != 0) + goto out; + if ((ret = + dbenv->txn_recover(dbenv, dbprep, count, &retcount, flags)) != 0) + goto out; + /* + * If there is nothing, success, but it's easy. + */ + replyp->retcount = retcount; + if (retcount == 0) { + replyp->txn.txn_val = NULL; + replyp->txn.txn_len = 0; + replyp->gid.gid_val = NULL; + replyp->gid.gid_len = 0; + } + + /* + * We have our txn list. Now we need to allocate the space for + * the txn ID array and the GID array and set them up. + */ + if ((ret = __os_calloc(dbenv, retcount, sizeof(u_int32_t), + &replyp->txn.txn_val)) != 0) + goto out; + replyp->txn.txn_len = retcount * sizeof(u_int32_t); + if ((ret = __os_calloc(dbenv, retcount, DB_XIDDATASIZE, + &replyp->gid.gid_val)) != 0) { + __os_free(dbenv, replyp->txn.txn_val); + goto out; + } + replyp->gid.gid_len = retcount * DB_XIDDATASIZE; + + /* + * Now walk through our results, creating parallel arrays + * to send back. For each entry we need to create a new + * txn ctp and then fill in the array info. + */ + i = 0; + p = dbprep; + gid = replyp->gid.gid_val; + txnidp = replyp->txn.txn_val; + while (i++ < retcount) { + ctp = new_ct_ent(&ret); + if (ret != 0) { + i--; + goto out2; + } + ctp->ct_txnp = p->txn; + ctp->ct_type = CT_TXN; + ctp->ct_parent = NULL; + ctp->ct_envparent = dbenv_ctp; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + + *txnidp = ctp->ct_id; + memcpy(gid, p->gid, DB_XIDDATASIZE); + + p++; + txnidp++; + gid += DB_XIDDATASIZE; + } + /* + * If we get here, we have success and we have to set freep + * so it'll get properly freed next time. + */ + *freep = 1; +out: + if (dbprep != NULL) + __os_free(dbenv, dbprep); + replyp->status = ret; + return; +out2: + /* + * We had an error in the middle of creating our new txn + * ct entries. We have to unwind all that we have done. Ugh. + */ + for (txnidp = replyp->txn.txn_val, erri = 0; + erri < i; erri++, txnidp++) { + ctp = get_tableent(*txnidp); + __dbclear_ctp(ctp); + } + __os_free(dbenv, replyp->txn.txn_val); + __os_free(dbenv, replyp->gid.gid_val); + __os_free(dbenv, dbprep); + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_maxkey_proc */ +/* + * PUBLIC: void __db_bt_maxkey_proc __P((long, u_int32_t, + * PUBLIC: __db_bt_maxkey_reply *)); + */ +void +__db_bt_maxkey_proc(dbpcl_id, maxkey, replyp) + long dbpcl_id; + u_int32_t maxkey; + __db_bt_maxkey_reply *replyp; +/* END __db_bt_maxkey_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_maxkey(dbp, maxkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_associate_proc */ +/* + * PUBLIC: void __db_associate_proc __P((long, long, long, u_int32_t, + * PUBLIC: __db_associate_reply *)); + */ +void +__db_associate_proc(dbpcl_id, txnpcl_id, sdbpcl_id, + flags, replyp) + long dbpcl_id; + long txnpcl_id; + long sdbpcl_id; + u_int32_t flags; + __db_associate_reply *replyp; +/* END __db_associate_proc */ +{ + DB *dbp, *sdbp; + DB_TXN *txnp; + ct_entry *dbp_ctp, *sdbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + ACTIVATE_CTP(sdbp_ctp, sdbpcl_id, CT_DB); + sdbp = (DB *)sdbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + + /* + * We do not support DB_CREATE for associate. Users + * can only access secondary indices on a read-only basis, + * so whatever they are looking for needs to be there already. + */ + if (flags != 0) + ret = EINVAL; + else + ret = dbp->associate(dbp, txnp, sdbp, NULL, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_minkey_proc */ +/* + * PUBLIC: void __db_bt_minkey_proc __P((long, u_int32_t, + * PUBLIC: __db_bt_minkey_reply *)); + */ +void +__db_bt_minkey_proc(dbpcl_id, minkey, replyp) + long dbpcl_id; + u_int32_t minkey; + __db_bt_minkey_reply *replyp; +/* END __db_bt_minkey_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_minkey(dbp, minkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_close_proc */ +/* + * PUBLIC: void __db_close_proc __P((long, u_int32_t, __db_close_reply *)); + */ +void +__db_close_proc(dbpcl_id, flags, replyp) + long dbpcl_id; + u_int32_t flags; + __db_close_reply *replyp; +/* END __db_close_proc */ +{ + ct_entry *dbp_ctp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + replyp->status = __db_close_int(dbpcl_id, flags); + return; +} + +/* BEGIN __db_create_proc */ +/* + * PUBLIC: void __db_create_proc __P((long, u_int32_t, __db_create_reply *)); + */ +void +__db_create_proc(dbenvcl_id, flags, replyp) + long dbenvcl_id; + u_int32_t flags; + __db_create_reply *replyp; +/* END __db_create_proc */ +{ + DB *dbp; + DB_ENV *dbenv; + ct_entry *dbenv_ctp, *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + dbp_ctp = new_ct_ent(&replyp->status); + if (dbp_ctp == NULL) + return ; + /* + * We actually require env's for databases. The client should + * have caught it, but just in case. + */ + DB_ASSERT(dbenv != NULL); + if ((ret = db_create(&dbp, dbenv, flags)) == 0) { + dbp_ctp->ct_dbp = dbp; + dbp_ctp->ct_type = CT_DB; + dbp_ctp->ct_parent = dbenv_ctp; + dbp_ctp->ct_envparent = dbenv_ctp; + replyp->dbcl_id = dbp_ctp->ct_id; + } else + __dbclear_ctp(dbp_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __db_del_proc */ +/* + * PUBLIC: void __db_del_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, __db_del_reply *)); + */ +void +__db_del_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t flags; + __db_del_reply *replyp; +/* END __db_del_proc */ +{ + DB *dbp; + DBT key; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + memset(&key, 0, sizeof(key)); + + /* Set up key DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + key.flags = keyflags; + key.size = keysize; + key.data = keydata; + + ret = dbp->del(dbp, txnp, &key, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_encrypt_proc */ +/* + * PUBLIC: void __db_encrypt_proc __P((long, char *, u_int32_t, + * PUBLIC: __db_encrypt_reply *)); + */ +void +__db_encrypt_proc(dbpcl_id, passwd, flags, replyp) + long dbpcl_id; + char *passwd; + u_int32_t flags; + __db_encrypt_reply *replyp; +/* END __db_encrypt_proc */ +{ + int ret; + DB * dbp; + ct_entry *dbp_ctp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_encrypt(dbp, passwd, flags); + replyp->status = ret; + return; +} + +/* BEGIN __db_extentsize_proc */ +/* + * PUBLIC: void __db_extentsize_proc __P((long, u_int32_t, + * PUBLIC: __db_extentsize_reply *)); + */ +void +__db_extentsize_proc(dbpcl_id, extentsize, replyp) + long dbpcl_id; + u_int32_t extentsize; + __db_extentsize_reply *replyp; +/* END __db_extentsize_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_q_extentsize(dbp, extentsize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_flags_proc */ +/* + * PUBLIC: void __db_flags_proc __P((long, u_int32_t, __db_flags_reply *)); + */ +void +__db_flags_proc(dbpcl_id, flags, replyp) + long dbpcl_id; + u_int32_t flags; + __db_flags_reply *replyp; +/* END __db_flags_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_flags(dbp, flags); + dbp_ctp->ct_dbdp.setflags |= flags; + + replyp->status = ret; + return; +} + +/* BEGIN __db_get_proc */ +/* + * PUBLIC: void __db_get_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __db_get_reply *, int *)); + */ +void +__db_get_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, datadlen, datadoff, dataulen, + dataflags, datadata, datasize, flags, replyp, freep) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __db_get_reply *replyp; + int * freep; +/* END __db_get_proc */ +{ + DB *dbp; + DBT key, data; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, bulk_alloc, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + bulk_alloc = 0; + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = DB_DBT_MALLOC; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.ulen = keyulen; + key.data = keydata; + + data.dlen = datadlen; + data.doff = datadoff; + data.ulen = dataulen; + /* + * Ignore memory related flags on server. + */ + data.size = datasize; + data.data = datadata; + if (flags & DB_MULTIPLE) { + if (data.data == 0) { + ret = __os_umalloc(dbp->dbenv, + data.ulen, &data.data); + if (ret != 0) + goto err; + bulk_alloc = 1; + } + data.flags |= DB_DBT_USERMEM; + } else + data.flags |= DB_DBT_MALLOC; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + + /* Got all our stuff, now do the get */ + ret = dbp->get(dbp, txnp, &key, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.data == keydata) { + ret = __os_umalloc(dbp->dbenv, + key.size, &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, key.data); + __os_ufree(dbp->dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.data, key.size); + } else + replyp->keydata.keydata_val = key.data; + + replyp->keydata.keydata_len = key.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbp->dbenv, + data.size, &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, key.data); + __os_ufree(dbp->dbenv, data.data); + if (key_alloc) + __os_ufree(dbp->dbenv, + replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbp->dbenv, data.data); + } + replyp->status = ret; + return; +} + +/* BEGIN __db_h_ffactor_proc */ +/* + * PUBLIC: void __db_h_ffactor_proc __P((long, u_int32_t, + * PUBLIC: __db_h_ffactor_reply *)); + */ +void +__db_h_ffactor_proc(dbpcl_id, ffactor, replyp) + long dbpcl_id; + u_int32_t ffactor; + __db_h_ffactor_reply *replyp; +/* END __db_h_ffactor_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_ffactor(dbp, ffactor); + + replyp->status = ret; + return; +} + +/* BEGIN __db_h_nelem_proc */ +/* + * PUBLIC: void __db_h_nelem_proc __P((long, u_int32_t, + * PUBLIC: __db_h_nelem_reply *)); + */ +void +__db_h_nelem_proc(dbpcl_id, nelem, replyp) + long dbpcl_id; + u_int32_t nelem; + __db_h_nelem_reply *replyp; +/* END __db_h_nelem_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_nelem(dbp, nelem); + + replyp->status = ret; + return; +} + +/* BEGIN __db_key_range_proc */ +/* + * PUBLIC: void __db_key_range_proc __P((long, long, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_key_range_reply *)); + */ +void +__db_key_range_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t flags; + __db_key_range_reply *replyp; +/* END __db_key_range_proc */ +{ + DB *dbp; + DBT key; + DB_KEY_RANGE range; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + memset(&key, 0, sizeof(key)); + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + key.size = keysize; + key.data = keydata; + key.flags = keyflags; + + ret = dbp->key_range(dbp, txnp, &key, &range, flags); + + replyp->status = ret; + replyp->less = range.less; + replyp->equal = range.equal; + replyp->greater = range.greater; + return; +} + +/* BEGIN __db_lorder_proc */ +/* + * PUBLIC: void __db_lorder_proc __P((long, u_int32_t, __db_lorder_reply *)); + */ +void +__db_lorder_proc(dbpcl_id, lorder, replyp) + long dbpcl_id; + u_int32_t lorder; + __db_lorder_reply *replyp; +/* END __db_lorder_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_lorder(dbp, lorder); + + replyp->status = ret; + return; +} + +/* BEGIN __db_open_proc */ +/* + * PUBLIC: void __db_open_proc __P((long, long, char *, char *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, __db_open_reply *)); + */ +void +__db_open_proc(dbpcl_id, txnpcl_id, name, + subdb, type, flags, mode, replyp) + long dbpcl_id; + long txnpcl_id; + char *name; + char *subdb; + u_int32_t type; + u_int32_t flags; + u_int32_t mode; + __db_open_reply *replyp; +/* END __db_open_proc */ +{ + DB *dbp; + DB_TXN *txnp; + DBTYPE dbtype; + ct_entry *dbp_ctp, *new_ctp, *txnp_ctp; + int isswapped, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + replyp->dbcl_id = dbpcl_id; + if ((new_ctp = __dbsrv_sharedb(dbp_ctp, name, subdb, type, flags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing db ID %ld\n", new_ctp->ct_id); + replyp->dbcl_id = new_ctp->ct_id; + ret = __db_close_int(dbpcl_id, 0); + goto out; + } + ret = dbp->open(dbp, txnp, name, subdb, (DBTYPE)type, flags, mode); + if (ret == 0) { + (void)dbp->get_type(dbp, &dbtype); + replyp->type = dbtype; + /* XXX + * Tcl needs to peek at dbp->flags for DB_AM_DUP. Send + * this dbp's flags back. + */ + replyp->dbflags = (int) dbp->flags; + /* + * We need to determine the byte order of the database + * and send it back to the client. Determine it by + * the server's native order and the swapped value of + * the DB itself. + */ + (void)dbp->get_byteswapped(dbp, &isswapped); + if (__db_byteorder(NULL, 1234) == 0) { + if (isswapped == 0) + replyp->lorder = 1234; + else + replyp->lorder = 4321; + } else { + if (isswapped == 0) + replyp->lorder = 4321; + else + replyp->lorder = 1234; + } + dbp_ctp->ct_dbdp.type = dbtype; + dbp_ctp->ct_dbdp.dbflags = LF_ISSET(DB_SERVER_DBFLAGS); + if (name == NULL) + dbp_ctp->ct_dbdp.db = NULL; + else if ((ret = __os_strdup(dbp->dbenv, name, + &dbp_ctp->ct_dbdp.db)) != 0) + goto out; + if (subdb == NULL) + dbp_ctp->ct_dbdp.subdb = NULL; + else if ((ret = __os_strdup(dbp->dbenv, subdb, + &dbp_ctp->ct_dbdp.subdb)) != 0) + goto out; + } +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_pagesize_proc */ +/* + * PUBLIC: void __db_pagesize_proc __P((long, u_int32_t, + * PUBLIC: __db_pagesize_reply *)); + */ +void +__db_pagesize_proc(dbpcl_id, pagesize, replyp) + long dbpcl_id; + u_int32_t pagesize; + __db_pagesize_reply *replyp; +/* END __db_pagesize_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_pagesize(dbp, pagesize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_pget_proc */ +/* + * PUBLIC: void __db_pget_proc __P((long, long, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __db_pget_reply *, int *)); + */ +void +__db_pget_proc(dbpcl_id, txnpcl_id, skeydlen, + skeydoff, skeyulen, skeyflags, skeydata, + skeysize, pkeydlen, pkeydoff, pkeyulen, + pkeyflags, pkeydata, pkeysize, datadlen, + datadoff, dataulen, dataflags, datadata, + datasize, flags, replyp, freep) + long dbpcl_id; + long txnpcl_id; + u_int32_t skeydlen; + u_int32_t skeydoff; + u_int32_t skeyulen; + u_int32_t skeyflags; + void *skeydata; + u_int32_t skeysize; + u_int32_t pkeydlen; + u_int32_t pkeydoff; + u_int32_t pkeyulen; + u_int32_t pkeyflags; + void *pkeydata; + u_int32_t pkeysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __db_pget_reply *replyp; + int * freep; +/* END __db_pget_proc */ +{ + DB *dbp; + DBT skey, pkey, data; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + memset(&skey, 0, sizeof(skey)); + memset(&pkey, 0, sizeof(pkey)); + memset(&data, 0, sizeof(data)); + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data DBT */ + skey.flags = DB_DBT_MALLOC; + skey.dlen = skeydlen; + skey.ulen = skeyulen; + skey.doff = skeydoff; + if (skeyflags & DB_DBT_PARTIAL) + skey.flags |= DB_DBT_PARTIAL; + skey.size = skeysize; + skey.data = skeydata; + + pkey.flags = DB_DBT_MALLOC; + pkey.dlen = pkeydlen; + pkey.ulen = pkeyulen; + pkey.doff = pkeydoff; + if (pkeyflags & DB_DBT_PARTIAL) + pkey.flags |= DB_DBT_PARTIAL; + pkey.size = pkeysize; + pkey.data = pkeydata; + + data.flags = DB_DBT_MALLOC; + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the get */ + ret = dbp->pget(dbp, txnp, &skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.data == skeydata) { + ret = __os_umalloc(dbp->dbenv, + skey.size, &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, skey.data); + __os_ufree(dbp->dbenv, pkey.data); + __os_ufree(dbp->dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.data, + skey.size); + } else + replyp->skeydata.skeydata_val = skey.data; + + replyp->skeydata.skeydata_len = skey.size; + + /* + * Primary key + */ + if (pkey.data == pkeydata) { + ret = __os_umalloc(dbp->dbenv, + pkey.size, &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, skey.data); + __os_ufree(dbp->dbenv, pkey.data); + __os_ufree(dbp->dbenv, data.data); + if (key_alloc) + __os_ufree(dbp->dbenv, + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.data, + pkey.size); + } else + replyp->pkeydata.pkeydata_val = pkey.data; + replyp->pkeydata.pkeydata_len = pkey.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbp->dbenv, + data.size, &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, skey.data); + __os_ufree(dbp->dbenv, pkey.data); + __os_ufree(dbp->dbenv, data.data); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbp->dbenv, + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbp->dbenv, + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_put_proc */ +/* + * PUBLIC: void __db_put_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __db_put_reply *, int *)); + */ +void +__db_put_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, datadlen, datadoff, dataulen, + dataflags, datadata, datasize, flags, replyp, freep) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __db_put_reply *replyp; + int * freep; +/* END __db_put_proc */ +{ + DB *dbp; + DBT key, data; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = DB_DBT_MALLOC; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.data = keydata; + + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + data.flags = dataflags; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the put */ + ret = dbp->put(dbp, txnp, &key, &data, flags); + /* + * If the client did a DB_APPEND, set up key in reply. + * Otherwise just status. + */ + if (ret == 0 && (flags == DB_APPEND)) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + if (key.data == keydata) { + ret = __os_umalloc(dbp->dbenv, + key.size, &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, key.data); + goto err; + } + memcpy(replyp->keydata.keydata_val, key.data, key.size); + } else + replyp->keydata.keydata_val = key.data; + + replyp->keydata.keydata_len = key.size; + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_re_delim_proc */ +/* + * PUBLIC: void __db_re_delim_proc __P((long, u_int32_t, + * PUBLIC: __db_re_delim_reply *)); + */ +void +__db_re_delim_proc(dbpcl_id, delim, replyp) + long dbpcl_id; + u_int32_t delim; + __db_re_delim_reply *replyp; +/* END __db_re_delim_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_delim(dbp, delim); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_len_proc */ +/* + * PUBLIC: void __db_re_len_proc __P((long, u_int32_t, __db_re_len_reply *)); + */ +void +__db_re_len_proc(dbpcl_id, len, replyp) + long dbpcl_id; + u_int32_t len; + __db_re_len_reply *replyp; +/* END __db_re_len_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_len(dbp, len); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_pad_proc */ +/* + * PUBLIC: void __db_re_pad_proc __P((long, u_int32_t, __db_re_pad_reply *)); + */ +void +__db_re_pad_proc(dbpcl_id, pad, replyp) + long dbpcl_id; + u_int32_t pad; + __db_re_pad_reply *replyp; +/* END __db_re_pad_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_pad(dbp, pad); + + replyp->status = ret; + return; +} + +/* BEGIN __db_remove_proc */ +/* + * PUBLIC: void __db_remove_proc __P((long, char *, char *, u_int32_t, + * PUBLIC: __db_remove_reply *)); + */ +void +__db_remove_proc(dbpcl_id, name, subdb, + flags, replyp) + long dbpcl_id; + char *name; + char *subdb; + u_int32_t flags; + __db_remove_reply *replyp; +/* END __db_remove_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->remove(dbp, name, subdb, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_rename_proc */ +/* + * PUBLIC: void __db_rename_proc __P((long, char *, char *, char *, u_int32_t, + * PUBLIC: __db_rename_reply *)); + */ +void +__db_rename_proc(dbpcl_id, name, subdb, + newname, flags, replyp) + long dbpcl_id; + char *name; + char *subdb; + char *newname; + u_int32_t flags; + __db_rename_reply *replyp; +/* END __db_rename_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->rename(dbp, name, subdb, newname, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_stat_proc */ +/* + * PUBLIC: void __db_stat_proc __P((long, u_int32_t, __db_stat_reply *, + * PUBLIC: int *)); + */ +void +__db_stat_proc(dbpcl_id, flags, replyp, freep) + long dbpcl_id; + u_int32_t flags; + __db_stat_reply *replyp; + int * freep; +/* END __db_stat_proc */ +{ + DB *dbp; + DBTYPE type; + ct_entry *dbp_ctp; + u_int32_t *q, *p, *retsp; + int i, len, ret; + void *sp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->stat(dbp, &sp, flags); + replyp->status = ret; + if (ret != 0) + return; + /* + * We get here, we have success. Allocate an array so that + * we can use the list generator. Generate the reply, free + * up the space. + */ + /* + * XXX This assumes that all elements of all stat structures + * are u_int32_t fields. They are, currently. + */ + (void)dbp->get_type(dbp, &type); + if (type == DB_HASH) + len = sizeof(DB_HASH_STAT); + else if (type == DB_QUEUE) + len = sizeof(DB_QUEUE_STAT); + else /* BTREE or RECNO are same stats */ + len = sizeof(DB_BTREE_STAT); + replyp->stats.stats_len = len / sizeof(u_int32_t); + + if ((ret = __os_umalloc(dbp->dbenv, len * replyp->stats.stats_len, + &retsp)) != 0) + goto out; + for (i = 0, q = retsp, p = sp; i < len; + i++, q++, p++) + *q = *p; + replyp->stats.stats_val = retsp; + __os_ufree(dbp->dbenv, sp); + if (ret == 0) + *freep = 1; +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_sync_proc */ +/* + * PUBLIC: void __db_sync_proc __P((long, u_int32_t, __db_sync_reply *)); + */ +void +__db_sync_proc(dbpcl_id, flags, replyp) + long dbpcl_id; + u_int32_t flags; + __db_sync_reply *replyp; +/* END __db_sync_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->sync(dbp, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_truncate_proc */ +/* + * PUBLIC: void __db_truncate_proc __P((long, long, u_int32_t, + * PUBLIC: __db_truncate_reply *)); + */ +void +__db_truncate_proc(dbpcl_id, txnpcl_id, + flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t flags; + __db_truncate_reply *replyp; +/* END __db_truncate_proc */ +{ + DB *dbp; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + u_int32_t count; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbp->truncate(dbp, txnp, &count, flags); + replyp->status = ret; + if (ret == 0) + replyp->count = count; + return; +} + +/* BEGIN __db_cursor_proc */ +/* + * PUBLIC: void __db_cursor_proc __P((long, long, u_int32_t, + * PUBLIC: __db_cursor_reply *)); + */ +void +__db_cursor_proc(dbpcl_id, txnpcl_id, + flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t flags; + __db_cursor_reply *replyp; +/* END __db_cursor_proc */ +{ + DB *dbp; + DBC *dbc; + DB_TXN *txnp; + ct_entry *dbc_ctp, *env_ctp, *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + dbc_ctp->ct_activep = txnp_ctp->ct_activep; + } else + txnp = NULL; + + if ((ret = dbp->cursor(dbp, txnp, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = CT_CURSOR; + dbc_ctp->ct_parent = dbp_ctp; + env_ctp = dbp_ctp->ct_envparent; + dbc_ctp->ct_envparent = env_ctp; + __dbsrv_settimeout(dbc_ctp, env_ctp->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else + __dbclear_ctp(dbc_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_join_proc */ +/* + * PUBLIC: void __db_join_proc __P((long, u_int32_t *, u_int32_t, u_int32_t, + * PUBLIC: __db_join_reply *)); + */ +void +__db_join_proc(dbpcl_id, curs, curslen, + flags, replyp) + long dbpcl_id; + u_int32_t * curs; + u_int32_t curslen; + u_int32_t flags; + __db_join_reply *replyp; +/* END __db_join_proc */ +{ + DB *dbp; + DBC **jcurs, **c; + DBC *dbc; + ct_entry *dbc_ctp, *ctp, *dbp_ctp; + size_t size; + u_int32_t *cl, i; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + size = (curslen + 1) * sizeof(DBC *); + if ((ret = __os_calloc(dbp->dbenv, + curslen + 1, sizeof(DBC *), &jcurs)) != 0) { + replyp->status = ret; + __dbclear_ctp(dbc_ctp); + return; + } + /* + * If our curslist has a parent txn, we need to use it too + * for the activity timeout. All cursors must be part of + * the same transaction, so just check the first. + */ + ctp = get_tableent(*curs); + DB_ASSERT(ctp->ct_type == CT_CURSOR); + /* + * If we are using a transaction, set the join activity timer + * to point to the parent transaction. + */ + if (ctp->ct_activep != &ctp->ct_active) + dbc_ctp->ct_activep = ctp->ct_activep; + for (i = 0, cl = curs, c = jcurs; i < curslen; i++, cl++, c++) { + ctp = get_tableent(*cl); + if (ctp == NULL) { + replyp->status = DB_NOSERVER_ID; + goto out; + } + /* + * If we are using a txn, the join cursor points to the + * transaction timeout. If we are not using a transaction, + * then all the curslist cursors must point to the join + * cursor's timeout so that we do not timeout any of the + * curlist cursors while the join cursor is active. + * Change the type of the curslist ctps to CT_JOIN so that + * we know they are part of a join list and we can distinguish + * them and later restore them when the join cursor is closed. + */ + DB_ASSERT(ctp->ct_type == CT_CURSOR); + ctp->ct_type |= CT_JOIN; + ctp->ct_origp = ctp->ct_activep; + /* + * Setting this to the ct_active field of the dbc_ctp is + * really just a way to distinguish which join dbc this + * cursor is part of. The ct_activep of this cursor is + * not used at all during its lifetime as part of a join + * cursor. + */ + ctp->ct_activep = &dbc_ctp->ct_active; + *c = ctp->ct_dbc; + } + *c = NULL; + if ((ret = dbp->join(dbp, jcurs, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = (CT_JOINCUR | CT_CURSOR); + dbc_ctp->ct_parent = dbp_ctp; + dbc_ctp->ct_envparent = dbp_ctp->ct_envparent; + __dbsrv_settimeout(dbc_ctp, dbp_ctp->ct_envparent->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else { + __dbclear_ctp(dbc_ctp); + /* + * If we get an error, undo what we did above to any cursors. + */ + for (cl = curs; *cl != 0; cl++) { + ctp = get_tableent(*cl); + ctp->ct_type = CT_CURSOR; + ctp->ct_activep = ctp->ct_origp; + } + } + + replyp->status = ret; +out: + __os_free(dbp->dbenv, jcurs); + return; +} + +/* BEGIN __dbc_close_proc */ +/* + * PUBLIC: void __dbc_close_proc __P((long, __dbc_close_reply *)); + */ +void +__dbc_close_proc(dbccl_id, replyp) + long dbccl_id; + __dbc_close_reply *replyp; +/* END __dbc_close_proc */ +{ + ct_entry *dbc_ctp; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + replyp->status = __dbc_close_int(dbc_ctp); + return; +} + +/* BEGIN __dbc_count_proc */ +/* + * PUBLIC: void __dbc_count_proc __P((long, u_int32_t, __dbc_count_reply *)); + */ +void +__dbc_count_proc(dbccl_id, flags, replyp) + long dbccl_id; + u_int32_t flags; + __dbc_count_reply *replyp; +/* END __dbc_count_proc */ +{ + DBC *dbc; + ct_entry *dbc_ctp; + db_recno_t num; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + + ret = dbc->c_count(dbc, &num, flags); + replyp->status = ret; + if (ret == 0) + replyp->dupcount = num; + return; +} + +/* BEGIN __dbc_del_proc */ +/* + * PUBLIC: void __dbc_del_proc __P((long, u_int32_t, __dbc_del_reply *)); + */ +void +__dbc_del_proc(dbccl_id, flags, replyp) + long dbccl_id; + u_int32_t flags; + __dbc_del_reply *replyp; +/* END __dbc_del_proc */ +{ + DBC *dbc; + ct_entry *dbc_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + + ret = dbc->c_del(dbc, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_dup_proc */ +/* + * PUBLIC: void __dbc_dup_proc __P((long, u_int32_t, __dbc_dup_reply *)); + */ +void +__dbc_dup_proc(dbccl_id, flags, replyp) + long dbccl_id; + u_int32_t flags; + __dbc_dup_reply *replyp; +/* END __dbc_dup_proc */ +{ + DBC *dbc, *newdbc; + ct_entry *dbc_ctp, *new_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + + new_ctp = new_ct_ent(&replyp->status); + if (new_ctp == NULL) + return; + + if ((ret = dbc->c_dup(dbc, &newdbc, flags)) == 0) { + new_ctp->ct_dbc = newdbc; + new_ctp->ct_type = CT_CURSOR; + new_ctp->ct_parent = dbc_ctp->ct_parent; + new_ctp->ct_envparent = dbc_ctp->ct_envparent; + /* + * If our cursor has a parent txn, we need to use it too. + */ + if (dbc_ctp->ct_activep != &dbc_ctp->ct_active) + new_ctp->ct_activep = dbc_ctp->ct_activep; + __dbsrv_settimeout(new_ctp, dbc_ctp->ct_timeout); + __dbsrv_active(new_ctp); + replyp->dbcidcl_id = new_ctp->ct_id; + } else + __dbclear_ctp(new_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_get_proc */ +/* + * PUBLIC: void __dbc_get_proc __P((long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __dbc_get_reply *, int *)); + */ +void +__dbc_get_proc(dbccl_id, keydlen, keydoff, + keyulen, keyflags, keydata, keysize, + datadlen, datadoff, dataulen, dataflags, + datadata, datasize, flags, replyp, freep) + long dbccl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __dbc_get_reply *replyp; + int * freep; +/* END __dbc_get_proc */ +{ + DBC *dbc; + DBT key, data; + DB_ENV *dbenv; + ct_entry *dbc_ctp; + int key_alloc, bulk_alloc, ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + dbenv = dbc->dbp->dbenv; + + *freep = 0; + bulk_alloc = 0; + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = DB_DBT_MALLOC; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.data = keydata; + + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + data.size = datasize; + data.data = datadata; + if (flags & DB_MULTIPLE || flags & DB_MULTIPLE_KEY) { + if (data.data == 0) { + ret = __os_umalloc(dbenv, data.ulen, &data.data); + if (ret != 0) + goto err; + bulk_alloc = 1; + } + data.flags |= DB_DBT_USERMEM; + } else + data.flags |= DB_DBT_MALLOC; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + + /* Got all our stuff, now do the get */ + ret = dbc->c_get(dbc, &key, &data, flags); + + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.data == keydata) { + ret = __os_umalloc(dbenv, key.size, + &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbenv, key.data); + __os_ufree(dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.data, key.size); + } else + replyp->keydata.keydata_val = key.data; + + replyp->keydata.keydata_len = key.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbenv, data.size, + &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv, key.data); + __os_ufree(dbenv, data.data); + if (key_alloc) + __os_ufree(dbenv, replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbenv, data.data); + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_pget_proc */ +/* + * PUBLIC: void __dbc_pget_proc __P((long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, + * PUBLIC: u_int32_t, __dbc_pget_reply *, int *)); + */ +void +__dbc_pget_proc(dbccl_id, skeydlen, skeydoff, + skeyulen, skeyflags, skeydata, skeysize, + pkeydlen, pkeydoff, pkeyulen, pkeyflags, + pkeydata, pkeysize, datadlen, datadoff, + dataulen, dataflags, datadata, datasize, + flags, replyp, freep) + long dbccl_id; + u_int32_t skeydlen; + u_int32_t skeydoff; + u_int32_t skeyulen; + u_int32_t skeyflags; + void *skeydata; + u_int32_t skeysize; + u_int32_t pkeydlen; + u_int32_t pkeydoff; + u_int32_t pkeyulen; + u_int32_t pkeyflags; + void *pkeydata; + u_int32_t pkeysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __dbc_pget_reply *replyp; + int * freep; +/* END __dbc_pget_proc */ +{ + DBC *dbc; + DBT skey, pkey, data; + DB_ENV *dbenv; + ct_entry *dbc_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + dbenv = dbc->dbp->dbenv; + + *freep = 0; + memset(&skey, 0, sizeof(skey)); + memset(&pkey, 0, sizeof(pkey)); + memset(&data, 0, sizeof(data)); + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data DBT */ + skey.flags = DB_DBT_MALLOC; + skey.dlen = skeydlen; + skey.ulen = skeyulen; + skey.doff = skeydoff; + if (skeyflags & DB_DBT_PARTIAL) + skey.flags |= DB_DBT_PARTIAL; + skey.size = skeysize; + skey.data = skeydata; + + pkey.flags = DB_DBT_MALLOC; + pkey.dlen = pkeydlen; + pkey.ulen = pkeyulen; + pkey.doff = pkeydoff; + if (pkeyflags & DB_DBT_PARTIAL) + pkey.flags |= DB_DBT_PARTIAL; + pkey.size = pkeysize; + pkey.data = pkeydata; + + data.flags = DB_DBT_MALLOC; + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the get */ + ret = dbc->c_pget(dbc, &skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.data == skeydata) { + ret = __os_umalloc(dbenv, + skey.size, &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbenv, skey.data); + __os_ufree(dbenv, pkey.data); + __os_ufree(dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.data, + skey.size); + } else + replyp->skeydata.skeydata_val = skey.data; + replyp->skeydata.skeydata_len = skey.size; + + /* + * Primary key + */ + if (pkey.data == pkeydata) { + ret = __os_umalloc(dbenv, + pkey.size, &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbenv, skey.data); + __os_ufree(dbenv, pkey.data); + __os_ufree(dbenv, data.data); + if (key_alloc) + __os_ufree(dbenv, + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.data, + pkey.size); + } else + replyp->pkeydata.pkeydata_val = pkey.data; + replyp->pkeydata.pkeydata_len = pkey.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbenv, + data.size, &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv, skey.data); + __os_ufree(dbenv, pkey.data); + __os_ufree(dbenv, data.data); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbenv, + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbenv, + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_put_proc */ +/* + * PUBLIC: void __dbc_put_proc __P((long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __dbc_put_reply *, int *)); + */ +void +__dbc_put_proc(dbccl_id, keydlen, keydoff, + keyulen, keyflags, keydata, keysize, + datadlen, datadoff, dataulen, dataflags, + datadata, datasize, flags, replyp, freep) + long dbccl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __dbc_put_reply *replyp; + int * freep; +/* END __dbc_put_proc */ +{ + DB *dbp; + DBC *dbc; + DBT key, data; + ct_entry *dbc_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + dbp = (DB *)dbc_ctp->ct_parent->ct_anyp; + + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = 0; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.data = keydata; + + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + data.flags = dataflags; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the put */ + ret = dbc->c_put(dbc, &key, &data, flags); + + *freep = 0; + if (ret == 0 && (flags == DB_AFTER || flags == DB_BEFORE) && + dbp->type == DB_RECNO) { + /* + * We need to xdr_free whatever we are returning, next time. + */ + replyp->keydata.keydata_val = key.data; + replyp->keydata.keydata_len = key.size; + } else { + replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + } + replyp->status = ret; + return; +} +#endif /* HAVE_RPC */ diff --git a/db/rpc_server/c/db_server_proc.sed b/db/rpc_server/c/db_server_proc.sed new file mode 100644 index 000000000..e11b2c33c --- /dev/null +++ b/db/rpc_server/c/db_server_proc.sed @@ -0,0 +1,772 @@ +/^\/\* BEGIN __env_cachesize_proc/,/^\/\* END __env_cachesize_proc/c\ +/* BEGIN __env_cachesize_proc */\ +/*\ +\ * PUBLIC: void __env_cachesize_proc __P((long, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, __env_cachesize_reply *));\ +\ */\ +void\ +__env_cachesize_proc(dbenvcl_id, gbytes, bytes,\ +\ \ ncache, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t gbytes;\ +\ u_int32_t bytes;\ +\ u_int32_t ncache;\ +\ __env_cachesize_reply *replyp;\ +/* END __env_cachesize_proc */ +/^\/\* BEGIN __env_close_proc/,/^\/\* END __env_close_proc/c\ +/* BEGIN __env_close_proc */\ +/*\ +\ * PUBLIC: void __env_close_proc __P((long, u_int32_t, __env_close_reply *));\ +\ */\ +void\ +__env_close_proc(dbenvcl_id, flags, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t flags;\ +\ __env_close_reply *replyp;\ +/* END __env_close_proc */ +/^\/\* BEGIN __env_create_proc/,/^\/\* END __env_create_proc/c\ +/* BEGIN __env_create_proc */\ +/*\ +\ * PUBLIC: void __env_create_proc __P((u_int32_t, __env_create_reply *));\ +\ */\ +void\ +__env_create_proc(timeout, replyp)\ +\ u_int32_t timeout;\ +\ __env_create_reply *replyp;\ +/* END __env_create_proc */ +/^\/\* BEGIN __env_dbremove_proc/,/^\/\* END __env_dbremove_proc/c\ +/* BEGIN __env_dbremove_proc */\ +/*\ +\ * PUBLIC: void __env_dbremove_proc __P((long, long, char *, char *, u_int32_t,\ +\ * PUBLIC: __env_dbremove_reply *));\ +\ */\ +void\ +__env_dbremove_proc(dbenvcl_id, txnpcl_id, name,\ +\ \ subdb, flags, replyp)\ +\ long dbenvcl_id;\ +\ long txnpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ u_int32_t flags;\ +\ __env_dbremove_reply *replyp;\ +/* END __env_dbremove_proc */ +/^\/\* BEGIN __env_dbrename_proc/,/^\/\* END __env_dbrename_proc/c\ +/* BEGIN __env_dbrename_proc */\ +/*\ +\ * PUBLIC: void __env_dbrename_proc __P((long, long, char *, char *, char *,\ +\ * PUBLIC: u_int32_t, __env_dbrename_reply *));\ +\ */\ +void\ +__env_dbrename_proc(dbenvcl_id, txnpcl_id, name,\ +\ \ subdb, newname, flags, replyp)\ +\ long dbenvcl_id;\ +\ long txnpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ char *newname;\ +\ u_int32_t flags;\ +\ __env_dbrename_reply *replyp;\ +/* END __env_dbrename_proc */ +/^\/\* BEGIN __env_encrypt_proc/,/^\/\* END __env_encrypt_proc/c\ +/* BEGIN __env_encrypt_proc */\ +/*\ +\ * PUBLIC: void __env_encrypt_proc __P((long, char *, u_int32_t,\ +\ * PUBLIC: __env_encrypt_reply *));\ +\ */\ +void\ +__env_encrypt_proc(dbenvcl_id, passwd, flags, replyp)\ +\ long dbenvcl_id;\ +\ char *passwd;\ +\ u_int32_t flags;\ +\ __env_encrypt_reply *replyp;\ +/* END __env_encrypt_proc */ +/^\/\* BEGIN __env_flags_proc/,/^\/\* END __env_flags_proc/c\ +/* BEGIN __env_flags_proc */\ +/*\ +\ * PUBLIC: void __env_flags_proc __P((long, u_int32_t, u_int32_t,\ +\ * PUBLIC: __env_flags_reply *));\ +\ */\ +void\ +__env_flags_proc(dbenvcl_id, flags, onoff, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t flags;\ +\ u_int32_t onoff;\ +\ __env_flags_reply *replyp;\ +/* END __env_flags_proc */ +/^\/\* BEGIN __env_open_proc/,/^\/\* END __env_open_proc/c\ +/* BEGIN __env_open_proc */\ +/*\ +\ * PUBLIC: void __env_open_proc __P((long, char *, u_int32_t, u_int32_t,\ +\ * PUBLIC: __env_open_reply *));\ +\ */\ +void\ +__env_open_proc(dbenvcl_id, home, flags,\ +\ \ mode, replyp)\ +\ long dbenvcl_id;\ +\ char *home;\ +\ u_int32_t flags;\ +\ u_int32_t mode;\ +\ __env_open_reply *replyp;\ +/* END __env_open_proc */ +/^\/\* BEGIN __env_remove_proc/,/^\/\* END __env_remove_proc/c\ +/* BEGIN __env_remove_proc */\ +/*\ +\ * PUBLIC: void __env_remove_proc __P((long, char *, u_int32_t,\ +\ * PUBLIC: __env_remove_reply *));\ +\ */\ +void\ +__env_remove_proc(dbenvcl_id, home, flags, replyp)\ +\ long dbenvcl_id;\ +\ char *home;\ +\ u_int32_t flags;\ +\ __env_remove_reply *replyp;\ +/* END __env_remove_proc */ +/^\/\* BEGIN __txn_abort_proc/,/^\/\* END __txn_abort_proc/c\ +/* BEGIN __txn_abort_proc */\ +/*\ +\ * PUBLIC: void __txn_abort_proc __P((long, __txn_abort_reply *));\ +\ */\ +void\ +__txn_abort_proc(txnpcl_id, replyp)\ +\ long txnpcl_id;\ +\ __txn_abort_reply *replyp;\ +/* END __txn_abort_proc */ +/^\/\* BEGIN __txn_begin_proc/,/^\/\* END __txn_begin_proc/c\ +/* BEGIN __txn_begin_proc */\ +/*\ +\ * PUBLIC: void __txn_begin_proc __P((long, long, u_int32_t,\ +\ * PUBLIC: __txn_begin_reply *));\ +\ */\ +void\ +__txn_begin_proc(dbenvcl_id, parentcl_id,\ +\ \ flags, replyp)\ +\ long dbenvcl_id;\ +\ long parentcl_id;\ +\ u_int32_t flags;\ +\ __txn_begin_reply *replyp;\ +/* END __txn_begin_proc */ +/^\/\* BEGIN __txn_commit_proc/,/^\/\* END __txn_commit_proc/c\ +/* BEGIN __txn_commit_proc */\ +/*\ +\ * PUBLIC: void __txn_commit_proc __P((long, u_int32_t,\ +\ * PUBLIC: __txn_commit_reply *));\ +\ */\ +void\ +__txn_commit_proc(txnpcl_id, flags, replyp)\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __txn_commit_reply *replyp;\ +/* END __txn_commit_proc */ +/^\/\* BEGIN __txn_discard_proc/,/^\/\* END __txn_discard_proc/c\ +/* BEGIN __txn_discard_proc */\ +/*\ +\ * PUBLIC: void __txn_discard_proc __P((long, u_int32_t,\ +\ * PUBLIC: __txn_discard_reply *));\ +\ */\ +void\ +__txn_discard_proc(txnpcl_id, flags, replyp)\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __txn_discard_reply *replyp;\ +/* END __txn_discard_proc */ +/^\/\* BEGIN __txn_prepare_proc/,/^\/\* END __txn_prepare_proc/c\ +/* BEGIN __txn_prepare_proc */\ +/*\ +\ * PUBLIC: void __txn_prepare_proc __P((long, u_int8_t *,\ +\ * PUBLIC: __txn_prepare_reply *));\ +\ */\ +void\ +__txn_prepare_proc(txnpcl_id, gid, replyp)\ +\ long txnpcl_id;\ +\ u_int8_t *gid;\ +\ __txn_prepare_reply *replyp;\ +/* END __txn_prepare_proc */ +/^\/\* BEGIN __txn_recover_proc/,/^\/\* END __txn_recover_proc/c\ +/* BEGIN __txn_recover_proc */\ +/*\ +\ * PUBLIC: void __txn_recover_proc __P((long, u_int32_t, u_int32_t,\ +\ * PUBLIC: __txn_recover_reply *, int *));\ +\ */\ +void\ +__txn_recover_proc(dbenvcl_id, count,\ +\ \ flags, replyp, freep)\ +\ long dbenvcl_id;\ +\ u_int32_t count;\ +\ u_int32_t flags;\ +\ __txn_recover_reply *replyp;\ +\ int * freep;\ +/* END __txn_recover_proc */ +/^\/\* BEGIN __db_associate_proc/,/^\/\* END __db_associate_proc/c\ +/* BEGIN __db_associate_proc */\ +/*\ +\ * PUBLIC: void __db_associate_proc __P((long, long, long, u_int32_t,\ +\ * PUBLIC: __db_associate_reply *));\ +\ */\ +void\ +__db_associate_proc(dbpcl_id, txnpcl_id, sdbpcl_id,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ long sdbpcl_id;\ +\ u_int32_t flags;\ +\ __db_associate_reply *replyp;\ +/* END __db_associate_proc */ +/^\/\* BEGIN __db_bt_maxkey_proc/,/^\/\* END __db_bt_maxkey_proc/c\ +/* BEGIN __db_bt_maxkey_proc */\ +/*\ +\ * PUBLIC: void __db_bt_maxkey_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_bt_maxkey_reply *));\ +\ */\ +void\ +__db_bt_maxkey_proc(dbpcl_id, maxkey, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t maxkey;\ +\ __db_bt_maxkey_reply *replyp;\ +/* END __db_bt_maxkey_proc */ +/^\/\* BEGIN __db_bt_minkey_proc/,/^\/\* END __db_bt_minkey_proc/c\ +/* BEGIN __db_bt_minkey_proc */\ +/*\ +\ * PUBLIC: void __db_bt_minkey_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_bt_minkey_reply *));\ +\ */\ +void\ +__db_bt_minkey_proc(dbpcl_id, minkey, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t minkey;\ +\ __db_bt_minkey_reply *replyp;\ +/* END __db_bt_minkey_proc */ +/^\/\* BEGIN __db_close_proc/,/^\/\* END __db_close_proc/c\ +/* BEGIN __db_close_proc */\ +/*\ +\ * PUBLIC: void __db_close_proc __P((long, u_int32_t, __db_close_reply *));\ +\ */\ +void\ +__db_close_proc(dbpcl_id, flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_close_reply *replyp;\ +/* END __db_close_proc */ +/^\/\* BEGIN __db_create_proc/,/^\/\* END __db_create_proc/c\ +/* BEGIN __db_create_proc */\ +/*\ +\ * PUBLIC: void __db_create_proc __P((long, u_int32_t, __db_create_reply *));\ +\ */\ +void\ +__db_create_proc(dbenvcl_id, flags, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t flags;\ +\ __db_create_reply *replyp;\ +/* END __db_create_proc */ +/^\/\* BEGIN __db_del_proc/,/^\/\* END __db_del_proc/c\ +/* BEGIN __db_del_proc */\ +/*\ +\ * PUBLIC: void __db_del_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, __db_del_reply *));\ +\ */\ +void\ +__db_del_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t flags;\ +\ __db_del_reply *replyp;\ +/* END __db_del_proc */ +/^\/\* BEGIN __db_encrypt_proc/,/^\/\* END __db_encrypt_proc/c\ +/* BEGIN __db_encrypt_proc */\ +/*\ +\ * PUBLIC: void __db_encrypt_proc __P((long, char *, u_int32_t,\ +\ * PUBLIC: __db_encrypt_reply *));\ +\ */\ +void\ +__db_encrypt_proc(dbpcl_id, passwd, flags, replyp)\ +\ long dbpcl_id;\ +\ char *passwd;\ +\ u_int32_t flags;\ +\ __db_encrypt_reply *replyp;\ +/* END __db_encrypt_proc */ +/^\/\* BEGIN __db_extentsize_proc/,/^\/\* END __db_extentsize_proc/c\ +/* BEGIN __db_extentsize_proc */\ +/*\ +\ * PUBLIC: void __db_extentsize_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_extentsize_reply *));\ +\ */\ +void\ +__db_extentsize_proc(dbpcl_id, extentsize, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t extentsize;\ +\ __db_extentsize_reply *replyp;\ +/* END __db_extentsize_proc */ +/^\/\* BEGIN __db_flags_proc/,/^\/\* END __db_flags_proc/c\ +/* BEGIN __db_flags_proc */\ +/*\ +\ * PUBLIC: void __db_flags_proc __P((long, u_int32_t, __db_flags_reply *));\ +\ */\ +void\ +__db_flags_proc(dbpcl_id, flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_flags_reply *replyp;\ +/* END __db_flags_proc */ +/^\/\* BEGIN __db_get_proc/,/^\/\* END __db_get_proc/c\ +/* BEGIN __db_get_proc */\ +/*\ +\ * PUBLIC: void __db_get_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_get_reply *, int *));\ +\ */\ +void\ +__db_get_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, datadlen, datadoff, dataulen,\ +\ \ dataflags, datadata, datasize, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __db_get_reply *replyp;\ +\ int * freep;\ +/* END __db_get_proc */ +/^\/\* BEGIN __db_h_ffactor_proc/,/^\/\* END __db_h_ffactor_proc/c\ +/* BEGIN __db_h_ffactor_proc */\ +/*\ +\ * PUBLIC: void __db_h_ffactor_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_h_ffactor_reply *));\ +\ */\ +void\ +__db_h_ffactor_proc(dbpcl_id, ffactor, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t ffactor;\ +\ __db_h_ffactor_reply *replyp;\ +/* END __db_h_ffactor_proc */ +/^\/\* BEGIN __db_h_nelem_proc/,/^\/\* END __db_h_nelem_proc/c\ +/* BEGIN __db_h_nelem_proc */\ +/*\ +\ * PUBLIC: void __db_h_nelem_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_h_nelem_reply *));\ +\ */\ +void\ +__db_h_nelem_proc(dbpcl_id, nelem, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t nelem;\ +\ __db_h_nelem_reply *replyp;\ +/* END __db_h_nelem_proc */ +/^\/\* BEGIN __db_key_range_proc/,/^\/\* END __db_key_range_proc/c\ +/* BEGIN __db_key_range_proc */\ +/*\ +\ * PUBLIC: void __db_key_range_proc __P((long, long, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_key_range_reply *));\ +\ */\ +void\ +__db_key_range_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t flags;\ +\ __db_key_range_reply *replyp;\ +/* END __db_key_range_proc */ +/^\/\* BEGIN __db_lorder_proc/,/^\/\* END __db_lorder_proc/c\ +/* BEGIN __db_lorder_proc */\ +/*\ +\ * PUBLIC: void __db_lorder_proc __P((long, u_int32_t, __db_lorder_reply *));\ +\ */\ +void\ +__db_lorder_proc(dbpcl_id, lorder, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t lorder;\ +\ __db_lorder_reply *replyp;\ +/* END __db_lorder_proc */ +/^\/\* BEGIN __db_open_proc/,/^\/\* END __db_open_proc/c\ +/* BEGIN __db_open_proc */\ +/*\ +\ * PUBLIC: void __db_open_proc __P((long, long, char *, char *, u_int32_t,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_open_reply *));\ +\ */\ +void\ +__db_open_proc(dbpcl_id, txnpcl_id, name,\ +\ \ subdb, type, flags, mode, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ u_int32_t type;\ +\ u_int32_t flags;\ +\ u_int32_t mode;\ +\ __db_open_reply *replyp;\ +/* END __db_open_proc */ +/^\/\* BEGIN __db_pagesize_proc/,/^\/\* END __db_pagesize_proc/c\ +/* BEGIN __db_pagesize_proc */\ +/*\ +\ * PUBLIC: void __db_pagesize_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_pagesize_reply *));\ +\ */\ +void\ +__db_pagesize_proc(dbpcl_id, pagesize, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t pagesize;\ +\ __db_pagesize_reply *replyp;\ +/* END __db_pagesize_proc */ +/^\/\* BEGIN __db_pget_proc/,/^\/\* END __db_pget_proc/c\ +/* BEGIN __db_pget_proc */\ +/*\ +\ * PUBLIC: void __db_pget_proc __P((long, long, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_pget_reply *, int *));\ +\ */\ +void\ +__db_pget_proc(dbpcl_id, txnpcl_id, skeydlen,\ +\ \ skeydoff, skeyulen, skeyflags, skeydata,\ +\ \ skeysize, pkeydlen, pkeydoff, pkeyulen,\ +\ \ pkeyflags, pkeydata, pkeysize, datadlen,\ +\ \ datadoff, dataulen, dataflags, datadata,\ +\ \ datasize, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t skeydlen;\ +\ u_int32_t skeydoff;\ +\ u_int32_t skeyulen;\ +\ u_int32_t skeyflags;\ +\ void *skeydata;\ +\ u_int32_t skeysize;\ +\ u_int32_t pkeydlen;\ +\ u_int32_t pkeydoff;\ +\ u_int32_t pkeyulen;\ +\ u_int32_t pkeyflags;\ +\ void *pkeydata;\ +\ u_int32_t pkeysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __db_pget_reply *replyp;\ +\ int * freep;\ +/* END __db_pget_proc */ +/^\/\* BEGIN __db_put_proc/,/^\/\* END __db_put_proc/c\ +/* BEGIN __db_put_proc */\ +/*\ +\ * PUBLIC: void __db_put_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_put_reply *, int *));\ +\ */\ +void\ +__db_put_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, datadlen, datadoff, dataulen,\ +\ \ dataflags, datadata, datasize, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __db_put_reply *replyp;\ +\ int * freep;\ +/* END __db_put_proc */ +/^\/\* BEGIN __db_re_delim_proc/,/^\/\* END __db_re_delim_proc/c\ +/* BEGIN __db_re_delim_proc */\ +/*\ +\ * PUBLIC: void __db_re_delim_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_re_delim_reply *));\ +\ */\ +void\ +__db_re_delim_proc(dbpcl_id, delim, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t delim;\ +\ __db_re_delim_reply *replyp;\ +/* END __db_re_delim_proc */ +/^\/\* BEGIN __db_re_len_proc/,/^\/\* END __db_re_len_proc/c\ +/* BEGIN __db_re_len_proc */\ +/*\ +\ * PUBLIC: void __db_re_len_proc __P((long, u_int32_t, __db_re_len_reply *));\ +\ */\ +void\ +__db_re_len_proc(dbpcl_id, len, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t len;\ +\ __db_re_len_reply *replyp;\ +/* END __db_re_len_proc */ +/^\/\* BEGIN __db_re_pad_proc/,/^\/\* END __db_re_pad_proc/c\ +/* BEGIN __db_re_pad_proc */\ +/*\ +\ * PUBLIC: void __db_re_pad_proc __P((long, u_int32_t, __db_re_pad_reply *));\ +\ */\ +void\ +__db_re_pad_proc(dbpcl_id, pad, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t pad;\ +\ __db_re_pad_reply *replyp;\ +/* END __db_re_pad_proc */ +/^\/\* BEGIN __db_remove_proc/,/^\/\* END __db_remove_proc/c\ +/* BEGIN __db_remove_proc */\ +/*\ +\ * PUBLIC: void __db_remove_proc __P((long, char *, char *, u_int32_t,\ +\ * PUBLIC: __db_remove_reply *));\ +\ */\ +void\ +__db_remove_proc(dbpcl_id, name, subdb,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ u_int32_t flags;\ +\ __db_remove_reply *replyp;\ +/* END __db_remove_proc */ +/^\/\* BEGIN __db_rename_proc/,/^\/\* END __db_rename_proc/c\ +/* BEGIN __db_rename_proc */\ +/*\ +\ * PUBLIC: void __db_rename_proc __P((long, char *, char *, char *, u_int32_t,\ +\ * PUBLIC: __db_rename_reply *));\ +\ */\ +void\ +__db_rename_proc(dbpcl_id, name, subdb,\ +\ \ newname, flags, replyp)\ +\ long dbpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ char *newname;\ +\ u_int32_t flags;\ +\ __db_rename_reply *replyp;\ +/* END __db_rename_proc */ +/^\/\* BEGIN __db_stat_proc/,/^\/\* END __db_stat_proc/c\ +/* BEGIN __db_stat_proc */\ +/*\ +\ * PUBLIC: void __db_stat_proc __P((long, u_int32_t, __db_stat_reply *,\ +\ * PUBLIC: int *));\ +\ */\ +void\ +__db_stat_proc(dbpcl_id, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_stat_reply *replyp;\ +\ int * freep;\ +/* END __db_stat_proc */ +/^\/\* BEGIN __db_sync_proc/,/^\/\* END __db_sync_proc/c\ +/* BEGIN __db_sync_proc */\ +/*\ +\ * PUBLIC: void __db_sync_proc __P((long, u_int32_t, __db_sync_reply *));\ +\ */\ +void\ +__db_sync_proc(dbpcl_id, flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_sync_reply *replyp;\ +/* END __db_sync_proc */ +/^\/\* BEGIN __db_truncate_proc/,/^\/\* END __db_truncate_proc/c\ +/* BEGIN __db_truncate_proc */\ +/*\ +\ * PUBLIC: void __db_truncate_proc __P((long, long, u_int32_t,\ +\ * PUBLIC: __db_truncate_reply *));\ +\ */\ +void\ +__db_truncate_proc(dbpcl_id, txnpcl_id,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __db_truncate_reply *replyp;\ +/* END __db_truncate_proc */ +/^\/\* BEGIN __db_cursor_proc/,/^\/\* END __db_cursor_proc/c\ +/* BEGIN __db_cursor_proc */\ +/*\ +\ * PUBLIC: void __db_cursor_proc __P((long, long, u_int32_t,\ +\ * PUBLIC: __db_cursor_reply *));\ +\ */\ +void\ +__db_cursor_proc(dbpcl_id, txnpcl_id,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __db_cursor_reply *replyp;\ +/* END __db_cursor_proc */ +/^\/\* BEGIN __db_join_proc/,/^\/\* END __db_join_proc/c\ +/* BEGIN __db_join_proc */\ +/*\ +\ * PUBLIC: void __db_join_proc __P((long, u_int32_t *, u_int32_t, u_int32_t,\ +\ * PUBLIC: __db_join_reply *));\ +\ */\ +void\ +__db_join_proc(dbpcl_id, curs, curslen,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t * curs;\ +\ u_int32_t curslen;\ +\ u_int32_t flags;\ +\ __db_join_reply *replyp;\ +/* END __db_join_proc */ +/^\/\* BEGIN __dbc_close_proc/,/^\/\* END __dbc_close_proc/c\ +/* BEGIN __dbc_close_proc */\ +/*\ +\ * PUBLIC: void __dbc_close_proc __P((long, __dbc_close_reply *));\ +\ */\ +void\ +__dbc_close_proc(dbccl_id, replyp)\ +\ long dbccl_id;\ +\ __dbc_close_reply *replyp;\ +/* END __dbc_close_proc */ +/^\/\* BEGIN __dbc_count_proc/,/^\/\* END __dbc_count_proc/c\ +/* BEGIN __dbc_count_proc */\ +/*\ +\ * PUBLIC: void __dbc_count_proc __P((long, u_int32_t, __dbc_count_reply *));\ +\ */\ +void\ +__dbc_count_proc(dbccl_id, flags, replyp)\ +\ long dbccl_id;\ +\ u_int32_t flags;\ +\ __dbc_count_reply *replyp;\ +/* END __dbc_count_proc */ +/^\/\* BEGIN __dbc_del_proc/,/^\/\* END __dbc_del_proc/c\ +/* BEGIN __dbc_del_proc */\ +/*\ +\ * PUBLIC: void __dbc_del_proc __P((long, u_int32_t, __dbc_del_reply *));\ +\ */\ +void\ +__dbc_del_proc(dbccl_id, flags, replyp)\ +\ long dbccl_id;\ +\ u_int32_t flags;\ +\ __dbc_del_reply *replyp;\ +/* END __dbc_del_proc */ +/^\/\* BEGIN __dbc_dup_proc/,/^\/\* END __dbc_dup_proc/c\ +/* BEGIN __dbc_dup_proc */\ +/*\ +\ * PUBLIC: void __dbc_dup_proc __P((long, u_int32_t, __dbc_dup_reply *));\ +\ */\ +void\ +__dbc_dup_proc(dbccl_id, flags, replyp)\ +\ long dbccl_id;\ +\ u_int32_t flags;\ +\ __dbc_dup_reply *replyp;\ +/* END __dbc_dup_proc */ +/^\/\* BEGIN __dbc_get_proc/,/^\/\* END __dbc_get_proc/c\ +/* BEGIN __dbc_get_proc */\ +/*\ +\ * PUBLIC: void __dbc_get_proc __P((long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __dbc_get_reply *, int *));\ +\ */\ +void\ +__dbc_get_proc(dbccl_id, keydlen, keydoff,\ +\ \ keyulen, keyflags, keydata, keysize,\ +\ \ datadlen, datadoff, dataulen, dataflags,\ +\ \ datadata, datasize, flags, replyp, freep)\ +\ long dbccl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __dbc_get_reply *replyp;\ +\ int * freep;\ +/* END __dbc_get_proc */ +/^\/\* BEGIN __dbc_pget_proc/,/^\/\* END __dbc_pget_proc/c\ +/* BEGIN __dbc_pget_proc */\ +/*\ +\ * PUBLIC: void __dbc_pget_proc __P((long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t,\ +\ * PUBLIC: u_int32_t, __dbc_pget_reply *, int *));\ +\ */\ +void\ +__dbc_pget_proc(dbccl_id, skeydlen, skeydoff,\ +\ \ skeyulen, skeyflags, skeydata, skeysize,\ +\ \ pkeydlen, pkeydoff, pkeyulen, pkeyflags,\ +\ \ pkeydata, pkeysize, datadlen, datadoff,\ +\ \ dataulen, dataflags, datadata, datasize,\ +\ \ flags, replyp, freep)\ +\ long dbccl_id;\ +\ u_int32_t skeydlen;\ +\ u_int32_t skeydoff;\ +\ u_int32_t skeyulen;\ +\ u_int32_t skeyflags;\ +\ void *skeydata;\ +\ u_int32_t skeysize;\ +\ u_int32_t pkeydlen;\ +\ u_int32_t pkeydoff;\ +\ u_int32_t pkeyulen;\ +\ u_int32_t pkeyflags;\ +\ void *pkeydata;\ +\ u_int32_t pkeysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __dbc_pget_reply *replyp;\ +\ int * freep;\ +/* END __dbc_pget_proc */ +/^\/\* BEGIN __dbc_put_proc/,/^\/\* END __dbc_put_proc/c\ +/* BEGIN __dbc_put_proc */\ +/*\ +\ * PUBLIC: void __dbc_put_proc __P((long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __dbc_put_reply *, int *));\ +\ */\ +void\ +__dbc_put_proc(dbccl_id, keydlen, keydoff,\ +\ \ keyulen, keyflags, keydata, keysize,\ +\ \ datadlen, datadoff, dataulen, dataflags,\ +\ \ datadata, datasize, flags, replyp, freep)\ +\ long dbccl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __dbc_put_reply *replyp;\ +\ int * freep;\ +/* END __dbc_put_proc */ diff --git a/db/rpc_server/c/db_server_svc.c b/db/rpc_server/c/db_server_svc.c new file mode 100644 index 000000000..96dd959ec --- /dev/null +++ b/db/rpc_server/c/db_server_svc.c @@ -0,0 +1,435 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <rpc/rpc.h> +#include <rpc/pmap_clnt.h> +#include <stdio.h> +#include <stdlib.h> /* getenv, exit */ +#include <memory.h> +#include <sys/socket.h> +#include <netinet/in.h> +#endif + +#include "db_int.h" +#include "dbinc_auto/db_server.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" + +#ifdef DEBUG +#define RPC_SVC_FG +#endif + +static void +db_rpc_serverprog_4001(rqstp, transp) + struct svc_req *rqstp; + register SVCXPRT *transp; +{ + union { + __env_cachesize_msg __db_env_cachesize_4001_arg; + __env_close_msg __db_env_close_4001_arg; + __env_create_msg __db_env_create_4001_arg; + __env_dbremove_msg __db_env_dbremove_4001_arg; + __env_dbrename_msg __db_env_dbrename_4001_arg; + __env_encrypt_msg __db_env_encrypt_4001_arg; + __env_flags_msg __db_env_flags_4001_arg; + __env_open_msg __db_env_open_4001_arg; + __env_remove_msg __db_env_remove_4001_arg; + __txn_abort_msg __db_txn_abort_4001_arg; + __txn_begin_msg __db_txn_begin_4001_arg; + __txn_commit_msg __db_txn_commit_4001_arg; + __txn_discard_msg __db_txn_discard_4001_arg; + __txn_prepare_msg __db_txn_prepare_4001_arg; + __txn_recover_msg __db_txn_recover_4001_arg; + __db_associate_msg __db_db_associate_4001_arg; + __db_bt_maxkey_msg __db_db_bt_maxkey_4001_arg; + __db_bt_minkey_msg __db_db_bt_minkey_4001_arg; + __db_close_msg __db_db_close_4001_arg; + __db_create_msg __db_db_create_4001_arg; + __db_del_msg __db_db_del_4001_arg; + __db_encrypt_msg __db_db_encrypt_4001_arg; + __db_extentsize_msg __db_db_extentsize_4001_arg; + __db_flags_msg __db_db_flags_4001_arg; + __db_get_msg __db_db_get_4001_arg; + __db_h_ffactor_msg __db_db_h_ffactor_4001_arg; + __db_h_nelem_msg __db_db_h_nelem_4001_arg; + __db_key_range_msg __db_db_key_range_4001_arg; + __db_lorder_msg __db_db_lorder_4001_arg; + __db_open_msg __db_db_open_4001_arg; + __db_pagesize_msg __db_db_pagesize_4001_arg; + __db_pget_msg __db_db_pget_4001_arg; + __db_put_msg __db_db_put_4001_arg; + __db_re_delim_msg __db_db_re_delim_4001_arg; + __db_re_len_msg __db_db_re_len_4001_arg; + __db_re_pad_msg __db_db_re_pad_4001_arg; + __db_remove_msg __db_db_remove_4001_arg; + __db_rename_msg __db_db_rename_4001_arg; + __db_stat_msg __db_db_stat_4001_arg; + __db_sync_msg __db_db_sync_4001_arg; + __db_truncate_msg __db_db_truncate_4001_arg; + __db_cursor_msg __db_db_cursor_4001_arg; + __db_join_msg __db_db_join_4001_arg; + __dbc_close_msg __db_dbc_close_4001_arg; + __dbc_count_msg __db_dbc_count_4001_arg; + __dbc_del_msg __db_dbc_del_4001_arg; + __dbc_dup_msg __db_dbc_dup_4001_arg; + __dbc_get_msg __db_dbc_get_4001_arg; + __dbc_pget_msg __db_dbc_pget_4001_arg; + __dbc_put_msg __db_dbc_put_4001_arg; + } argument; + char *result; + bool_t (*xdr_argument)(), (*xdr_result)(); + char *(*local)(); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply(transp, (xdrproc_t)xdr_void, + (char *)NULL); + return; + + case __DB_env_cachesize: + xdr_argument = xdr___env_cachesize_msg; + xdr_result = xdr___env_cachesize_reply; + local = (char *(*)()) __db_env_cachesize_4001; + break; + + case __DB_env_close: + xdr_argument = xdr___env_close_msg; + xdr_result = xdr___env_close_reply; + local = (char *(*)()) __db_env_close_4001; + break; + + case __DB_env_create: + xdr_argument = xdr___env_create_msg; + xdr_result = xdr___env_create_reply; + local = (char *(*)()) __db_env_create_4001; + break; + + case __DB_env_dbremove: + xdr_argument = xdr___env_dbremove_msg; + xdr_result = xdr___env_dbremove_reply; + local = (char *(*)()) __db_env_dbremove_4001; + break; + + case __DB_env_dbrename: + xdr_argument = xdr___env_dbrename_msg; + xdr_result = xdr___env_dbrename_reply; + local = (char *(*)()) __db_env_dbrename_4001; + break; + + case __DB_env_encrypt: + xdr_argument = xdr___env_encrypt_msg; + xdr_result = xdr___env_encrypt_reply; + local = (char *(*)()) __db_env_encrypt_4001; + break; + + case __DB_env_flags: + xdr_argument = xdr___env_flags_msg; + xdr_result = xdr___env_flags_reply; + local = (char *(*)()) __db_env_flags_4001; + break; + + case __DB_env_open: + xdr_argument = xdr___env_open_msg; + xdr_result = xdr___env_open_reply; + local = (char *(*)()) __db_env_open_4001; + break; + + case __DB_env_remove: + xdr_argument = xdr___env_remove_msg; + xdr_result = xdr___env_remove_reply; + local = (char *(*)()) __db_env_remove_4001; + break; + + case __DB_txn_abort: + xdr_argument = xdr___txn_abort_msg; + xdr_result = xdr___txn_abort_reply; + local = (char *(*)()) __db_txn_abort_4001; + break; + + case __DB_txn_begin: + xdr_argument = xdr___txn_begin_msg; + xdr_result = xdr___txn_begin_reply; + local = (char *(*)()) __db_txn_begin_4001; + break; + + case __DB_txn_commit: + xdr_argument = xdr___txn_commit_msg; + xdr_result = xdr___txn_commit_reply; + local = (char *(*)()) __db_txn_commit_4001; + break; + + case __DB_txn_discard: + xdr_argument = xdr___txn_discard_msg; + xdr_result = xdr___txn_discard_reply; + local = (char *(*)()) __db_txn_discard_4001; + break; + + case __DB_txn_prepare: + xdr_argument = xdr___txn_prepare_msg; + xdr_result = xdr___txn_prepare_reply; + local = (char *(*)()) __db_txn_prepare_4001; + break; + + case __DB_txn_recover: + xdr_argument = xdr___txn_recover_msg; + xdr_result = xdr___txn_recover_reply; + local = (char *(*)()) __db_txn_recover_4001; + break; + + case __DB_db_associate: + xdr_argument = xdr___db_associate_msg; + xdr_result = xdr___db_associate_reply; + local = (char *(*)()) __db_db_associate_4001; + break; + + case __DB_db_bt_maxkey: + xdr_argument = xdr___db_bt_maxkey_msg; + xdr_result = xdr___db_bt_maxkey_reply; + local = (char *(*)()) __db_db_bt_maxkey_4001; + break; + + case __DB_db_bt_minkey: + xdr_argument = xdr___db_bt_minkey_msg; + xdr_result = xdr___db_bt_minkey_reply; + local = (char *(*)()) __db_db_bt_minkey_4001; + break; + + case __DB_db_close: + xdr_argument = xdr___db_close_msg; + xdr_result = xdr___db_close_reply; + local = (char *(*)()) __db_db_close_4001; + break; + + case __DB_db_create: + xdr_argument = xdr___db_create_msg; + xdr_result = xdr___db_create_reply; + local = (char *(*)()) __db_db_create_4001; + break; + + case __DB_db_del: + xdr_argument = xdr___db_del_msg; + xdr_result = xdr___db_del_reply; + local = (char *(*)()) __db_db_del_4001; + break; + + case __DB_db_encrypt: + xdr_argument = xdr___db_encrypt_msg; + xdr_result = xdr___db_encrypt_reply; + local = (char *(*)()) __db_db_encrypt_4001; + break; + + case __DB_db_extentsize: + xdr_argument = xdr___db_extentsize_msg; + xdr_result = xdr___db_extentsize_reply; + local = (char *(*)()) __db_db_extentsize_4001; + break; + + case __DB_db_flags: + xdr_argument = xdr___db_flags_msg; + xdr_result = xdr___db_flags_reply; + local = (char *(*)()) __db_db_flags_4001; + break; + + case __DB_db_get: + xdr_argument = xdr___db_get_msg; + xdr_result = xdr___db_get_reply; + local = (char *(*)()) __db_db_get_4001; + break; + + case __DB_db_h_ffactor: + xdr_argument = xdr___db_h_ffactor_msg; + xdr_result = xdr___db_h_ffactor_reply; + local = (char *(*)()) __db_db_h_ffactor_4001; + break; + + case __DB_db_h_nelem: + xdr_argument = xdr___db_h_nelem_msg; + xdr_result = xdr___db_h_nelem_reply; + local = (char *(*)()) __db_db_h_nelem_4001; + break; + + case __DB_db_key_range: + xdr_argument = xdr___db_key_range_msg; + xdr_result = xdr___db_key_range_reply; + local = (char *(*)()) __db_db_key_range_4001; + break; + + case __DB_db_lorder: + xdr_argument = xdr___db_lorder_msg; + xdr_result = xdr___db_lorder_reply; + local = (char *(*)()) __db_db_lorder_4001; + break; + + case __DB_db_open: + xdr_argument = xdr___db_open_msg; + xdr_result = xdr___db_open_reply; + local = (char *(*)()) __db_db_open_4001; + break; + + case __DB_db_pagesize: + xdr_argument = xdr___db_pagesize_msg; + xdr_result = xdr___db_pagesize_reply; + local = (char *(*)()) __db_db_pagesize_4001; + break; + + case __DB_db_pget: + xdr_argument = xdr___db_pget_msg; + xdr_result = xdr___db_pget_reply; + local = (char *(*)()) __db_db_pget_4001; + break; + + case __DB_db_put: + xdr_argument = xdr___db_put_msg; + xdr_result = xdr___db_put_reply; + local = (char *(*)()) __db_db_put_4001; + break; + + case __DB_db_re_delim: + xdr_argument = xdr___db_re_delim_msg; + xdr_result = xdr___db_re_delim_reply; + local = (char *(*)()) __db_db_re_delim_4001; + break; + + case __DB_db_re_len: + xdr_argument = xdr___db_re_len_msg; + xdr_result = xdr___db_re_len_reply; + local = (char *(*)()) __db_db_re_len_4001; + break; + + case __DB_db_re_pad: + xdr_argument = xdr___db_re_pad_msg; + xdr_result = xdr___db_re_pad_reply; + local = (char *(*)()) __db_db_re_pad_4001; + break; + + case __DB_db_remove: + xdr_argument = xdr___db_remove_msg; + xdr_result = xdr___db_remove_reply; + local = (char *(*)()) __db_db_remove_4001; + break; + + case __DB_db_rename: + xdr_argument = xdr___db_rename_msg; + xdr_result = xdr___db_rename_reply; + local = (char *(*)()) __db_db_rename_4001; + break; + + case __DB_db_stat: + xdr_argument = xdr___db_stat_msg; + xdr_result = xdr___db_stat_reply; + local = (char *(*)()) __db_db_stat_4001; + break; + + case __DB_db_sync: + xdr_argument = xdr___db_sync_msg; + xdr_result = xdr___db_sync_reply; + local = (char *(*)()) __db_db_sync_4001; + break; + + case __DB_db_truncate: + xdr_argument = xdr___db_truncate_msg; + xdr_result = xdr___db_truncate_reply; + local = (char *(*)()) __db_db_truncate_4001; + break; + + case __DB_db_cursor: + xdr_argument = xdr___db_cursor_msg; + xdr_result = xdr___db_cursor_reply; + local = (char *(*)()) __db_db_cursor_4001; + break; + + case __DB_db_join: + xdr_argument = xdr___db_join_msg; + xdr_result = xdr___db_join_reply; + local = (char *(*)()) __db_db_join_4001; + break; + + case __DB_dbc_close: + xdr_argument = xdr___dbc_close_msg; + xdr_result = xdr___dbc_close_reply; + local = (char *(*)()) __db_dbc_close_4001; + break; + + case __DB_dbc_count: + xdr_argument = xdr___dbc_count_msg; + xdr_result = xdr___dbc_count_reply; + local = (char *(*)()) __db_dbc_count_4001; + break; + + case __DB_dbc_del: + xdr_argument = xdr___dbc_del_msg; + xdr_result = xdr___dbc_del_reply; + local = (char *(*)()) __db_dbc_del_4001; + break; + + case __DB_dbc_dup: + xdr_argument = xdr___dbc_dup_msg; + xdr_result = xdr___dbc_dup_reply; + local = (char *(*)()) __db_dbc_dup_4001; + break; + + case __DB_dbc_get: + xdr_argument = xdr___dbc_get_msg; + xdr_result = xdr___dbc_get_reply; + local = (char *(*)()) __db_dbc_get_4001; + break; + + case __DB_dbc_pget: + xdr_argument = xdr___dbc_pget_msg; + xdr_result = xdr___dbc_pget_reply; + local = (char *(*)()) __db_dbc_pget_4001; + break; + + case __DB_dbc_put: + xdr_argument = xdr___dbc_put_msg; + xdr_result = xdr___dbc_put_reply; + local = (char *(*)()) __db_dbc_put_4001; + break; + + default: + svcerr_noproc(transp); + return; + } + (void) memset((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) { + svcerr_decode(transp); + return; + } + result = (*local)(&argument, rqstp); + if (result != NULL && !svc_sendreply(transp, (xdrproc_t)xdr_result, result)) { + svcerr_systemerr(transp); + } + if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) { + fprintf(stderr, "unable to free arguments"); + exit(1); + } + __dbsrv_timeout(0); + return; +} + +void __dbsrv_main() +{ + register SVCXPRT *transp; + + (void) pmap_unset(DB_RPC_SERVERPROG, DB_RPC_SERVERVERS); + + transp = svctcp_create(RPC_ANYSOCK, 0, 0); + if (transp == NULL) { + fprintf(stderr, "cannot create tcp service."); + exit(1); + } + if (!svc_register(transp, DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, db_rpc_serverprog_4001, IPPROTO_TCP)) { + fprintf(stderr, "unable to register (DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, tcp)."); + exit(1); + } + + svc_run(); + fprintf(stderr, "svc_run returned"); + exit(1); + /* NOTREACHED */ +} diff --git a/db/rpc_server/c/db_server_util.c b/db/rpc_server/c/db_server_util.c new file mode 100644 index 000000000..859a6b0d9 --- /dev/null +++ b/db/rpc_server/c/db_server_util.c @@ -0,0 +1,815 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_server_util.c,v 1.59 2002/03/27 04:32:50 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#if TIME_WITH_SYS_TIME +#include <sys/time.h> +#include <time.h> +#else +#if HAVE_SYS_TIME_H +#include <sys/time.h> +#else +#include <time.h> +#endif +#endif + +#include <rpc/rpc.h> + +#include <limits.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "dbinc_auto/clib_ext.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" +#include "dbinc_auto/common_ext.h" + +extern int __dbsrv_main __P((void)); +static int add_home __P((char *)); +static int add_passwd __P((char *)); +static int env_recover __P((char *)); +static void __dbclear_child __P((ct_entry *)); + +static LIST_HEAD(cthead, ct_entry) __dbsrv_head; +static LIST_HEAD(homehead, home_entry) __dbsrv_home; +static long __dbsrv_defto = DB_SERVER_TIMEOUT; +static long __dbsrv_maxto = DB_SERVER_MAXTIMEOUT; +static long __dbsrv_idleto = DB_SERVER_IDLETIMEOUT; +static char *logfile = NULL; +static char *prog; + +static void usage __P((char *)); +static void version_check __P((void)); + +int __dbsrv_verbose = 0; + +int +main(argc, argv) + int argc; + char **argv; +{ + extern char *optarg; + CLIENT *cl; + int ch, ret; + char *passwd; + + prog = argv[0]; + + version_check(); + + ret = 0; + /* + * Check whether another server is running or not. There + * is a race condition where two servers could be racing to + * register with the portmapper. The goal of this check is to + * forbid running additional servers (like those started from + * the test suite) if the user is already running one. + * + * XXX + * This does not solve nor prevent two servers from being + * started at the same time and running recovery at the same + * time on the same environments. + */ + if ((cl = clnt_create("localhost", + DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, "tcp")) != NULL) { + fprintf(stderr, + "%s: Berkeley DB RPC server already running.\n", prog); + clnt_destroy(cl); + return (EXIT_FAILURE); + } + + LIST_INIT(&__dbsrv_home); + while ((ch = getopt(argc, argv, "h:I:L:P:t:T:Vv")) != EOF) + switch (ch) { + case 'h': + (void)add_home(optarg); + break; + case 'I': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_idleto)) + return (EXIT_FAILURE); + break; + case 'L': + logfile = optarg; + break; + case 'P': + passwd = strdup(optarg); + memset(optarg, 0, strlen(optarg)); + if (passwd == NULL) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(errno)); + return (EXIT_FAILURE); + } + if ((ret = add_passwd(passwd)) != 0) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(ret)); + return (EXIT_FAILURE); + } + break; + case 't': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_defto)) + return (EXIT_FAILURE); + break; + case 'T': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_maxto)) + return (EXIT_FAILURE); + break; + case 'V': + printf("%s\n", db_version(NULL, NULL, NULL)); + return (EXIT_SUCCESS); + case 'v': + __dbsrv_verbose = 1; + break; + default: + usage(prog); + } + /* + * Check default timeout against maximum timeout + */ + if (__dbsrv_defto > __dbsrv_maxto) + __dbsrv_defto = __dbsrv_maxto; + + /* + * Check default timeout against idle timeout + * It would be bad to timeout environments sooner than txns. + */ + if (__dbsrv_defto > __dbsrv_idleto) + fprintf(stderr, + "%s: WARNING: Idle timeout %ld is less than resource timeout %ld\n", + prog, __dbsrv_idleto, __dbsrv_defto); + + LIST_INIT(&__dbsrv_head); + + /* + * If a client crashes during an RPC, our reply to it + * generates a SIGPIPE. Ignore SIGPIPE so we don't exit unnecessarily. + */ +#ifdef SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif + + if (logfile != NULL && __db_util_logset("berkeley_db_svc", logfile)) + return (EXIT_FAILURE); + + /* + * Now that we are ready to start, run recovery on all the + * environments specified. + */ + if (env_recover(prog) != 0) + return (EXIT_FAILURE); + + /* + * We've done our setup, now call the generated server loop + */ + if (__dbsrv_verbose) + printf("%s: Ready to receive requests\n", prog); + __dbsrv_main(); + + /* NOTREACHED */ + abort(); +} + +static void +usage(prog) + char *prog; +{ + fprintf(stderr, "usage: %s %s\n\t%s\n", prog, + "[-Vv] [-h home] [-P passwd]", + "[-I idletimeout] [-L logfile] [-t def_timeout] [-T maxtimeout]"); + exit(EXIT_FAILURE); +} + +static void +version_check() +{ + int v_major, v_minor, v_patch; + + /* Make sure we're loaded with the right version of the DB library. */ + (void)db_version(&v_major, &v_minor, &v_patch); + if (v_major != DB_VERSION_MAJOR || + v_minor != DB_VERSION_MINOR || v_patch != DB_VERSION_PATCH) { + fprintf(stderr, + "%s: version %d.%d.%d doesn't match library version %d.%d.%d\n", + prog, DB_VERSION_MAJOR, DB_VERSION_MINOR, + DB_VERSION_PATCH, v_major, v_minor, v_patch); + exit(EXIT_FAILURE); + } +} + +/* + * PUBLIC: void __dbsrv_settimeout __P((ct_entry *, u_int32_t)); + */ +void +__dbsrv_settimeout(ctp, to) + ct_entry *ctp; + u_int32_t to; +{ + if (to > (u_int32_t)__dbsrv_maxto) + ctp->ct_timeout = __dbsrv_maxto; + else if (to <= 0) + ctp->ct_timeout = __dbsrv_defto; + else + ctp->ct_timeout = to; +} + +/* + * PUBLIC: void __dbsrv_timeout __P((int)); + */ +void +__dbsrv_timeout(force) + int force; +{ + static long to_hint = -1; + time_t t; + long to; + ct_entry *ctp, *nextctp; + + if ((t = time(NULL)) == -1) + return; + + /* + * Check hint. If hint is further in the future + * than now, no work to do. + */ + if (!force && to_hint > 0 && t < to_hint) + return; + to_hint = -1; + /* + * Timeout transactions or cursors holding DB resources. + * Do this before timing out envs to properly release resources. + * + * !!! + * We can just loop through this list looking for cursors and txns. + * We do not need to verify txn and cursor relationships at this + * point because we maintain the list in LIFO order *and* we + * maintain activity in the ultimate txn parent of any cursor + * so either everything in a txn is timing out, or nothing. + * So, since we are LIFO, we will correctly close/abort all the + * appropriate handles, in the correct order. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + switch (ctp->ct_type) { + case CT_TXN: + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out txn id %ld\n", + ctp->ct_id); + (void)((DB_TXN *)ctp->ct_anyp)-> + abort((DB_TXN *)ctp->ct_anyp); + __dbdel_ctp(ctp); + /* + * If we timed out an txn, we may have closed + * all sorts of ctp's. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + case CT_CURSOR: + case (CT_JOINCUR | CT_CURSOR): + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out cursor %ld\n", + ctp->ct_id); + (void)__dbc_close_int(ctp); + /* + * Start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + default: + break; + } + } + /* + * Timeout idle handles. + * If we are forcing a timeout, we'll close all env handles. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type != CT_ENV) + continue; + to = *(ctp->ct_activep) + ctp->ct_idle; + /* TIMEOUT */ + if (to < t || force) { + if (__dbsrv_verbose) + printf("Timing out env id %ld\n", ctp->ct_id); + (void)__dbenv_close_int(ctp->ct_id, 0, 1); + /* + * If we timed out an env, we may have closed + * all sorts of ctp's (maybe even all of them. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } + } +} + +/* + * RECURSIVE FUNCTION. We need to clear/free any number of levels of nested + * layers. + */ +static void +__dbclear_child(parent) + ct_entry *parent; +{ + ct_entry *ctp, *nextctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type == 0) + continue; + if (ctp->ct_parent == parent) { + __dbclear_child(ctp); + /* + * Need to do this here because le_next may + * have changed with the recursive call and we + * don't want to point to a removed entry. + */ + nextctp = LIST_NEXT(ctp, entries); + __dbclear_ctp(ctp); + } + } +} + +/* + * PUBLIC: void __dbclear_ctp __P((ct_entry *)); + */ +void +__dbclear_ctp(ctp) + ct_entry *ctp; +{ + LIST_REMOVE(ctp, entries); + __os_free(NULL, ctp); +} + +/* + * PUBLIC: void __dbdel_ctp __P((ct_entry *)); + */ +void +__dbdel_ctp(parent) + ct_entry *parent; +{ + __dbclear_child(parent); + __dbclear_ctp(parent); +} + +/* + * PUBLIC: ct_entry *new_ct_ent __P((int *)); + */ +ct_entry * +new_ct_ent(errp) + int *errp; +{ + time_t t; + ct_entry *ctp, *octp; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(ct_entry), &ctp)) != 0) { + *errp = ret; + return (NULL); + } + memset(ctp, 0, sizeof(ct_entry)); + /* + * Get the time as ID. We may service more than one request per + * second however. If we are, then increment id value until we + * find an unused one. We insert entries in LRU fashion at the + * head of the list. So, if the first entry doesn't match, then + * we know for certain that we can use our entry. + */ + if ((t = time(NULL)) == -1) { + *errp = __os_get_errno(); + __os_free(NULL, ctp); + return (NULL); + } + octp = LIST_FIRST(&__dbsrv_head); + if (octp != NULL && octp->ct_id >= t) + t = octp->ct_id + 1; + ctp->ct_id = t; + ctp->ct_idle = __dbsrv_idleto; + ctp->ct_activep = &ctp->ct_active; + ctp->ct_origp = NULL; + ctp->ct_refcount = 1; + + LIST_INSERT_HEAD(&__dbsrv_head, ctp, entries); + return (ctp); +} + +/* + * PUBLIC: ct_entry *get_tableent __P((long)); + */ +ct_entry * +get_tableent(id) + long id; +{ + ct_entry *ctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) + if (ctp->ct_id == id) + return (ctp); + return (NULL); +} + +/* + * PUBLIC: ct_entry *__dbsrv_sharedb __P((ct_entry *, const char *, + * PUBLIC: const char *, DBTYPE, u_int32_t)); + */ +ct_entry * +__dbsrv_sharedb(db_ctp, name, subdb, type, flags) + ct_entry *db_ctp; + const char *name, *subdb; + DBTYPE type; + u_int32_t flags; +{ + ct_entry *ctp; + + /* + * Check if we can share a db handle. Criteria for sharing are: + * If any of the non-sharable flags are set, we cannot share. + * Must be a db ctp, obviously. + * Must share the same env parent. + * Must be the same type, or current one DB_UNKNOWN. + * Must be same byteorder, or current one must not care. + * All flags must match. + * Must be same name, but don't share in-memory databases. + * Must be same subdb name. + */ + if (flags & DB_SERVER_DBNOSHARE) + return (NULL); + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == db_ctp) + continue; + if (ctp->ct_type != CT_DB) + continue; + if (ctp->ct_envparent != db_ctp->ct_envparent) + continue; + if (type != DB_UNKNOWN && ctp->ct_dbdp.type != type) + continue; + if (ctp->ct_dbdp.dbflags != LF_ISSET(DB_SERVER_DBFLAGS)) + continue; + if (db_ctp->ct_dbdp.setflags != 0 && + ctp->ct_dbdp.setflags != db_ctp->ct_dbdp.setflags) + continue; + if (name == NULL || ctp->ct_dbdp.db == NULL || + strcmp(name, ctp->ct_dbdp.db) != 0) + continue; + if (subdb != ctp->ct_dbdp.subdb && + (subdb == NULL || ctp->ct_dbdp.subdb == NULL || + strcmp(subdb, ctp->ct_dbdp.subdb) != 0)) + continue; + /* + * If we get here, then we match. + */ + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +/* + * PUBLIC: ct_entry *__dbsrv_shareenv __P((ct_entry *, home_entry *, u_int32_t)); + */ +ct_entry * +__dbsrv_shareenv(env_ctp, home, flags) + ct_entry *env_ctp; + home_entry *home; + u_int32_t flags; +{ + ct_entry *ctp; + + /* + * Check if we can share an env. Criteria for sharing are: + * Must be an env ctp, obviously. + * Must share the same home env. + * All flags must match. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == env_ctp) + continue; + if (ctp->ct_type != CT_ENV) + continue; + if (ctp->ct_envdp.home != home) + continue; + if (ctp->ct_envdp.envflags != flags) + continue; + if (ctp->ct_envdp.onflags != env_ctp->ct_envdp.onflags) + continue; + if (ctp->ct_envdp.offflags != env_ctp->ct_envdp.offflags) + continue; + /* + * If we get here, then we match. The only thing left to + * check is the timeout. Since the server timeout set by + * the client is a hint, for sharing we'll give them the + * benefit of the doubt and grant them the longer timeout. + */ + if (ctp->ct_timeout < env_ctp->ct_timeout) + ctp->ct_timeout = env_ctp->ct_timeout; + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +/* + * PUBLIC: void __dbsrv_active __P((ct_entry *)); + */ +void +__dbsrv_active(ctp) + ct_entry *ctp; +{ + time_t t; + ct_entry *envctp; + + if (ctp == NULL) + return; + if ((t = time(NULL)) == -1) + return; + *(ctp->ct_activep) = t; + if ((envctp = ctp->ct_envparent) == NULL) + return; + *(envctp->ct_activep) = t; + return; +} + +/* + * PUBLIC: int __db_close_int __P((long, u_int32_t)); + */ +int +__db_close_int(id, flags) + long id; + u_int32_t flags; +{ + DB *dbp; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_DB); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing dbp id %ld, refcount %d\n", + id, ctp->ct_refcount); + if (--ctp->ct_refcount != 0) + return (ret); + dbp = ctp->ct_dbp; + if (__dbsrv_verbose) + printf("Closing dbp id %ld\n", id); + + ret = dbp->close(dbp, flags); + __dbdel_ctp(ctp); + return (ret); +} + +/* + * PUBLIC: int __dbc_close_int __P((ct_entry *)); + */ +int +__dbc_close_int(dbc_ctp) + ct_entry *dbc_ctp; +{ + DBC *dbc; + int ret; + ct_entry *ctp; + + dbc = (DBC *)dbc_ctp->ct_anyp; + + ret = dbc->c_close(dbc); + /* + * If this cursor is a join cursor then we need to fix up the + * cursors that it was joined from so that they are independent again. + */ + if (dbc_ctp->ct_type & CT_JOINCUR) + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Test if it is a join cursor, and if it is part + * of this one. + */ + if ((ctp->ct_type & CT_JOIN) && + ctp->ct_activep == &dbc_ctp->ct_active) { + ctp->ct_type &= ~CT_JOIN; + ctp->ct_activep = ctp->ct_origp; + __dbsrv_active(ctp); + } + } + __dbclear_ctp(dbc_ctp); + return (ret); + +} + +/* + * PUBLIC: int __dbenv_close_int __P((long, u_int32_t, int)); + */ +int +__dbenv_close_int(id, flags, force) + long id; + u_int32_t flags; + int force; +{ + DB_ENV *dbenv; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_ENV); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing env id %ld, refcount %d\n", + id, ctp->ct_refcount); + /* + * If we are timing out, we need to force the close, no matter + * what the refcount. + */ + if (--ctp->ct_refcount != 0 && !force) + return (ret); + dbenv = ctp->ct_envp; + if (__dbsrv_verbose) + printf("Closing env id %ld\n", id); + + ret = dbenv->close(dbenv, flags); + __dbdel_ctp(ctp); + return (ret); +} + +static int +add_home(home) + char *home; +{ + home_entry *hp, *homep; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(home_entry), &hp)) != 0) + return (ret); + if ((ret = __os_malloc(NULL, strlen(home)+1, &hp->home)) != 0) + return (ret); + memcpy(hp->home, home, strlen(home)+1); + hp->dir = home; + hp->passwd = NULL; + /* + * This loop is to remove any trailing path separators, + * to assure hp->name points to the last component. + */ + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + while (*(hp->name) == '\0') { + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + } + /* + * Now we have successfully added it. Make sure there are no + * identical names. + */ + for (homep = LIST_FIRST(&__dbsrv_home); homep != NULL; + homep = LIST_NEXT(homep, entries)) + if (strcmp(homep->name, hp->name) == 0) { + printf("Already added home name %s, at directory %s\n", + hp->name, homep->dir); + __os_free(NULL, hp->home); + __os_free(NULL, hp); + return (-1); + } + LIST_INSERT_HEAD(&__dbsrv_home, hp, entries); + if (__dbsrv_verbose) + printf("Added home %s in dir %s\n", hp->name, hp->dir); + return (0); +} + +static int +add_passwd(passwd) + char *passwd; +{ + home_entry *hp; + + /* + * We add the passwd to the last given home dir. If there + * isn't a home dir, or the most recent one already has a + * passwd, then there is a user error. + */ + hp = LIST_FIRST(&__dbsrv_home); + if (hp == NULL || hp->passwd != NULL) + return (EINVAL); + /* + * We've already strdup'ed the passwd above, so we don't need + * to malloc new space, just point to it. + */ + hp->passwd = passwd; + return (0); +} + +/* + * PUBLIC: home_entry *get_home __P((char *)); + */ +home_entry * +get_home(name) + char *name; +{ + home_entry *hp; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) + if (strcmp(name, hp->name) == 0) + return (hp); + return (NULL); +} + +static int +env_recover(progname) + char *progname; +{ + DB_ENV *dbenv; + home_entry *hp; + u_int32_t flags; + int exitval, ret; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) { + exitval = 0; + if ((ret = db_env_create(&dbenv, 0)) != 0) { + fprintf(stderr, "%s: db_env_create: %s\n", + progname, db_strerror(ret)); + exit(EXIT_FAILURE); + } + if (__dbsrv_verbose == 1) { + (void)dbenv->set_verbose(dbenv, DB_VERB_RECOVERY, 1); + (void)dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT, 1); + } + dbenv->set_errfile(dbenv, stderr); + dbenv->set_errpfx(dbenv, progname); + if (hp->passwd != NULL) + (void)dbenv->set_encrypt(dbenv, hp->passwd, + DB_ENCRYPT_AES); + + /* + * Initialize the env with DB_RECOVER. That is all we + * have to do to run recovery. + */ + if (__dbsrv_verbose) + printf("Running recovery on %s\n", hp->home); + flags = DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | + DB_INIT_TXN | DB_USE_ENVIRON | DB_RECOVER; + if ((ret = dbenv->open(dbenv, hp->home, flags, 0)) != 0) { + dbenv->err(dbenv, ret, "DB_ENV->open"); + goto error; + } + + if (0) { +error: exitval = 1; + } + if ((ret = dbenv->close(dbenv, 0)) != 0) { + exitval = 1; + fprintf(stderr, "%s: dbenv->close: %s\n", + progname, db_strerror(ret)); + } + if (exitval) + return (exitval); + } + return (0); +} diff --git a/db/rpc_server/c/db_server_xdr.c b/db/rpc_server/c/db_server_xdr.c new file mode 100644 index 000000000..3c89ed092 --- /dev/null +++ b/db/rpc_server/c/db_server_xdr.c @@ -0,0 +1,1510 @@ +#include "db_config.h" + +#ifdef HAVE_RPC +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include <rpc/rpc.h> +#endif + +#include "db_int.h" +#include "dbinc_auto/db_server.h" + +bool_t +xdr___env_cachesize_msg(xdrs, objp) + register XDR *xdrs; + __env_cachesize_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->gbytes)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->bytes)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->ncache)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_cachesize_reply(xdrs, objp) + register XDR *xdrs; + __env_cachesize_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_close_msg(xdrs, objp) + register XDR *xdrs; + __env_close_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_close_reply(xdrs, objp) + register XDR *xdrs; + __env_close_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_create_msg(xdrs, objp) + register XDR *xdrs; + __env_create_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->timeout)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_create_reply(xdrs, objp) + register XDR *xdrs; + __env_create_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->envcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbremove_msg(xdrs, objp) + register XDR *xdrs; + __env_dbremove_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbremove_reply(xdrs, objp) + register XDR *xdrs; + __env_dbremove_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbrename_msg(xdrs, objp) + register XDR *xdrs; + __env_dbrename_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->newname, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbrename_reply(xdrs, objp) + register XDR *xdrs; + __env_dbrename_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_encrypt_msg(xdrs, objp) + register XDR *xdrs; + __env_encrypt_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->passwd, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_encrypt_reply(xdrs, objp) + register XDR *xdrs; + __env_encrypt_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_flags_msg(xdrs, objp) + register XDR *xdrs; + __env_flags_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->onoff)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_flags_reply(xdrs, objp) + register XDR *xdrs; + __env_flags_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_open_msg(xdrs, objp) + register XDR *xdrs; + __env_open_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->home, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->mode)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_open_reply(xdrs, objp) + register XDR *xdrs; + __env_open_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->envcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_remove_msg(xdrs, objp) + register XDR *xdrs; + __env_remove_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->home, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_remove_reply(xdrs, objp) + register XDR *xdrs; + __env_remove_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_abort_msg(xdrs, objp) + register XDR *xdrs; + __txn_abort_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_abort_reply(xdrs, objp) + register XDR *xdrs; + __txn_abort_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_begin_msg(xdrs, objp) + register XDR *xdrs; + __txn_begin_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->parentcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_begin_reply(xdrs, objp) + register XDR *xdrs; + __txn_begin_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_commit_msg(xdrs, objp) + register XDR *xdrs; + __txn_commit_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_commit_reply(xdrs, objp) + register XDR *xdrs; + __txn_commit_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_discard_msg(xdrs, objp) + register XDR *xdrs; + __txn_discard_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_discard_reply(xdrs, objp) + register XDR *xdrs; + __txn_discard_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_prepare_msg(xdrs, objp) + register XDR *xdrs; + __txn_prepare_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_opaque(xdrs, objp->gid, 128)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_prepare_reply(xdrs, objp) + register XDR *xdrs; + __txn_prepare_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_recover_msg(xdrs, objp) + register XDR *xdrs; + __txn_recover_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->count)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_recover_reply(xdrs, objp) + register XDR *xdrs; + __txn_recover_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->txn.txn_val, (u_int *) &objp->txn.txn_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->gid.gid_val, (u_int *) &objp->gid.gid_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->retcount)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_associate_msg(xdrs, objp) + register XDR *xdrs; + __db_associate_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->sdbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_associate_reply(xdrs, objp) + register XDR *xdrs; + __db_associate_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_maxkey_msg(xdrs, objp) + register XDR *xdrs; + __db_bt_maxkey_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->maxkey)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_maxkey_reply(xdrs, objp) + register XDR *xdrs; + __db_bt_maxkey_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_minkey_msg(xdrs, objp) + register XDR *xdrs; + __db_bt_minkey_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->minkey)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_minkey_reply(xdrs, objp) + register XDR *xdrs; + __db_bt_minkey_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_close_msg(xdrs, objp) + register XDR *xdrs; + __db_close_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_close_reply(xdrs, objp) + register XDR *xdrs; + __db_close_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_create_msg(xdrs, objp) + register XDR *xdrs; + __db_create_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_create_reply(xdrs, objp) + register XDR *xdrs; + __db_create_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_del_msg(xdrs, objp) + register XDR *xdrs; + __db_del_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_del_reply(xdrs, objp) + register XDR *xdrs; + __db_del_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_encrypt_msg(xdrs, objp) + register XDR *xdrs; + __db_encrypt_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->passwd, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_encrypt_reply(xdrs, objp) + register XDR *xdrs; + __db_encrypt_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_extentsize_msg(xdrs, objp) + register XDR *xdrs; + __db_extentsize_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->extentsize)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_extentsize_reply(xdrs, objp) + register XDR *xdrs; + __db_extentsize_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_flags_msg(xdrs, objp) + register XDR *xdrs; + __db_flags_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_flags_reply(xdrs, objp) + register XDR *xdrs; + __db_flags_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_get_msg(xdrs, objp) + register XDR *xdrs; + __db_get_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_get_reply(xdrs, objp) + register XDR *xdrs; + __db_get_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_ffactor_msg(xdrs, objp) + register XDR *xdrs; + __db_h_ffactor_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->ffactor)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_ffactor_reply(xdrs, objp) + register XDR *xdrs; + __db_h_ffactor_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_nelem_msg(xdrs, objp) + register XDR *xdrs; + __db_h_nelem_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->nelem)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_nelem_reply(xdrs, objp) + register XDR *xdrs; + __db_h_nelem_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_key_range_msg(xdrs, objp) + register XDR *xdrs; + __db_key_range_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_key_range_reply(xdrs, objp) + register XDR *xdrs; + __db_key_range_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_double(xdrs, &objp->less)) + return (FALSE); + if (!xdr_double(xdrs, &objp->equal)) + return (FALSE); + if (!xdr_double(xdrs, &objp->greater)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_lorder_msg(xdrs, objp) + register XDR *xdrs; + __db_lorder_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->lorder)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_lorder_reply(xdrs, objp) + register XDR *xdrs; + __db_lorder_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_open_msg(xdrs, objp) + register XDR *xdrs; + __db_open_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->type)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->mode)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_open_reply(xdrs, objp) + register XDR *xdrs; + __db_open_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->type)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbflags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->lorder)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pagesize_msg(xdrs, objp) + register XDR *xdrs; + __db_pagesize_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pagesize)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pagesize_reply(xdrs, objp) + register XDR *xdrs; + __db_pagesize_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pget_msg(xdrs, objp) + register XDR *xdrs; + __db_pget_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pget_reply(xdrs, objp) + register XDR *xdrs; + __db_pget_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_put_msg(xdrs, objp) + register XDR *xdrs; + __db_put_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_put_reply(xdrs, objp) + register XDR *xdrs; + __db_put_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_delim_msg(xdrs, objp) + register XDR *xdrs; + __db_re_delim_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->delim)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_delim_reply(xdrs, objp) + register XDR *xdrs; + __db_re_delim_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_len_msg(xdrs, objp) + register XDR *xdrs; + __db_re_len_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->len)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_len_reply(xdrs, objp) + register XDR *xdrs; + __db_re_len_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_pad_msg(xdrs, objp) + register XDR *xdrs; + __db_re_pad_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pad)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_pad_reply(xdrs, objp) + register XDR *xdrs; + __db_re_pad_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_remove_msg(xdrs, objp) + register XDR *xdrs; + __db_remove_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_remove_reply(xdrs, objp) + register XDR *xdrs; + __db_remove_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_rename_msg(xdrs, objp) + register XDR *xdrs; + __db_rename_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->newname, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_rename_reply(xdrs, objp) + register XDR *xdrs; + __db_rename_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_stat_msg(xdrs, objp) + register XDR *xdrs; + __db_stat_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_stat_reply(xdrs, objp) + register XDR *xdrs; + __db_stat_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->stats.stats_val, (u_int *) &objp->stats.stats_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_sync_msg(xdrs, objp) + register XDR *xdrs; + __db_sync_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_sync_reply(xdrs, objp) + register XDR *xdrs; + __db_sync_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_truncate_msg(xdrs, objp) + register XDR *xdrs; + __db_truncate_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_truncate_reply(xdrs, objp) + register XDR *xdrs; + __db_truncate_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->count)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_cursor_msg(xdrs, objp) + register XDR *xdrs; + __db_cursor_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_cursor_reply(xdrs, objp) + register XDR *xdrs; + __db_cursor_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_join_msg(xdrs, objp) + register XDR *xdrs; + __db_join_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->curs.curs_val, (u_int *) &objp->curs.curs_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_join_reply(xdrs, objp) + register XDR *xdrs; + __db_join_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_close_msg(xdrs, objp) + register XDR *xdrs; + __dbc_close_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_close_reply(xdrs, objp) + register XDR *xdrs; + __dbc_close_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_count_msg(xdrs, objp) + register XDR *xdrs; + __dbc_count_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_count_reply(xdrs, objp) + register XDR *xdrs; + __dbc_count_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dupcount)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_del_msg(xdrs, objp) + register XDR *xdrs; + __dbc_del_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_del_reply(xdrs, objp) + register XDR *xdrs; + __dbc_del_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_dup_msg(xdrs, objp) + register XDR *xdrs; + __dbc_dup_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_dup_reply(xdrs, objp) + register XDR *xdrs; + __dbc_dup_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_get_msg(xdrs, objp) + register XDR *xdrs; + __dbc_get_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_get_reply(xdrs, objp) + register XDR *xdrs; + __dbc_get_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_pget_msg(xdrs, objp) + register XDR *xdrs; + __dbc_pget_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_pget_reply(xdrs, objp) + register XDR *xdrs; + __dbc_pget_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_put_msg(xdrs, objp) + register XDR *xdrs; + __dbc_put_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_put_reply(xdrs, objp) + register XDR *xdrs; + __dbc_put_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + return (TRUE); +} +#endif /* HAVE_RPC */ diff --git a/db/rpc_server/c/gen_db_server.c b/db/rpc_server/c/gen_db_server.c new file mode 100644 index 000000000..0181fb06d --- /dev/null +++ b/db/rpc_server/c/gen_db_server.c @@ -0,0 +1,1169 @@ +/* Do not edit: automatically built by gen_rpc.awk. */ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <rpc/rpc.h> +#include <rpc/xdr.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc_auto/db_server.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" + +/* + * PUBLIC: __env_cachesize_reply *__db_env_cachesize_4001 + * PUBLIC: __P((__env_cachesize_msg *, struct svc_req *)); + */ +__env_cachesize_reply * +__db_env_cachesize_4001(msg, req) + __env_cachesize_msg *msg; + struct svc_req *req; +{ + static __env_cachesize_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_cachesize_proc(msg->dbenvcl_id, + msg->gbytes, + msg->bytes, + msg->ncache, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_close_reply *__db_env_close_4001 __P((__env_close_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_close_reply * +__db_env_close_4001(msg, req) + __env_close_msg *msg; + struct svc_req *req; +{ + static __env_close_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_close_proc(msg->dbenvcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_create_reply *__db_env_create_4001 __P((__env_create_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_create_reply * +__db_env_create_4001(msg, req) + __env_create_msg *msg; + struct svc_req *req; +{ + static __env_create_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_create_proc(msg->timeout, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_dbremove_reply *__db_env_dbremove_4001 + * PUBLIC: __P((__env_dbremove_msg *, struct svc_req *)); + */ +__env_dbremove_reply * +__db_env_dbremove_4001(msg, req) + __env_dbremove_msg *msg; + struct svc_req *req; +{ + static __env_dbremove_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_dbremove_proc(msg->dbenvcl_id, + msg->txnpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_dbrename_reply *__db_env_dbrename_4001 + * PUBLIC: __P((__env_dbrename_msg *, struct svc_req *)); + */ +__env_dbrename_reply * +__db_env_dbrename_4001(msg, req) + __env_dbrename_msg *msg; + struct svc_req *req; +{ + static __env_dbrename_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_dbrename_proc(msg->dbenvcl_id, + msg->txnpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + (*msg->newname == '\0') ? NULL : msg->newname, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_encrypt_reply *__db_env_encrypt_4001 + * PUBLIC: __P((__env_encrypt_msg *, struct svc_req *)); + */ +__env_encrypt_reply * +__db_env_encrypt_4001(msg, req) + __env_encrypt_msg *msg; + struct svc_req *req; +{ + static __env_encrypt_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_encrypt_proc(msg->dbenvcl_id, + (*msg->passwd == '\0') ? NULL : msg->passwd, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_flags_reply *__db_env_flags_4001 __P((__env_flags_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_flags_reply * +__db_env_flags_4001(msg, req) + __env_flags_msg *msg; + struct svc_req *req; +{ + static __env_flags_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_flags_proc(msg->dbenvcl_id, + msg->flags, + msg->onoff, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_open_reply *__db_env_open_4001 __P((__env_open_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_open_reply * +__db_env_open_4001(msg, req) + __env_open_msg *msg; + struct svc_req *req; +{ + static __env_open_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_open_proc(msg->dbenvcl_id, + (*msg->home == '\0') ? NULL : msg->home, + msg->flags, + msg->mode, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_remove_reply *__db_env_remove_4001 __P((__env_remove_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_remove_reply * +__db_env_remove_4001(msg, req) + __env_remove_msg *msg; + struct svc_req *req; +{ + static __env_remove_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_remove_proc(msg->dbenvcl_id, + (*msg->home == '\0') ? NULL : msg->home, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_abort_reply *__db_txn_abort_4001 __P((__txn_abort_msg *, + * PUBLIC: struct svc_req *)); + */ +__txn_abort_reply * +__db_txn_abort_4001(msg, req) + __txn_abort_msg *msg; + struct svc_req *req; +{ + static __txn_abort_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_abort_proc(msg->txnpcl_id, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_begin_reply *__db_txn_begin_4001 __P((__txn_begin_msg *, + * PUBLIC: struct svc_req *)); + */ +__txn_begin_reply * +__db_txn_begin_4001(msg, req) + __txn_begin_msg *msg; + struct svc_req *req; +{ + static __txn_begin_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_begin_proc(msg->dbenvcl_id, + msg->parentcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_commit_reply *__db_txn_commit_4001 __P((__txn_commit_msg *, + * PUBLIC: struct svc_req *)); + */ +__txn_commit_reply * +__db_txn_commit_4001(msg, req) + __txn_commit_msg *msg; + struct svc_req *req; +{ + static __txn_commit_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_commit_proc(msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_discard_reply *__db_txn_discard_4001 + * PUBLIC: __P((__txn_discard_msg *, struct svc_req *)); + */ +__txn_discard_reply * +__db_txn_discard_4001(msg, req) + __txn_discard_msg *msg; + struct svc_req *req; +{ + static __txn_discard_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_discard_proc(msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_prepare_reply *__db_txn_prepare_4001 + * PUBLIC: __P((__txn_prepare_msg *, struct svc_req *)); + */ +__txn_prepare_reply * +__db_txn_prepare_4001(msg, req) + __txn_prepare_msg *msg; + struct svc_req *req; +{ + static __txn_prepare_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_prepare_proc(msg->txnpcl_id, + msg->gid, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_recover_reply *__db_txn_recover_4001 + * PUBLIC: __P((__txn_recover_msg *, struct svc_req *)); + */ +__txn_recover_reply * +__db_txn_recover_4001(msg, req) + __txn_recover_msg *msg; + struct svc_req *req; +{ + static __txn_recover_reply reply; /* must be static */ + static int __txn_recover_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__txn_recover_free) + xdr_free((xdrproc_t)xdr___txn_recover_reply, (void *)&reply); + __txn_recover_free = 0; + + /* Reinitialize allocated fields */ + reply.txn.txn_val = NULL; + reply.gid.gid_val = NULL; + + __txn_recover_proc(msg->dbenvcl_id, + msg->count, + msg->flags, + &reply, + &__txn_recover_free); + return (&reply); +} + +/* + * PUBLIC: __db_associate_reply *__db_db_associate_4001 + * PUBLIC: __P((__db_associate_msg *, struct svc_req *)); + */ +__db_associate_reply * +__db_db_associate_4001(msg, req) + __db_associate_msg *msg; + struct svc_req *req; +{ + static __db_associate_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_associate_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->sdbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_bt_maxkey_reply *__db_db_bt_maxkey_4001 + * PUBLIC: __P((__db_bt_maxkey_msg *, struct svc_req *)); + */ +__db_bt_maxkey_reply * +__db_db_bt_maxkey_4001(msg, req) + __db_bt_maxkey_msg *msg; + struct svc_req *req; +{ + static __db_bt_maxkey_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_bt_maxkey_proc(msg->dbpcl_id, + msg->maxkey, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_bt_minkey_reply *__db_db_bt_minkey_4001 + * PUBLIC: __P((__db_bt_minkey_msg *, struct svc_req *)); + */ +__db_bt_minkey_reply * +__db_db_bt_minkey_4001(msg, req) + __db_bt_minkey_msg *msg; + struct svc_req *req; +{ + static __db_bt_minkey_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_bt_minkey_proc(msg->dbpcl_id, + msg->minkey, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_close_reply *__db_db_close_4001 __P((__db_close_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_close_reply * +__db_db_close_4001(msg, req) + __db_close_msg *msg; + struct svc_req *req; +{ + static __db_close_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_close_proc(msg->dbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_create_reply *__db_db_create_4001 __P((__db_create_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_create_reply * +__db_db_create_4001(msg, req) + __db_create_msg *msg; + struct svc_req *req; +{ + static __db_create_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_create_proc(msg->dbenvcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_del_reply *__db_db_del_4001 __P((__db_del_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_del_reply * +__db_db_del_4001(msg, req) + __db_del_msg *msg; + struct svc_req *req; +{ + static __db_del_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_del_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_encrypt_reply *__db_db_encrypt_4001 __P((__db_encrypt_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_encrypt_reply * +__db_db_encrypt_4001(msg, req) + __db_encrypt_msg *msg; + struct svc_req *req; +{ + static __db_encrypt_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_encrypt_proc(msg->dbpcl_id, + (*msg->passwd == '\0') ? NULL : msg->passwd, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_extentsize_reply *__db_db_extentsize_4001 + * PUBLIC: __P((__db_extentsize_msg *, struct svc_req *)); + */ +__db_extentsize_reply * +__db_db_extentsize_4001(msg, req) + __db_extentsize_msg *msg; + struct svc_req *req; +{ + static __db_extentsize_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_extentsize_proc(msg->dbpcl_id, + msg->extentsize, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_flags_reply *__db_db_flags_4001 __P((__db_flags_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_flags_reply * +__db_db_flags_4001(msg, req) + __db_flags_msg *msg; + struct svc_req *req; +{ + static __db_flags_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_flags_proc(msg->dbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_get_reply *__db_db_get_4001 __P((__db_get_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_get_reply * +__db_db_get_4001(msg, req) + __db_get_msg *msg; + struct svc_req *req; +{ + static __db_get_reply reply; /* must be static */ + static int __db_get_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_get_free) + xdr_free((xdrproc_t)xdr___db_get_reply, (void *)&reply); + __db_get_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __db_get_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__db_get_free); + return (&reply); +} + +/* + * PUBLIC: __db_h_ffactor_reply *__db_db_h_ffactor_4001 + * PUBLIC: __P((__db_h_ffactor_msg *, struct svc_req *)); + */ +__db_h_ffactor_reply * +__db_db_h_ffactor_4001(msg, req) + __db_h_ffactor_msg *msg; + struct svc_req *req; +{ + static __db_h_ffactor_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_h_ffactor_proc(msg->dbpcl_id, + msg->ffactor, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_h_nelem_reply *__db_db_h_nelem_4001 __P((__db_h_nelem_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_h_nelem_reply * +__db_db_h_nelem_4001(msg, req) + __db_h_nelem_msg *msg; + struct svc_req *req; +{ + static __db_h_nelem_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_h_nelem_proc(msg->dbpcl_id, + msg->nelem, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_key_range_reply *__db_db_key_range_4001 + * PUBLIC: __P((__db_key_range_msg *, struct svc_req *)); + */ +__db_key_range_reply * +__db_db_key_range_4001(msg, req) + __db_key_range_msg *msg; + struct svc_req *req; +{ + static __db_key_range_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_key_range_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_lorder_reply *__db_db_lorder_4001 __P((__db_lorder_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_lorder_reply * +__db_db_lorder_4001(msg, req) + __db_lorder_msg *msg; + struct svc_req *req; +{ + static __db_lorder_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_lorder_proc(msg->dbpcl_id, + msg->lorder, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_open_reply *__db_db_open_4001 __P((__db_open_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_open_reply * +__db_db_open_4001(msg, req) + __db_open_msg *msg; + struct svc_req *req; +{ + static __db_open_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_open_proc(msg->dbpcl_id, + msg->txnpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + msg->type, + msg->flags, + msg->mode, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_pagesize_reply *__db_db_pagesize_4001 + * PUBLIC: __P((__db_pagesize_msg *, struct svc_req *)); + */ +__db_pagesize_reply * +__db_db_pagesize_4001(msg, req) + __db_pagesize_msg *msg; + struct svc_req *req; +{ + static __db_pagesize_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_pagesize_proc(msg->dbpcl_id, + msg->pagesize, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_pget_reply *__db_db_pget_4001 __P((__db_pget_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_pget_reply * +__db_db_pget_4001(msg, req) + __db_pget_msg *msg; + struct svc_req *req; +{ + static __db_pget_reply reply; /* must be static */ + static int __db_pget_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_pget_free) + xdr_free((xdrproc_t)xdr___db_pget_reply, (void *)&reply); + __db_pget_free = 0; + + /* Reinitialize allocated fields */ + reply.skeydata.skeydata_val = NULL; + reply.pkeydata.pkeydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __db_pget_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->skeydlen, + msg->skeydoff, + msg->skeyulen, + msg->skeyflags, + msg->skeydata.skeydata_val, + msg->skeydata.skeydata_len, + msg->pkeydlen, + msg->pkeydoff, + msg->pkeyulen, + msg->pkeyflags, + msg->pkeydata.pkeydata_val, + msg->pkeydata.pkeydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__db_pget_free); + return (&reply); +} + +/* + * PUBLIC: __db_put_reply *__db_db_put_4001 __P((__db_put_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_put_reply * +__db_db_put_4001(msg, req) + __db_put_msg *msg; + struct svc_req *req; +{ + static __db_put_reply reply; /* must be static */ + static int __db_put_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_put_free) + xdr_free((xdrproc_t)xdr___db_put_reply, (void *)&reply); + __db_put_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + + __db_put_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__db_put_free); + return (&reply); +} + +/* + * PUBLIC: __db_re_delim_reply *__db_db_re_delim_4001 + * PUBLIC: __P((__db_re_delim_msg *, struct svc_req *)); + */ +__db_re_delim_reply * +__db_db_re_delim_4001(msg, req) + __db_re_delim_msg *msg; + struct svc_req *req; +{ + static __db_re_delim_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_re_delim_proc(msg->dbpcl_id, + msg->delim, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_re_len_reply *__db_db_re_len_4001 __P((__db_re_len_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_re_len_reply * +__db_db_re_len_4001(msg, req) + __db_re_len_msg *msg; + struct svc_req *req; +{ + static __db_re_len_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_re_len_proc(msg->dbpcl_id, + msg->len, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_re_pad_reply *__db_db_re_pad_4001 __P((__db_re_pad_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_re_pad_reply * +__db_db_re_pad_4001(msg, req) + __db_re_pad_msg *msg; + struct svc_req *req; +{ + static __db_re_pad_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_re_pad_proc(msg->dbpcl_id, + msg->pad, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_remove_reply *__db_db_remove_4001 __P((__db_remove_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_remove_reply * +__db_db_remove_4001(msg, req) + __db_remove_msg *msg; + struct svc_req *req; +{ + static __db_remove_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_remove_proc(msg->dbpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_rename_reply *__db_db_rename_4001 __P((__db_rename_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_rename_reply * +__db_db_rename_4001(msg, req) + __db_rename_msg *msg; + struct svc_req *req; +{ + static __db_rename_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_rename_proc(msg->dbpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + (*msg->newname == '\0') ? NULL : msg->newname, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_stat_reply *__db_db_stat_4001 __P((__db_stat_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_stat_reply * +__db_db_stat_4001(msg, req) + __db_stat_msg *msg; + struct svc_req *req; +{ + static __db_stat_reply reply; /* must be static */ + static int __db_stat_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_stat_free) + xdr_free((xdrproc_t)xdr___db_stat_reply, (void *)&reply); + __db_stat_free = 0; + + /* Reinitialize allocated fields */ + reply.stats.stats_val = NULL; + + __db_stat_proc(msg->dbpcl_id, + msg->flags, + &reply, + &__db_stat_free); + return (&reply); +} + +/* + * PUBLIC: __db_sync_reply *__db_db_sync_4001 __P((__db_sync_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_sync_reply * +__db_db_sync_4001(msg, req) + __db_sync_msg *msg; + struct svc_req *req; +{ + static __db_sync_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_sync_proc(msg->dbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_truncate_reply *__db_db_truncate_4001 + * PUBLIC: __P((__db_truncate_msg *, struct svc_req *)); + */ +__db_truncate_reply * +__db_db_truncate_4001(msg, req) + __db_truncate_msg *msg; + struct svc_req *req; +{ + static __db_truncate_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_truncate_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_cursor_reply *__db_db_cursor_4001 __P((__db_cursor_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_cursor_reply * +__db_db_cursor_4001(msg, req) + __db_cursor_msg *msg; + struct svc_req *req; +{ + static __db_cursor_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_cursor_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_join_reply *__db_db_join_4001 __P((__db_join_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_join_reply * +__db_db_join_4001(msg, req) + __db_join_msg *msg; + struct svc_req *req; +{ + static __db_join_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_join_proc(msg->dbpcl_id, + msg->curs.curs_val, + msg->curs.curs_len, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_close_reply *__db_dbc_close_4001 __P((__dbc_close_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_close_reply * +__db_dbc_close_4001(msg, req) + __dbc_close_msg *msg; + struct svc_req *req; +{ + static __dbc_close_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_close_proc(msg->dbccl_id, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_count_reply *__db_dbc_count_4001 __P((__dbc_count_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_count_reply * +__db_dbc_count_4001(msg, req) + __dbc_count_msg *msg; + struct svc_req *req; +{ + static __dbc_count_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_count_proc(msg->dbccl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_del_reply *__db_dbc_del_4001 __P((__dbc_del_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_del_reply * +__db_dbc_del_4001(msg, req) + __dbc_del_msg *msg; + struct svc_req *req; +{ + static __dbc_del_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_del_proc(msg->dbccl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_dup_reply *__db_dbc_dup_4001 __P((__dbc_dup_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_dup_reply * +__db_dbc_dup_4001(msg, req) + __dbc_dup_msg *msg; + struct svc_req *req; +{ + static __dbc_dup_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_dup_proc(msg->dbccl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_get_reply *__db_dbc_get_4001 __P((__dbc_get_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_get_reply * +__db_dbc_get_4001(msg, req) + __dbc_get_msg *msg; + struct svc_req *req; +{ + static __dbc_get_reply reply; /* must be static */ + static int __dbc_get_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__dbc_get_free) + xdr_free((xdrproc_t)xdr___dbc_get_reply, (void *)&reply); + __dbc_get_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __dbc_get_proc(msg->dbccl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__dbc_get_free); + return (&reply); +} + +/* + * PUBLIC: __dbc_pget_reply *__db_dbc_pget_4001 __P((__dbc_pget_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_pget_reply * +__db_dbc_pget_4001(msg, req) + __dbc_pget_msg *msg; + struct svc_req *req; +{ + static __dbc_pget_reply reply; /* must be static */ + static int __dbc_pget_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__dbc_pget_free) + xdr_free((xdrproc_t)xdr___dbc_pget_reply, (void *)&reply); + __dbc_pget_free = 0; + + /* Reinitialize allocated fields */ + reply.skeydata.skeydata_val = NULL; + reply.pkeydata.pkeydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __dbc_pget_proc(msg->dbccl_id, + msg->skeydlen, + msg->skeydoff, + msg->skeyulen, + msg->skeyflags, + msg->skeydata.skeydata_val, + msg->skeydata.skeydata_len, + msg->pkeydlen, + msg->pkeydoff, + msg->pkeyulen, + msg->pkeyflags, + msg->pkeydata.pkeydata_val, + msg->pkeydata.pkeydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__dbc_pget_free); + return (&reply); +} + +/* + * PUBLIC: __dbc_put_reply *__db_dbc_put_4001 __P((__dbc_put_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_put_reply * +__db_dbc_put_4001(msg, req) + __dbc_put_msg *msg; + struct svc_req *req; +{ + static __dbc_put_reply reply; /* must be static */ + static int __dbc_put_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__dbc_put_free) + xdr_free((xdrproc_t)xdr___dbc_put_reply, (void *)&reply); + __dbc_put_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + + __dbc_put_proc(msg->dbccl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__dbc_put_free); + return (&reply); +} + diff --git a/db/rpc_server/cxx/db_server_cxxproc.cpp b/db/rpc_server/cxx/db_server_cxxproc.cpp new file mode 100644 index 000000000..0ba1fd50c --- /dev/null +++ b/db/rpc_server/cxx/db_server_cxxproc.cpp @@ -0,0 +1,2200 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifdef HAVE_RPC +#ifndef lint +static const char revid[] = "Id: db_server_cxxproc.cpp,v 1.12 2002/08/09 01:56:08 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <rpc/rpc.h> + +#include <string.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "db_cxx.h" + +extern "C" { +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" +} + +/* BEGIN __env_cachesize_proc */ +extern "C" void +__env_cachesize_proc( + long dbenvcl_id, + u_int32_t gbytes, + u_int32_t bytes, + u_int32_t ncache, + __env_cachesize_reply *replyp) +/* END __env_cachesize_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_cachesize(gbytes, bytes, ncache); + + replyp->status = ret; + return; +} + +/* BEGIN __env_close_proc */ +extern "C" void +__env_close_proc( + long dbenvcl_id, + u_int32_t flags, + __env_close_reply *replyp) +/* END __env_close_proc */ +{ + ct_entry *dbenv_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + replyp->status = __dbenv_close_int(dbenvcl_id, flags, 0); + return; +} + +/* BEGIN __env_create_proc */ +extern "C" void +__env_create_proc( + u_int32_t timeout, + __env_create_reply *replyp) +/* END __env_create_proc */ +{ + DbEnv *dbenv; + ct_entry *ctp; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + + dbenv = new DbEnv(DB_CXX_NO_EXCEPTIONS); + ctp->ct_envp = dbenv; + ctp->ct_type = CT_ENV; + ctp->ct_parent = NULL; + ctp->ct_envparent = ctp; + __dbsrv_settimeout(ctp, timeout); + __dbsrv_active(ctp); + replyp->envcl_id = ctp->ct_id; + + replyp->status = 0; + return; +} + +/* BEGIN __env_dbremove_proc */ +extern "C" void +__env_dbremove_proc( + long dbenvcl_id, + long txnpcl_id, + char *name, + char *subdb, + u_int32_t flags, + __env_dbremove_reply *replyp) +/* END __env_dbremove_proc */ +{ + int ret; + DbEnv *dbenv; + DbTxn *txnp; + ct_entry *dbenv_ctp, *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbremove(txnp, name, subdb, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_dbrename_proc */ +void +__env_dbrename_proc( + long dbenvcl_id, + long txnpcl_id, + char *name, + char *subdb, + char *newname, + u_int32_t flags, + __env_dbrename_reply *replyp) +/* END __env_dbrename_proc */ +{ + int ret; + DbEnv *dbenv; + DbTxn *txnp; + ct_entry *dbenv_ctp, *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbrename(txnp, name, subdb, newname, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_encrypt_proc */ +extern "C" void +__env_encrypt_proc( + long dbenvcl_id, + char *passwd, + u_int32_t flags, + __env_encrypt_reply *replyp) +/* END __env_encrypt_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_encrypt(passwd, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_flags_proc */ +extern "C" void +__env_flags_proc( + long dbenvcl_id, + u_int32_t flags, + u_int32_t onoff, + __env_flags_reply *replyp) +/* END __env_flags_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_flags(flags, onoff); + if (onoff) + dbenv_ctp->ct_envdp.onflags = flags; + else + dbenv_ctp->ct_envdp.offflags = flags; + + replyp->status = ret; + return; +} +/* BEGIN __env_open_proc */ +extern "C" void +__env_open_proc( + long dbenvcl_id, + char *home, + u_int32_t flags, + u_int32_t mode, + __env_open_reply *replyp) +/* END __env_open_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp, *new_ctp; + u_int32_t newflags, shareflags; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + fullhome = get_home(home); + if (fullhome == NULL) { + ret = DB_NOSERVER_HOME; + goto out; + } + + /* + * If they are using locking do deadlock detection for them, + * internally. + */ + if ((flags & DB_INIT_LOCK) && + (ret = dbenv->set_lk_detect(DB_LOCK_DEFAULT)) != 0) + goto out; + + if (__dbsrv_verbose) { + dbenv->set_errfile(stderr); + dbenv->set_errpfx(fullhome->home); + } + + /* + * Mask off flags we ignore + */ + newflags = (flags & ~DB_SERVER_FLAGMASK); + shareflags = (newflags & DB_SERVER_ENVFLAGS); + /* + * Check now whether we can share a handle for this env. + */ + replyp->envcl_id = dbenvcl_id; + if ((new_ctp = __dbsrv_shareenv(dbenv_ctp, fullhome, shareflags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing env ID %ld\n", new_ctp->ct_id); + replyp->envcl_id = new_ctp->ct_id; + ret = __dbenv_close_int(dbenvcl_id, 0, 0); + } else { + ret = dbenv->open(fullhome->home, newflags, mode); + dbenv_ctp->ct_envdp.home = fullhome; + dbenv_ctp->ct_envdp.envflags = shareflags; + } +out: replyp->status = ret; + return; +} + +/* BEGIN __env_remove_proc */ +extern "C" void +__env_remove_proc( + long dbenvcl_id, + char *home, + u_int32_t flags, + __env_remove_reply *replyp) +/* END __env_remove_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + fullhome = get_home(home); + if (fullhome == NULL) { + replyp->status = DB_NOSERVER_HOME; + return; + } + + ret = dbenv->remove(fullhome->home, flags); + __dbdel_ctp(dbenv_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_abort_proc */ +extern "C" void +__txn_abort_proc( + long txnpcl_id, + __txn_abort_reply *replyp) +/* END __txn_abort_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->abort(); + __dbdel_ctp(txnp_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_begin_proc */ +extern "C" void +__txn_begin_proc( + long dbenvcl_id, + long parentcl_id, + u_int32_t flags, + __txn_begin_reply *replyp) +/* END __txn_begin_proc */ +{ + DbEnv *dbenv; + DbTxn *parent, *txnp; + ct_entry *ctp, *dbenv_ctp, *parent_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + parent_ctp = NULL; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + + if (parentcl_id != 0) { + ACTIVATE_CTP(parent_ctp, parentcl_id, CT_TXN); + parent = (DbTxn *)parent_ctp->ct_anyp; + ctp->ct_activep = parent_ctp->ct_activep; + } else + parent = NULL; + + ret = dbenv->txn_begin(parent, &txnp, flags); + if (ret == 0) { + ctp->ct_txnp = txnp; + ctp->ct_type = CT_TXN; + ctp->ct_parent = parent_ctp; + ctp->ct_envparent = dbenv_ctp; + replyp->txnidcl_id = ctp->ct_id; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + } else + __dbclear_ctp(ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_commit_proc */ +extern "C" void +__txn_commit_proc( + long txnpcl_id, + u_int32_t flags, + __txn_commit_reply *replyp) +/* END __txn_commit_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->commit(flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_discard_proc */ +extern "C" void +__txn_discard_proc( + long txnpcl_id, + u_int32_t flags, + __txn_discard_reply *replyp) +/* END __txn_discard_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->discard(flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_prepare_proc */ +extern "C" void +__txn_prepare_proc( + long txnpcl_id, + u_int8_t *gid, + __txn_prepare_reply *replyp) +/* END __txn_prepare_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->prepare(gid); + replyp->status = ret; + return; +} + +/* BEGIN __txn_recover_proc */ +extern "C" void +__txn_recover_proc( + long dbenvcl_id, + u_int32_t count, + u_int32_t flags, + __txn_recover_reply *replyp, + int * freep) +/* END __txn_recover_proc */ +{ + DbEnv *dbenv; + DbPreplist *dbprep, *p; + ct_entry *dbenv_ctp, *ctp; + long erri, i, retcount; + u_int32_t *txnidp; + int ret; + char *gid; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + *freep = 0; + + if ((ret = + __os_malloc(dbenv->get_DB_ENV(), count * sizeof(DbPreplist), &dbprep)) != 0) + goto out; + if ((ret = + dbenv->txn_recover(dbprep, count, &retcount, flags)) != 0) + goto out; + /* + * If there is nothing, success, but it's easy. + */ + replyp->retcount = retcount; // TODO: fix C++ txn_recover + if (retcount == 0) { + replyp->txn.txn_val = NULL; + replyp->txn.txn_len = 0; + replyp->gid.gid_val = NULL; + replyp->gid.gid_len = 0; + } + + /* + * We have our txn list. Now we need to allocate the space for + * the txn ID array and the GID array and set them up. + */ + if ((ret = __os_calloc(dbenv->get_DB_ENV(), retcount, sizeof(u_int32_t), + &replyp->txn.txn_val)) != 0) + goto out; + replyp->txn.txn_len = retcount * sizeof(u_int32_t); + if ((ret = __os_calloc(dbenv->get_DB_ENV(), retcount, DB_XIDDATASIZE, + &replyp->gid.gid_val)) != 0) { + __os_free(dbenv->get_DB_ENV(), replyp->txn.txn_val); + goto out; + } + replyp->gid.gid_len = retcount * DB_XIDDATASIZE; + + /* + * Now walk through our results, creating parallel arrays + * to send back. For each entry we need to create a new + * txn ctp and then fill in the array info. + */ + i = 0; + p = dbprep; + gid = replyp->gid.gid_val; + txnidp = replyp->txn.txn_val; + while (i++ < retcount) { + ctp = new_ct_ent(&ret); + if (ret != 0) { + i--; + goto out2; + } + ctp->ct_txnp = p->txn; + ctp->ct_type = CT_TXN; + ctp->ct_parent = NULL; + ctp->ct_envparent = dbenv_ctp; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + + *txnidp = ctp->ct_id; + memcpy(gid, p->gid, DB_XIDDATASIZE); + + p++; + txnidp++; + gid += DB_XIDDATASIZE; + } + /* + * If we get here, we have success and we have to set freep + * so it'll get properly freed next time. + */ + *freep = 1; +out: + if (dbprep != NULL) + __os_free(dbenv->get_DB_ENV(), dbprep); + replyp->status = ret; + return; +out2: + /* + * We had an error in the middle of creating our new txn + * ct entries. We have to unwind all that we have done. Ugh. + */ + for (txnidp = replyp->txn.txn_val, erri = 0; + erri < i; erri++, txnidp++) { + ctp = get_tableent(*txnidp); + __dbclear_ctp(ctp); + } + __os_free(dbenv->get_DB_ENV(), replyp->txn.txn_val); + __os_free(dbenv->get_DB_ENV(), replyp->gid.gid_val); + __os_free(dbenv->get_DB_ENV(), dbprep); + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_maxkey_proc */ +extern "C" void +__db_bt_maxkey_proc( + long dbpcl_id, + u_int32_t maxkey, + __db_bt_maxkey_reply *replyp) +/* END __db_bt_maxkey_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_maxkey(maxkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_associate_proc */ +extern "C" void +__db_associate_proc( + long dbpcl_id, + long txnpcl_id, + long sdbpcl_id, + u_int32_t flags, + __db_associate_reply *replyp) +/* END __db_associate_proc */ +{ + Db *dbp, *sdbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *sdbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + ACTIVATE_CTP(sdbp_ctp, sdbpcl_id, CT_DB); + sdbp = (Db *)sdbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + /* + * We do not support DB_CREATE for associate. Users + * can only access secondary indices on a read-only basis, + * so whatever they are looking for needs to be there already. + */ + if (flags != 0) + ret = EINVAL; + else + ret = dbp->associate(txnp, sdbp, NULL, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_minkey_proc */ +extern "C" void +__db_bt_minkey_proc( + long dbpcl_id, + u_int32_t minkey, + __db_bt_minkey_reply *replyp) +/* END __db_bt_minkey_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_minkey(minkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_close_proc */ +extern "C" void +__db_close_proc( + long dbpcl_id, + u_int32_t flags, + __db_close_reply *replyp) +/* END __db_close_proc */ +{ + ct_entry *dbp_ctp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + replyp->status = __db_close_int(dbpcl_id, flags); + return; +} + +/* BEGIN __db_create_proc */ +extern "C" void +__db_create_proc( + long dbenvcl_id, + u_int32_t flags, + __db_create_reply *replyp) +/* END __db_create_proc */ +{ + Db *dbp; + DbEnv *dbenv; + ct_entry *dbenv_ctp, *dbp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + dbp_ctp = new_ct_ent(&replyp->status); + if (dbp_ctp == NULL) + return ; + /* + * We actually require env's for databases. The client should + * have caught it, but just in case. + */ + DB_ASSERT(dbenv != NULL); + dbp = new Db(dbenv, flags); + dbp_ctp->ct_dbp = dbp; + dbp_ctp->ct_type = CT_DB; + dbp_ctp->ct_parent = dbenv_ctp; + dbp_ctp->ct_envparent = dbenv_ctp; + replyp->dbcl_id = dbp_ctp->ct_id; + replyp->status = 0; + return; +} + +/* BEGIN __db_del_proc */ +extern "C" void +__db_del_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t flags, + __db_del_reply *replyp) +/* END __db_del_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + /* Set up key */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(keyflags); + + ret = dbp->del(txnp, &key, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_encrypt_proc */ +extern "C" void +__db_encrypt_proc( + long dbpcl_id, + char *passwd, + u_int32_t flags, + __db_encrypt_reply *replyp) +/* END __db_encrypt_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_encrypt(passwd, flags); + replyp->status = ret; + return; +} + +/* BEGIN __db_extentsize_proc */ +extern "C" void +__db_extentsize_proc( + long dbpcl_id, + u_int32_t extentsize, + __db_extentsize_reply *replyp) +/* END __db_extentsize_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_q_extentsize(extentsize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_flags_proc */ +extern "C" void +__db_flags_proc( + long dbpcl_id, + u_int32_t flags, + __db_flags_reply *replyp) +/* END __db_flags_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_flags(flags); + dbp_ctp->ct_dbdp.setflags = flags; + + replyp->status = ret; + return; +} + +/* BEGIN __db_get_proc */ +extern "C" void +__db_get_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __db_get_reply *replyp, + int * freep) +/* END __db_get_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, bulk_alloc, ret; + void *tmpdata; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + bulk_alloc = 0; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + /* + * Ignore memory related flags on server. + */ + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + /* + * Ignore memory related flags on server. + */ + dataflags &= DB_DBT_PARTIAL; + if (flags & DB_MULTIPLE) { + if (data.get_data() == 0) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + dataulen, &tmpdata); + if (ret != 0) + goto err; + data.set_data(tmpdata); + bulk_alloc = 1; + } + dataflags |= DB_DBT_USERMEM; + } else + dataflags |= DB_DBT_MALLOC; + data.set_flags(dataflags); + + /* Got all our stuff, now do the get */ + ret = dbp->get(txnp, &key, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.get_data() == keydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + key.get_size(), &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, key.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.get_data(), key.get_size()); + } else + replyp->keydata.keydata_val = (char *)key.get_data(); + + replyp->keydata.keydata_len = key.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + data.get_size(), &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, key.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + if (key_alloc) + __os_ufree(dbp->get_DB()->dbenv, + replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + } + replyp->status = ret; + return; +} + +/* BEGIN __db_h_ffactor_proc */ +extern "C" void +__db_h_ffactor_proc( + long dbpcl_id, + u_int32_t ffactor, + __db_h_ffactor_reply *replyp) +/* END __db_h_ffactor_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_ffactor(ffactor); + + replyp->status = ret; + return; +} + +/* BEGIN __db_h_nelem_proc */ +extern "C" void +__db_h_nelem_proc( + long dbpcl_id, + u_int32_t nelem, + __db_h_nelem_reply *replyp) +/* END __db_h_nelem_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_nelem(nelem); + + replyp->status = ret; + return; +} + +/* BEGIN __db_key_range_proc */ +extern "C" void +__db_key_range_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t flags, + __db_key_range_reply *replyp) +/* END __db_key_range_proc */ +{ + Db *dbp; + DB_KEY_RANGE range; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + /* Set up key */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(keyflags); + + ret = dbp->key_range(txnp, &key, &range, flags); + + replyp->status = ret; + replyp->less = range.less; + replyp->equal = range.equal; + replyp->greater = range.greater; + return; +} + +/* BEGIN __db_lorder_proc */ +extern "C" void +__db_lorder_proc( + long dbpcl_id, + u_int32_t lorder, + __db_lorder_reply *replyp) +/* END __db_lorder_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_lorder(lorder); + + replyp->status = ret; + return; +} + +/* BEGIN __db_open_proc */ +extern "C" void +__db_open_proc( + long dbpcl_id, + long txnpcl_id, + char *name, + char *subdb, + u_int32_t type, + u_int32_t flags, + u_int32_t mode, + __db_open_reply *replyp) +/* END __db_open_proc */ +{ + Db *dbp; + DbTxn *txnp; + DBTYPE dbtype; + ct_entry *dbp_ctp, *new_ctp, *txnp_ctp; + int isswapped, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + replyp->dbcl_id = dbpcl_id; + if ((new_ctp = __dbsrv_sharedb(dbp_ctp, name, subdb, (DBTYPE)type, flags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing db ID %ld\n", new_ctp->ct_id); + replyp->dbcl_id = new_ctp->ct_id; + ret = __db_close_int(dbpcl_id, 0); + goto out; + } + ret = dbp->open(txnp, name, subdb, (DBTYPE)type, flags, mode); + if (ret == 0) { + (void)dbp->get_type(&dbtype); + replyp->type = dbtype; + /* XXX + * Tcl needs to peek at dbp->flags for DB_AM_DUP. Send + * this dbp's flags back. + */ + replyp->dbflags = (int) dbp->get_DB()->flags; + /* + * We need to determine the byte order of the database + * and send it back to the client. Determine it by + * the server's native order and the swapped value of + * the DB itself. + */ + (void)dbp->get_byteswapped(&isswapped); + if (__db_byteorder(NULL, 1234) == 0) { + if (isswapped == 0) + replyp->lorder = 1234; + else + replyp->lorder = 4321; + } else { + if (isswapped == 0) + replyp->lorder = 4321; + else + replyp->lorder = 1234; + } + dbp_ctp->ct_dbdp.type = dbtype; + dbp_ctp->ct_dbdp.dbflags = LF_ISSET(DB_SERVER_DBFLAGS); + if (name == NULL) + dbp_ctp->ct_dbdp.db = NULL; + else if ((ret = __os_strdup(dbp->get_DB()->dbenv, name, + &dbp_ctp->ct_dbdp.db)) != 0) + goto out; + if (subdb == NULL) + dbp_ctp->ct_dbdp.subdb = NULL; + else if ((ret = __os_strdup(dbp->get_DB()->dbenv, subdb, + &dbp_ctp->ct_dbdp.subdb)) != 0) + goto out; + } +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_pagesize_proc */ +extern "C" void +__db_pagesize_proc( + long dbpcl_id, + u_int32_t pagesize, + __db_pagesize_reply *replyp) +/* END __db_pagesize_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_pagesize(pagesize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_pget_proc */ +extern "C" void +__db_pget_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t skeydlen, + u_int32_t skeydoff, + u_int32_t skeyulen, + u_int32_t skeyflags, + void *skeydata, + u_int32_t skeysize, + u_int32_t pkeydlen, + u_int32_t pkeydoff, + u_int32_t pkeyulen, + u_int32_t pkeyflags, + void *pkeydata, + u_int32_t pkeysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __db_pget_reply *replyp, + int * freep) +/* END __db_pget_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data */ + Dbt skey(skeydata, skeysize); + skey.set_dlen(skeydlen); + skey.set_ulen(skeyulen); + skey.set_doff(skeydoff); + skey.set_flags(DB_DBT_MALLOC | (skeyflags & DB_DBT_PARTIAL)); + + Dbt pkey(pkeydata, pkeysize); + pkey.set_dlen(pkeydlen); + pkey.set_ulen(pkeyulen); + pkey.set_doff(pkeydoff); + pkey.set_flags(DB_DBT_MALLOC | (pkeyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(DB_DBT_MALLOC | (dataflags & DB_DBT_PARTIAL)); + + /* Got all our stuff, now do the get */ + ret = dbp->pget(txnp, &skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.get_data() == skeydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + skey.get_size(), &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, skey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, pkey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.get_data(), + skey.get_size()); + } else + replyp->skeydata.skeydata_val = (char *)skey.get_data(); + + replyp->skeydata.skeydata_len = skey.get_size(); + + /* + * Primary key + */ + if (pkey.get_data() == pkeydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + pkey.get_size(), &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, skey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, pkey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + if (key_alloc) + __os_ufree(dbp->get_DB()->dbenv, + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.get_data(), + pkey.get_size()); + } else + replyp->pkeydata.pkeydata_val = (char *)pkey.get_data(); + replyp->pkeydata.pkeydata_len = pkey.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + data.get_size(), &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, skey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, pkey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbp->get_DB()->dbenv, + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbp->get_DB()->dbenv, + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_put_proc */ +extern "C" void +__db_put_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __db_put_reply *replyp, + int * freep) +/* END __db_put_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(dataflags); + + /* Got all our stuff, now do the put */ + ret = dbp->put(txnp, &key, &data, flags); + /* + * If the client did a DB_APPEND, set up key in reply. + * Otherwise just status. + */ + if (ret == 0 && (flags == DB_APPEND)) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + if (key.get_data() == keydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + key.get_size(), &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, key.get_data()); + goto err; + } + memcpy(replyp->keydata.keydata_val, key.get_data(), key.get_size()); + } else + replyp->keydata.keydata_val = (char *)key.get_data(); + + replyp->keydata.keydata_len = key.get_size(); + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_re_delim_proc */ +extern "C" void +__db_re_delim_proc( + long dbpcl_id, + u_int32_t delim, + __db_re_delim_reply *replyp) +/* END __db_re_delim_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_delim(delim); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_len_proc */ +extern "C" void +__db_re_len_proc( + long dbpcl_id, + u_int32_t len, + __db_re_len_reply *replyp) +/* END __db_re_len_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_len(len); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_pad_proc */ +extern "C" void +__db_re_pad_proc( + long dbpcl_id, + u_int32_t pad, + __db_re_pad_reply *replyp) +/* END __db_re_pad_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_pad(pad); + + replyp->status = ret; + return; +} + +/* BEGIN __db_remove_proc */ +extern "C" void +__db_remove_proc( + long dbpcl_id, + char *name, + char *subdb, + u_int32_t flags, + __db_remove_reply *replyp) +/* END __db_remove_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->remove(name, subdb, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_rename_proc */ +extern "C" void +__db_rename_proc( + long dbpcl_id, + char *name, + char *subdb, + char *newname, + u_int32_t flags, + __db_rename_reply *replyp) +/* END __db_rename_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->rename(name, subdb, newname, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_stat_proc */ +extern "C" void +__db_stat_proc( + long dbpcl_id, + u_int32_t flags, + __db_stat_reply *replyp, + int * freep) +/* END __db_stat_proc */ +{ + Db *dbp; + DBTYPE type; + ct_entry *dbp_ctp; + u_int32_t *q, *p, *retsp; + int i, len, ret; + void *sp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->stat(&sp, flags); + replyp->status = ret; + if (ret != 0) + return; + /* + * We get here, we have success. Allocate an array so that + * we can use the list generator. Generate the reply, free + * up the space. + */ + /* + * XXX This assumes that all elements of all stat structures + * are u_int32_t fields. They are, currently. + */ + (void)dbp->get_type(&type); + if (type == DB_HASH) + len = sizeof(DB_HASH_STAT); + else if (type == DB_QUEUE) + len = sizeof(DB_QUEUE_STAT); + else /* BTREE or RECNO are same stats */ + len = sizeof(DB_BTREE_STAT); + replyp->stats.stats_len = len / sizeof(u_int32_t); + + if ((ret = __os_umalloc(dbp->get_DB()->dbenv, + len * replyp->stats.stats_len, &retsp)) != 0) + goto out; + for (i = 0, q = retsp, p = (u_int32_t *)sp; i < len; + i++, q++, p++) + *q = *p; + replyp->stats.stats_val = retsp; + __os_ufree(dbp->get_DB()->dbenv, sp); + if (ret == 0) + *freep = 1; +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_sync_proc */ +extern "C" void +__db_sync_proc( + long dbpcl_id, + u_int32_t flags, + __db_sync_reply *replyp) +/* END __db_sync_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->sync(flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_truncate_proc */ +extern "C" void +__db_truncate_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t flags, + __db_truncate_reply *replyp) +/* END __db_truncate_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + u_int32_t count; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbp->truncate(txnp, &count, flags); + replyp->status = ret; + if (ret == 0) + replyp->count = count; + return; +} + +/* BEGIN __db_cursor_proc */ +extern "C" void +__db_cursor_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t flags, + __db_cursor_reply *replyp) +/* END __db_cursor_proc */ +{ + Db *dbp; + Dbc *dbc; + DbTxn *txnp; + ct_entry *dbc_ctp, *env_ctp, *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + dbc_ctp->ct_activep = txnp_ctp->ct_activep; + } else + txnp = NULL; + + if ((ret = dbp->cursor(txnp, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = CT_CURSOR; + dbc_ctp->ct_parent = dbp_ctp; + env_ctp = dbp_ctp->ct_envparent; + dbc_ctp->ct_envparent = env_ctp; + __dbsrv_settimeout(dbc_ctp, env_ctp->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else + __dbclear_ctp(dbc_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_join_proc */ +extern "C" void +__db_join_proc( + long dbpcl_id, + u_int32_t *curs, + u_int32_t curslen, + u_int32_t flags, + __db_join_reply *replyp) +/* END __db_join_proc */ +{ + Db *dbp; + Dbc **jcurs, **c; + Dbc *dbc; + ct_entry *dbc_ctp, *ctp, *dbp_ctp; + size_t size; + u_int32_t *cl, i; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + size = (curslen + 1) * sizeof(Dbc *); + if ((ret = __os_calloc(dbp->get_DB()->dbenv, + curslen + 1, sizeof(Dbc *), &jcurs)) != 0) { + replyp->status = ret; + __dbclear_ctp(dbc_ctp); + return; + } + /* + * If our curslist has a parent txn, we need to use it too + * for the activity timeout. All cursors must be part of + * the same transaction, so just check the first. + */ + ctp = get_tableent(*curs); + DB_ASSERT(ctp->ct_type == CT_CURSOR); + /* + * If we are using a transaction, set the join activity timer + * to point to the parent transaction. + */ + if (ctp->ct_activep != &ctp->ct_active) + dbc_ctp->ct_activep = ctp->ct_activep; + for (i = 0, cl = curs, c = jcurs; i < curslen; i++, cl++, c++) { + ctp = get_tableent(*cl); + if (ctp == NULL) { + replyp->status = DB_NOSERVER_ID; + goto out; + } + /* + * If we are using a txn, the join cursor points to the + * transaction timeout. If we are not using a transaction, + * then all the curslist cursors must point to the join + * cursor's timeout so that we do not timeout any of the + * curlist cursors while the join cursor is active. + * Change the type of the curslist ctps to CT_JOIN so that + * we know they are part of a join list and we can distinguish + * them and later restore them when the join cursor is closed. + */ + DB_ASSERT(ctp->ct_type == CT_CURSOR); + ctp->ct_type |= CT_JOIN; + ctp->ct_origp = ctp->ct_activep; + /* + * Setting this to the ct_active field of the dbc_ctp is + * really just a way to distinguish which join dbc this + * cursor is part of. The ct_activep of this cursor is + * not used at all during its lifetime as part of a join + * cursor. + */ + ctp->ct_activep = &dbc_ctp->ct_active; + *c = ctp->ct_dbc; + } + *c = NULL; + if ((ret = dbp->join(jcurs, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = (CT_JOINCUR | CT_CURSOR); + dbc_ctp->ct_parent = dbp_ctp; + dbc_ctp->ct_envparent = dbp_ctp->ct_envparent; + __dbsrv_settimeout(dbc_ctp, dbp_ctp->ct_envparent->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else { + __dbclear_ctp(dbc_ctp); + /* + * If we get an error, undo what we did above to any cursors. + */ + for (cl = curs; *cl != 0; cl++) { + ctp = get_tableent(*cl); + ctp->ct_type = CT_CURSOR; + ctp->ct_activep = ctp->ct_origp; + } + } + + replyp->status = ret; +out: + __os_free(dbp->get_DB()->dbenv, jcurs); + return; +} + +/* BEGIN __dbc_close_proc */ +extern "C" void +__dbc_close_proc( + long dbccl_id, + __dbc_close_reply *replyp) +/* END __dbc_close_proc */ +{ + ct_entry *dbc_ctp; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + replyp->status = __dbc_close_int(dbc_ctp); + return; +} + +/* BEGIN __dbc_count_proc */ +extern "C" void +__dbc_count_proc( + long dbccl_id, + u_int32_t flags, + __dbc_count_reply *replyp) +/* END __dbc_count_proc */ +{ + Dbc *dbc; + ct_entry *dbc_ctp; + db_recno_t num; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + + ret = dbc->count(&num, flags); + replyp->status = ret; + if (ret == 0) + replyp->dupcount = num; + return; +} + +/* BEGIN __dbc_del_proc */ +extern "C" void +__dbc_del_proc( + long dbccl_id, + u_int32_t flags, + __dbc_del_reply *replyp) +/* END __dbc_del_proc */ +{ + Dbc *dbc; + ct_entry *dbc_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + + ret = dbc->del(flags); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_dup_proc */ +extern "C" void +__dbc_dup_proc( + long dbccl_id, + u_int32_t flags, + __dbc_dup_reply *replyp) +/* END __dbc_dup_proc */ +{ + Dbc *dbc, *newdbc; + ct_entry *dbc_ctp, *new_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + + new_ctp = new_ct_ent(&replyp->status); + if (new_ctp == NULL) + return; + + if ((ret = dbc->dup(&newdbc, flags)) == 0) { + new_ctp->ct_dbc = newdbc; + new_ctp->ct_type = CT_CURSOR; + new_ctp->ct_parent = dbc_ctp->ct_parent; + new_ctp->ct_envparent = dbc_ctp->ct_envparent; + /* + * If our cursor has a parent txn, we need to use it too. + */ + if (dbc_ctp->ct_activep != &dbc_ctp->ct_active) + new_ctp->ct_activep = dbc_ctp->ct_activep; + __dbsrv_settimeout(new_ctp, dbc_ctp->ct_timeout); + __dbsrv_active(new_ctp); + replyp->dbcidcl_id = new_ctp->ct_id; + } else + __dbclear_ctp(new_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_get_proc */ +extern "C" void +__dbc_get_proc( + long dbccl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __dbc_get_reply *replyp, + int * freep) +/* END __dbc_get_proc */ +{ + Dbc *dbc; + DbEnv *dbenv; + ct_entry *dbc_ctp; + int key_alloc, bulk_alloc, ret; + void *tmpdata; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + dbenv = DbEnv::get_DbEnv(((DBC *)dbc)->dbp->dbenv); + + *freep = 0; + bulk_alloc = 0; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + dataflags &= DB_DBT_PARTIAL; + if (flags & DB_MULTIPLE || flags & DB_MULTIPLE_KEY) { + if (data.get_data() == NULL) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + data.get_ulen(), &tmpdata); + if (ret != 0) + goto err; + data.set_data(tmpdata); + bulk_alloc = 1; + } + dataflags |= DB_DBT_USERMEM; + } else + dataflags |= DB_DBT_MALLOC; + data.set_flags(dataflags); + + /* Got all our stuff, now do the get */ + ret = dbc->get(&key, &data, flags); + + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.get_data() == keydata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), key.get_size(), + &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), key.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.get_data(), key.get_size()); + } else + replyp->keydata.keydata_val = (char *)key.get_data(); + + replyp->keydata.keydata_len = key.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), data.get_size(), + &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), key.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + if (key_alloc) + __os_ufree(dbenv->get_DB_ENV(), + replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_pget_proc */ +extern "C" void +__dbc_pget_proc( + long dbccl_id, + u_int32_t skeydlen, + u_int32_t skeydoff, + u_int32_t skeyulen, + u_int32_t skeyflags, + void *skeydata, + u_int32_t skeysize, + u_int32_t pkeydlen, + u_int32_t pkeydoff, + u_int32_t pkeyulen, + u_int32_t pkeyflags, + void *pkeydata, + u_int32_t pkeysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __dbc_pget_reply *replyp, + int * freep) +/* END __dbc_pget_proc */ +{ + Dbc *dbc; + DbEnv *dbenv; + ct_entry *dbc_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + dbenv = DbEnv::get_DbEnv(((DBC *)dbc)->dbp->dbenv); + + *freep = 0; + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data */ + Dbt skey(skeydata, skeysize); + skey.set_dlen(skeydlen); + skey.set_ulen(skeyulen); + skey.set_doff(skeydoff); + skey.set_flags(DB_DBT_MALLOC | (skeyflags & DB_DBT_PARTIAL)); + + Dbt pkey(pkeydata, pkeysize); + pkey.set_dlen(pkeydlen); + pkey.set_ulen(pkeyulen); + pkey.set_doff(pkeydoff); + pkey.set_flags(DB_DBT_MALLOC | (pkeyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(DB_DBT_MALLOC | (dataflags & DB_DBT_PARTIAL)); + + /* Got all our stuff, now do the get */ + ret = dbc->pget(&skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.get_data() == skeydata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + skey.get_size(), &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), skey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), pkey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.get_data(), + skey.get_size()); + } else + replyp->skeydata.skeydata_val = (char *)skey.get_data(); + replyp->skeydata.skeydata_len = skey.get_size(); + + /* + * Primary key + */ + if (pkey.get_data() == pkeydata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + pkey.get_size(), &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), skey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), pkey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + if (key_alloc) + __os_ufree(dbenv->get_DB_ENV(), + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.get_data(), + pkey.get_size()); + } else + replyp->pkeydata.pkeydata_val = (char *)pkey.get_data(); + replyp->pkeydata.pkeydata_len = pkey.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + data.get_size(), &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), skey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), pkey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbenv->get_DB_ENV(), + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbenv->get_DB_ENV(), + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_put_proc */ +extern "C" void +__dbc_put_proc( + long dbccl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __dbc_put_reply *replyp, + int * freep) +/* END __dbc_put_proc */ +{ + Db *dbp; + Dbc *dbc; + ct_entry *dbc_ctp; + int ret; + DBTYPE dbtype; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + dbp = (Db *)dbc_ctp->ct_parent->ct_anyp; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + /* + * Ignore memory related flags on server. + */ + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(dataflags); + + /* Got all our stuff, now do the put */ + ret = dbc->put(&key, &data, flags); + + *freep = 0; + replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + if (ret == 0 && (flags == DB_AFTER || flags == DB_BEFORE)) { + ret = dbp->get_type(&dbtype); + if (ret == 0 && dbtype == DB_RECNO) { + /* + * We need to xdr_free whatever we are returning, next time. + */ + replyp->keydata.keydata_val = (char *)key.get_data(); + replyp->keydata.keydata_len = key.get_size(); + } + } + replyp->status = ret; + return; +} +#endif /* HAVE_RPC */ diff --git a/db/rpc_server/cxx/db_server_cxxutil.cpp b/db/rpc_server/cxx/db_server_cxxutil.cpp new file mode 100644 index 000000000..404440d48 --- /dev/null +++ b/db/rpc_server/cxx/db_server_cxxutil.cpp @@ -0,0 +1,746 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_server_cxxutil.cpp,v 1.8 2002/05/23 07:49:34 mjc Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#if TIME_WITH_SYS_TIME +#include <sys/time.h> +#include <time.h> +#else +#if HAVE_SYS_TIME_H +#include <sys/time.h> +#else +#include <time.h> +#endif +#endif + +#include <rpc/rpc.h> + +#include <limits.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "db_cxx.h" +#include "dbinc_auto/clib_ext.h" + +extern "C" { +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" +#include "dbinc_auto/common_ext.h" + +extern int __dbsrv_main __P((void)); +} + +static int add_home __P((char *)); +static int add_passwd __P((char *)); +static int env_recover __P((char *)); +static void __dbclear_child __P((ct_entry *)); + +static LIST_HEAD(cthead, ct_entry) __dbsrv_head; +static LIST_HEAD(homehead, home_entry) __dbsrv_home; +static long __dbsrv_defto = DB_SERVER_TIMEOUT; +static long __dbsrv_maxto = DB_SERVER_MAXTIMEOUT; +static long __dbsrv_idleto = DB_SERVER_IDLETIMEOUT; +static char *logfile = NULL; +static char *prog; + +static void usage __P((char *)); +static void version_check __P((void)); + +int __dbsrv_verbose = 0; + +int +main( + int argc, + char **argv) +{ + extern char *optarg; + CLIENT *cl; + int ch, ret; + char *passwd; + + prog = argv[0]; + + version_check(); + + /* + * Check whether another server is running or not. There + * is a race condition where two servers could be racing to + * register with the portmapper. The goal of this check is to + * forbid running additional servers (like those started from + * the test suite) if the user is already running one. + * + * XXX + * This does not solve nor prevent two servers from being + * started at the same time and running recovery at the same + * time on the same environments. + */ + if ((cl = clnt_create("localhost", + DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, "tcp")) != NULL) { + fprintf(stderr, + "%s: Berkeley DB RPC server already running.\n", prog); + clnt_destroy(cl); + return (EXIT_FAILURE); + } + + LIST_INIT(&__dbsrv_home); + while ((ch = getopt(argc, argv, "h:I:L:P:t:T:Vv")) != EOF) + switch (ch) { + case 'h': + (void)add_home(optarg); + break; + case 'I': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_idleto)) + return (EXIT_FAILURE); + break; + case 'L': + logfile = optarg; + break; + case 'P': + passwd = strdup(optarg); + memset(optarg, 0, strlen(optarg)); + if (passwd == NULL) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(errno)); + return (EXIT_FAILURE); + } + if ((ret = add_passwd(passwd)) != 0) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(ret)); + return (EXIT_FAILURE); + } + break; + case 't': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_defto)) + return (EXIT_FAILURE); + break; + case 'T': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_maxto)) + return (EXIT_FAILURE); + break; + case 'V': + printf("%s\n", db_version(NULL, NULL, NULL)); + return (EXIT_SUCCESS); + case 'v': + __dbsrv_verbose = 1; + break; + default: + usage(prog); + } + /* + * Check default timeout against maximum timeout + */ + if (__dbsrv_defto > __dbsrv_maxto) + __dbsrv_defto = __dbsrv_maxto; + + /* + * Check default timeout against idle timeout + * It would be bad to timeout environments sooner than txns. + */ + if (__dbsrv_defto > __dbsrv_idleto) + fprintf(stderr, + "%s: WARNING: Idle timeout %ld is less than resource timeout %ld\n", + prog, __dbsrv_idleto, __dbsrv_defto); + + LIST_INIT(&__dbsrv_head); + + /* + * If a client crashes during an RPC, our reply to it + * generates a SIGPIPE. Ignore SIGPIPE so we don't exit unnecessarily. + */ +#ifdef SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif + + if (logfile != NULL && __db_util_logset("berkeley_db_svc", logfile)) + return (EXIT_FAILURE); + + /* + * Now that we are ready to start, run recovery on all the + * environments specified. + */ + if (env_recover(prog) != 0) + return (EXIT_FAILURE); + + /* + * We've done our setup, now call the generated server loop + */ + if (__dbsrv_verbose) + printf("%s: Ready to receive requests\n", prog); + __dbsrv_main(); + + /* NOTREACHED */ + abort(); +} + +static void +usage(char *prog) +{ + fprintf(stderr, "usage: %s %s\n\t%s\n", prog, + "[-Vv] [-h home] [-P passwd]", + "[-I idletimeout] [-L logfile] [-t def_timeout] [-T maxtimeout]"); + exit(EXIT_FAILURE); +} + +static void +version_check() +{ + int v_major, v_minor, v_patch; + + /* Make sure we're loaded with the right version of the DB library. */ + (void)db_version(&v_major, &v_minor, &v_patch); + if (v_major != DB_VERSION_MAJOR || + v_minor != DB_VERSION_MINOR || v_patch != DB_VERSION_PATCH) { + fprintf(stderr, + "%s: version %d.%d.%d doesn't match library version %d.%d.%d\n", + prog, DB_VERSION_MAJOR, DB_VERSION_MINOR, + DB_VERSION_PATCH, v_major, v_minor, v_patch); + exit(EXIT_FAILURE); + } +} + +extern "C" void +__dbsrv_settimeout( + ct_entry *ctp, + u_int32_t to) +{ + if (to > (u_int32_t)__dbsrv_maxto) + ctp->ct_timeout = __dbsrv_maxto; + else if (to <= 0) + ctp->ct_timeout = __dbsrv_defto; + else + ctp->ct_timeout = to; +} + +extern "C" void +__dbsrv_timeout(int force) +{ + static long to_hint = -1; + time_t t; + long to; + ct_entry *ctp, *nextctp; + + if ((t = time(NULL)) == -1) + return; + + /* + * Check hint. If hint is further in the future + * than now, no work to do. + */ + if (!force && to_hint > 0 && t < to_hint) + return; + to_hint = -1; + /* + * Timeout transactions or cursors holding DB resources. + * Do this before timing out envs to properly release resources. + * + * !!! + * We can just loop through this list looking for cursors and txns. + * We do not need to verify txn and cursor relationships at this + * point because we maintain the list in LIFO order *and* we + * maintain activity in the ultimate txn parent of any cursor + * so either everything in a txn is timing out, or nothing. + * So, since we are LIFO, we will correctly close/abort all the + * appropriate handles, in the correct order. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + switch (ctp->ct_type) { + case CT_TXN: + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out txn id %ld\n", + ctp->ct_id); + (void)((DbTxn *)ctp->ct_anyp)->abort(); + __dbdel_ctp(ctp); + /* + * If we timed out an txn, we may have closed + * all sorts of ctp's. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + case CT_CURSOR: + case (CT_JOINCUR | CT_CURSOR): + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out cursor %ld\n", + ctp->ct_id); + (void)__dbc_close_int(ctp); + /* + * Start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + default: + break; + } + } + /* + * Timeout idle handles. + * If we are forcing a timeout, we'll close all env handles. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type != CT_ENV) + continue; + to = *(ctp->ct_activep) + ctp->ct_idle; + /* TIMEOUT */ + if (to < t || force) { + if (__dbsrv_verbose) + printf("Timing out env id %ld\n", ctp->ct_id); + (void)__dbenv_close_int(ctp->ct_id, 0, 1); + /* + * If we timed out an env, we may have closed + * all sorts of ctp's (maybe even all of them. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } + } +} + +/* + * RECURSIVE FUNCTION. We need to clear/free any number of levels of nested + * layers. + */ +static void +__dbclear_child(ct_entry *parent) +{ + ct_entry *ctp, *nextctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type == 0) + continue; + if (ctp->ct_parent == parent) { + __dbclear_child(ctp); + /* + * Need to do this here because le_next may + * have changed with the recursive call and we + * don't want to point to a removed entry. + */ + nextctp = LIST_NEXT(ctp, entries); + __dbclear_ctp(ctp); + } + } +} + +extern "C" void +__dbclear_ctp(ct_entry *ctp) +{ + LIST_REMOVE(ctp, entries); + __os_free(NULL, ctp); +} + +extern "C" void +__dbdel_ctp(ct_entry *parent) +{ + __dbclear_child(parent); + __dbclear_ctp(parent); +} + +extern "C" ct_entry * +new_ct_ent(int *errp) +{ + time_t t; + ct_entry *ctp, *octp; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(ct_entry), &ctp)) != 0) { + *errp = ret; + return (NULL); + } + memset(ctp, 0, sizeof(ct_entry)); + /* + * Get the time as ID. We may service more than one request per + * second however. If we are, then increment id value until we + * find an unused one. We insert entries in LRU fashion at the + * head of the list. So, if the first entry doesn't match, then + * we know for certain that we can use our entry. + */ + if ((t = time(NULL)) == -1) { + *errp = __os_get_errno(); + __os_free(NULL, ctp); + return (NULL); + } + octp = LIST_FIRST(&__dbsrv_head); + if (octp != NULL && octp->ct_id >= t) + t = octp->ct_id + 1; + ctp->ct_id = t; + ctp->ct_idle = __dbsrv_idleto; + ctp->ct_activep = &ctp->ct_active; + ctp->ct_origp = NULL; + ctp->ct_refcount = 1; + + LIST_INSERT_HEAD(&__dbsrv_head, ctp, entries); + return (ctp); +} + +extern "C" ct_entry * +get_tableent(long id) +{ + ct_entry *ctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) + if (ctp->ct_id == id) + return (ctp); + return (NULL); +} + +extern "C" ct_entry * +__dbsrv_sharedb(ct_entry *db_ctp, const char *name, const char *subdb, DBTYPE type, u_int32_t flags) +{ + ct_entry *ctp; + + /* + * Check if we can share a db handle. Criteria for sharing are: + * If any of the non-sharable flags are set, we cannot share. + * Must be a db ctp, obviously. + * Must share the same env parent. + * Must be the same type, or current one DB_UNKNOWN. + * Must be same byteorder, or current one must not care. + * All flags must match. + * Must be same name, but don't share in-memory databases. + * Must be same subdb name. + */ + if (flags & DB_SERVER_DBNOSHARE) + return (NULL); + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == db_ctp) + continue; + if (ctp->ct_type != CT_DB) + continue; + if (ctp->ct_envparent != db_ctp->ct_envparent) + continue; + if (type != DB_UNKNOWN && ctp->ct_dbdp.type != type) + continue; + if (ctp->ct_dbdp.dbflags != LF_ISSET(DB_SERVER_DBFLAGS)) + continue; + if (db_ctp->ct_dbdp.setflags != 0 && + ctp->ct_dbdp.setflags != db_ctp->ct_dbdp.setflags) + continue; + if (name == NULL || ctp->ct_dbdp.db == NULL || + strcmp(name, ctp->ct_dbdp.db) != 0) + continue; + if (subdb != ctp->ct_dbdp.subdb && + (subdb == NULL || ctp->ct_dbdp.subdb == NULL || + strcmp(subdb, ctp->ct_dbdp.subdb) != 0)) + continue; + /* + * If we get here, then we match. + */ + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +extern "C" ct_entry * +__dbsrv_shareenv(ct_entry *env_ctp, home_entry *home, u_int32_t flags) +{ + ct_entry *ctp; + + /* + * Check if we can share an env. Criteria for sharing are: + * Must be an env ctp, obviously. + * Must share the same home env. + * All flags must match. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == env_ctp) + continue; + if (ctp->ct_type != CT_ENV) + continue; + if (ctp->ct_envdp.home != home) + continue; + if (ctp->ct_envdp.envflags != flags) + continue; + if (ctp->ct_envdp.onflags != env_ctp->ct_envdp.onflags) + continue; + if (ctp->ct_envdp.offflags != env_ctp->ct_envdp.offflags) + continue; + /* + * If we get here, then we match. The only thing left to + * check is the timeout. Since the server timeout set by + * the client is a hint, for sharing we'll give them the + * benefit of the doubt and grant them the longer timeout. + */ + if (ctp->ct_timeout < env_ctp->ct_timeout) + ctp->ct_timeout = env_ctp->ct_timeout; + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +extern "C" void +__dbsrv_active(ct_entry *ctp) +{ + time_t t; + ct_entry *envctp; + + if (ctp == NULL) + return; + if ((t = time(NULL)) == -1) + return; + *(ctp->ct_activep) = t; + if ((envctp = ctp->ct_envparent) == NULL) + return; + *(envctp->ct_activep) = t; + return; +} + +extern "C" int +__db_close_int(long id, u_int32_t flags) +{ + Db *dbp; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_DB); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing dbp id %ld, refcount %d\n", + id, ctp->ct_refcount); + if (--ctp->ct_refcount != 0) + return (ret); + dbp = ctp->ct_dbp; + if (__dbsrv_verbose) + printf("Closing dbp id %ld\n", id); + + ret = dbp->close(flags); + __dbdel_ctp(ctp); + return (ret); +} + +extern "C" int +__dbc_close_int(ct_entry *dbc_ctp) +{ + Dbc *dbc; + int ret; + ct_entry *ctp; + + dbc = (Dbc *)dbc_ctp->ct_anyp; + + ret = dbc->close(); + /* + * If this cursor is a join cursor then we need to fix up the + * cursors that it was joined from so that they are independent again. + */ + if (dbc_ctp->ct_type & CT_JOINCUR) + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Test if it is a join cursor, and if it is part + * of this one. + */ + if ((ctp->ct_type & CT_JOIN) && + ctp->ct_activep == &dbc_ctp->ct_active) { + ctp->ct_type &= ~CT_JOIN; + ctp->ct_activep = ctp->ct_origp; + __dbsrv_active(ctp); + } + } + __dbclear_ctp(dbc_ctp); + return (ret); + +} + +extern "C" int +__dbenv_close_int(long id, u_int32_t flags, int force) +{ + DbEnv *dbenv; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_ENV); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing env id %ld, refcount %d\n", + id, ctp->ct_refcount); + /* + * If we are timing out, we need to force the close, no matter + * what the refcount. + */ + if (--ctp->ct_refcount != 0 && !force) + return (ret); + dbenv = ctp->ct_envp; + if (__dbsrv_verbose) + printf("Closing env id %ld\n", id); + + ret = dbenv->close(flags); + __dbdel_ctp(ctp); + return (ret); +} + +static int +add_home(char *home) +{ + home_entry *hp, *homep; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(home_entry), &hp)) != 0) + return (ret); + if ((ret = __os_malloc(NULL, strlen(home)+1, &hp->home)) != 0) + return (ret); + memcpy(hp->home, home, strlen(home)+1); + hp->dir = home; + hp->passwd = NULL; + /* + * This loop is to remove any trailing path separators, + * to assure hp->name points to the last component. + */ + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + while (*(hp->name) == '\0') { + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + } + /* + * Now we have successfully added it. Make sure there are no + * identical names. + */ + for (homep = LIST_FIRST(&__dbsrv_home); homep != NULL; + homep = LIST_NEXT(homep, entries)) + if (strcmp(homep->name, hp->name) == 0) { + printf("Already added home name %s, at directory %s\n", + hp->name, homep->dir); + return (-1); + } + LIST_INSERT_HEAD(&__dbsrv_home, hp, entries); + if (__dbsrv_verbose) + printf("Added home %s in dir %s\n", hp->name, hp->dir); + return (0); +} + +static int +add_passwd(char *passwd) +{ + home_entry *hp; + + /* + * We add the passwd to the last given home dir. If there + * isn't a home dir, or the most recent one already has a + * passwd, then there is a user error. + */ + hp = LIST_FIRST(&__dbsrv_home); + if (hp == NULL || hp->passwd != NULL) + return (EINVAL); + /* + * We've already strdup'ed the passwd above, so we don't need + * to malloc new space, just point to it. + */ + hp->passwd = passwd; + return (0); +} + +extern "C" home_entry * +get_home(char *name) +{ + home_entry *hp; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) + if (strcmp(name, hp->name) == 0) + return (hp); + return (NULL); +} + +static int +env_recover(char *progname) +{ + DbEnv *dbenv; + home_entry *hp; + u_int32_t flags; + int exitval, ret; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) { + exitval = 0; + dbenv = new DbEnv(DB_CXX_NO_EXCEPTIONS); + if (__dbsrv_verbose == 1) { + (void)dbenv->set_verbose(DB_VERB_RECOVERY, 1); + (void)dbenv->set_verbose(DB_VERB_CHKPOINT, 1); + } + dbenv->set_errfile(stderr); + dbenv->set_errpfx(progname); + if (hp->passwd != NULL) + (void)dbenv->set_encrypt(hp->passwd, DB_ENCRYPT_AES); + + /* + * Initialize the env with DB_RECOVER. That is all we + * have to do to run recovery. + */ + if (__dbsrv_verbose) + printf("Running recovery on %s\n", hp->home); + flags = DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | + DB_INIT_TXN | DB_USE_ENVIRON | DB_RECOVER; + if ((ret = dbenv->open(hp->home, flags, 0)) != 0) { + dbenv->err(ret, "DbEnv->open"); + goto error; + } + + if (0) { +error: exitval = 1; + } + if ((ret = dbenv->close(0)) != 0) { + exitval = 1; + fprintf(stderr, "%s: dbenv->close: %s\n", + progname, db_strerror(ret)); + } + if (exitval) + return (exitval); + } + return (0); +} diff --git a/db/rpc_server/java/DbDispatcher.java b/db/rpc_server/java/DbDispatcher.java new file mode 100644 index 000000000..a4f93b80c --- /dev/null +++ b/db/rpc_server/java/DbDispatcher.java @@ -0,0 +1,590 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbDispatcher.java,v 1.5 2002/08/09 01:56:08 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import org.acplt.oncrpc.OncRpcException; + +/** + * Dispatcher for RPC messages for the Java RPC server. + * These are hooks that translate between RPC msg/reply structures and + * DB calls, which keeps the real implementation code in Rpc* classes cleaner. + */ +public abstract class DbDispatcher extends DbServerStub +{ + abstract int addEnv(RpcDbEnv rdbenv); + abstract int addDb(RpcDb rdb); + abstract int addTxn(RpcDbTxn rtxn); + abstract int addCursor(RpcDbc rdbc); + abstract void delEnv(RpcDbEnv rdbenv); + abstract void delDb(RpcDb rdb); + abstract void delTxn(RpcDbTxn rtxn); + abstract void delCursor(RpcDbc rdbc); + abstract RpcDbEnv getEnv(int envid); + abstract RpcDb getDb(int dbid); + abstract RpcDbTxn getTxn(int txnbid); + abstract RpcDbc getCursor(int dbcid); + + public DbDispatcher() throws IOException, OncRpcException + { + super(); + } + + //// Db methods + + public __db_associate_reply __DB_db_associate_4001(__db_associate_msg args) + { + __db_associate_reply reply = new __db_associate_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.associate(this, args, reply); + return reply; + } + + public __db_bt_maxkey_reply __DB_db_bt_maxkey_4001(__db_bt_maxkey_msg args) + { + __db_bt_maxkey_reply reply = new __db_bt_maxkey_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_bt_maxkey(this, args, reply); + return reply; + } + + public __db_bt_minkey_reply __DB_db_bt_minkey_4001(__db_bt_minkey_msg args) + { + __db_bt_minkey_reply reply = new __db_bt_minkey_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_bt_minkey(this, args, reply); + return reply; + } + + public __db_close_reply __DB_db_close_4001(__db_close_msg args) + { + __db_close_reply reply = new __db_close_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.close(this, args, reply); + return reply; + } + + public __db_create_reply __DB_db_create_4001(__db_create_msg args) + { + __db_create_reply reply = new __db_create_reply(); + RpcDb rdb = new RpcDb(getEnv(args.dbenvcl_id)); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.create(this, args, reply); + return reply; + } + + public __db_cursor_reply __DB_db_cursor_4001(__db_cursor_msg args) + { + __db_cursor_reply reply = new __db_cursor_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.cursor(this, args, reply); + return reply; + } + + public __db_del_reply __DB_db_del_4001(__db_del_msg args) + { + __db_del_reply reply = new __db_del_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.del(this, args, reply); + return reply; + } + + public __db_encrypt_reply __DB_db_encrypt_4001(__db_encrypt_msg args) + { + __db_encrypt_reply reply = new __db_encrypt_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_encrypt(this, args, reply); + return reply; + } + + public __db_extentsize_reply __DB_db_extentsize_4001(__db_extentsize_msg args) + { + __db_extentsize_reply reply = new __db_extentsize_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_q_extentsize(this, args, reply); + return reply; + } + + public __db_flags_reply __DB_db_flags_4001(__db_flags_msg args) + { + __db_flags_reply reply = new __db_flags_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_flags(this, args, reply); + return reply; + } + + public __db_get_reply __DB_db_get_4001(__db_get_msg args) + { + __db_get_reply reply = new __db_get_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.get(this, args, reply); + return reply; + } + + public __db_h_ffactor_reply __DB_db_h_ffactor_4001(__db_h_ffactor_msg args) + { + __db_h_ffactor_reply reply = new __db_h_ffactor_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_h_ffactor(this, args, reply); + return reply; + } + + public __db_h_nelem_reply __DB_db_h_nelem_4001(__db_h_nelem_msg args) + { + __db_h_nelem_reply reply = new __db_h_nelem_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_h_nelem(this, args, reply); + return reply; + } + + public __db_join_reply __DB_db_join_4001(__db_join_msg args) + { + __db_join_reply reply = new __db_join_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.join(this, args, reply); + return reply; + } + + public __db_key_range_reply __DB_db_key_range_4001(__db_key_range_msg args) + { + __db_key_range_reply reply = new __db_key_range_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.key_range(this, args, reply); + return reply; + } + + public __db_lorder_reply __DB_db_lorder_4001(__db_lorder_msg args) + { + __db_lorder_reply reply = new __db_lorder_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_lorder(this, args, reply); + return reply; + } + + public __db_open_reply __DB_db_open_4001(__db_open_msg args) + { + __db_open_reply reply = new __db_open_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.open(this, args, reply); + return reply; + } + + public __db_pagesize_reply __DB_db_pagesize_4001(__db_pagesize_msg args) + { + __db_pagesize_reply reply = new __db_pagesize_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_pagesize(this, args, reply); + return reply; + } + + public __db_pget_reply __DB_db_pget_4001(__db_pget_msg args) + { + __db_pget_reply reply = new __db_pget_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.pget(this, args, reply); + return reply; + } + + public __db_put_reply __DB_db_put_4001(__db_put_msg args) + { + __db_put_reply reply = new __db_put_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.put(this, args, reply); + return reply; + } + + public __db_remove_reply __DB_db_remove_4001(__db_remove_msg args) + { + __db_remove_reply reply = new __db_remove_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.remove(this, args, reply); + return reply; + } + + public __db_rename_reply __DB_db_rename_4001(__db_rename_msg args) + { + __db_rename_reply reply = new __db_rename_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.rename(this, args, reply); + return reply; + } + + public __db_re_delim_reply __DB_db_re_delim_4001(__db_re_delim_msg args) + { + __db_re_delim_reply reply = new __db_re_delim_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_re_delim(this, args, reply); + return reply; + } + + public __db_re_len_reply __DB_db_re_len_4001(__db_re_len_msg args) + { + __db_re_len_reply reply = new __db_re_len_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_re_len(this, args, reply); + return reply; + } + + public __db_re_pad_reply __DB_db_re_pad_4001(__db_re_pad_msg args) + { + __db_re_pad_reply reply = new __db_re_pad_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_re_pad(this, args, reply); + return reply; + } + + public __db_stat_reply __DB_db_stat_4001(__db_stat_msg args) + { + __db_stat_reply reply = new __db_stat_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.stat(this, args, reply); + return reply; + } + + public __db_sync_reply __DB_db_sync_4001(__db_sync_msg args) + { + __db_sync_reply reply = new __db_sync_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.sync(this, args, reply); + return reply; + } + + public __db_truncate_reply __DB_db_truncate_4001(__db_truncate_msg args) + { + __db_truncate_reply reply = new __db_truncate_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.truncate(this, args, reply); + return reply; + } + + //// Cursor methods + + public __dbc_close_reply __DB_dbc_close_4001(__dbc_close_msg args) + { + __dbc_close_reply reply = new __dbc_close_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.close(this, args, reply); + return reply; + } + + public __dbc_count_reply __DB_dbc_count_4001(__dbc_count_msg args) + { + __dbc_count_reply reply = new __dbc_count_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.count(this, args, reply); + return reply; + } + + public __dbc_del_reply __DB_dbc_del_4001(__dbc_del_msg args) + { + __dbc_del_reply reply = new __dbc_del_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.del(this, args, reply); + return reply; + } + + public __dbc_dup_reply __DB_dbc_dup_4001(__dbc_dup_msg args) + { + __dbc_dup_reply reply = new __dbc_dup_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.dup(this, args, reply); + return reply; + } + + public __dbc_get_reply __DB_dbc_get_4001(__dbc_get_msg args) + { + __dbc_get_reply reply = new __dbc_get_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.get(this, args, reply); + return reply; + } + + public __dbc_pget_reply __DB_dbc_pget_4001(__dbc_pget_msg args) { + __dbc_pget_reply reply = new __dbc_pget_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.pget(this, args, reply); + return reply; + } + + public __dbc_put_reply __DB_dbc_put_4001(__dbc_put_msg args) { + __dbc_put_reply reply = new __dbc_put_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.put(this, args, reply); + return reply; + } + + //// Environment methods + + public __env_cachesize_reply __DB_env_cachesize_4001(__env_cachesize_msg args) + { + __env_cachesize_reply reply = new __env_cachesize_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.set_cachesize(this, args, reply); + return reply; + } + + public __env_close_reply __DB_env_close_4001(__env_close_msg args) + { + __env_close_reply reply = new __env_close_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.close(this, args, reply); + return reply; + } + + public __env_create_reply __DB_env_create_4001(__env_create_msg args) + { + __env_create_reply reply = new __env_create_reply(); + RpcDbEnv rdbenv = new RpcDbEnv(); + rdbenv.create(this, args, reply); + return reply; + } + + public __env_dbremove_reply __DB_env_dbremove_4001(__env_dbremove_msg args) + { + __env_dbremove_reply reply = new __env_dbremove_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.dbremove(this, args, reply); + return reply; + } + + public __env_dbrename_reply __DB_env_dbrename_4001(__env_dbrename_msg args) + { + __env_dbrename_reply reply = new __env_dbrename_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.dbrename(this, args, reply); + return reply; + } + + public __env_encrypt_reply __DB_env_encrypt_4001(__env_encrypt_msg args) + { + __env_encrypt_reply reply = new __env_encrypt_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.set_encrypt(this, args, reply); + return reply; + } + + public __env_flags_reply __DB_env_flags_4001(__env_flags_msg args) + { + __env_flags_reply reply = new __env_flags_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.set_flags(this, args, reply); + return reply; + } + + public __env_open_reply __DB_env_open_4001(__env_open_msg args) + { + __env_open_reply reply = new __env_open_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.open(this, args, reply); + return reply; + } + + public __env_remove_reply __DB_env_remove_4001(__env_remove_msg args) + { + __env_remove_reply reply = new __env_remove_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.remove(this, args, reply); + return reply; + } + + //// Transaction methods + + public __txn_abort_reply __DB_txn_abort_4001(__txn_abort_msg args) + { + __txn_abort_reply reply = new __txn_abort_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.abort(this, args, reply); + return reply; + } + + public __txn_begin_reply __DB_txn_begin_4001(__txn_begin_msg args) + { + __txn_begin_reply reply = new __txn_begin_reply(); + RpcDbTxn rdbtxn = new RpcDbTxn(getEnv(args.dbenvcl_id), null); + rdbtxn.begin(this, args, reply); + return reply; + } + + public __txn_commit_reply __DB_txn_commit_4001(__txn_commit_msg args) + { + __txn_commit_reply reply = new __txn_commit_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.commit(this, args, reply); + return reply; + } + + public __txn_discard_reply __DB_txn_discard_4001(__txn_discard_msg args) + { + __txn_discard_reply reply = new __txn_discard_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.discard(this, args, reply); + return reply; + } + + public __txn_prepare_reply __DB_txn_prepare_4001(__txn_prepare_msg args) + { + __txn_prepare_reply reply = new __txn_prepare_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.prepare(this, args, reply); + return reply; + } + + public __txn_recover_reply __DB_txn_recover_4001(__txn_recover_msg args) + { + __txn_recover_reply reply = new __txn_recover_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.txn_recover(this, args, reply); + return reply; + } +} diff --git a/db/rpc_server/java/DbServer.java b/db/rpc_server/java/DbServer.java new file mode 100644 index 000000000..7e3b1ca0a --- /dev/null +++ b/db/rpc_server/java/DbServer.java @@ -0,0 +1,301 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbServer.java,v 1.5 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.*; +import java.util.*; +import org.acplt.oncrpc.OncRpcException; +import org.acplt.oncrpc.server.OncRpcCallInformation; + +/** + * Main entry point for the Java version of the Berkeley DB RPC server + */ +public class DbServer extends DbDispatcher +{ + public static long idleto = 10 * 60 * 1000; // 5 minutes + public static long defto = 5 * 60 * 1000; // 5 minutes + public static long maxto = 60 * 60 * 1000; // 1 hour + public static String passwd = null; + public static PrintWriter err; + + long now, hint; // updated each operation + FreeList env_list = new FreeList(); + FreeList db_list = new FreeList(); + FreeList txn_list = new FreeList(); + FreeList cursor_list = new FreeList(); + + public DbServer() throws IOException, OncRpcException + { + super(); + init_lists(); + } + + public void dispatchOncRpcCall(OncRpcCallInformation call, int program, + int version, int procedure) throws OncRpcException, IOException + { + long newnow = System.currentTimeMillis(); + // DbServer.err.println("Dispatching RPC call " + procedure + " after delay of " + (newnow - now)); + now = newnow; + // DbServer.err.flush(); + super.dispatchOncRpcCall(call, program, version, procedure); + + try { + doTimeouts(); + } catch(Throwable t) { + System.err.println("Caught " + t + " during doTimeouts()"); + t.printStackTrace(System.err); + } + } + + // Internal methods to track context + private void init_lists() + { + // We do this so that getEnv/Db/etc(0) == null + env_list.add(null); + db_list.add(null); + txn_list.add(null); + cursor_list.add(null); + } + + int addEnv(RpcDbEnv rdbenv) + { + rdbenv.timer.last_access = now; + int id = env_list.add(rdbenv); + return id; + } + + int addDb(RpcDb rdb) + { + int id = db_list.add(rdb); + return id; + } + + int addTxn(RpcDbTxn rtxn) + { + rtxn.timer.last_access = now; + int id = txn_list.add(rtxn); + return id; + } + + int addCursor(RpcDbc rdbc) + { + rdbc.timer.last_access = now; + int id = cursor_list.add(rdbc); + return id; + } + + void delEnv(RpcDbEnv rdbenv) + { + // cursors and transactions will already have been cleaned up + for(LocalIterator i = db_list.iterator(); i.hasNext(); ) { + RpcDb rdb = (RpcDb)i.next(); + if (rdb != null && rdb.rdbenv == rdbenv) + delDb(rdb); + } + + env_list.del(rdbenv); + rdbenv.dispose(); + } + + void delDb(RpcDb rdb) + { + db_list.del(rdb); + rdb.dispose(); + + for(LocalIterator i = cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + if (rdbc != null && rdbc.timer == rdb) + i.remove(); + } + } + + void delTxn(RpcDbTxn rtxn) + { + txn_list.del(rtxn); + rtxn.dispose(); + + for(LocalIterator i = cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + if (rdbc != null && rdbc.timer == rtxn) + i.remove(); + } + + for(LocalIterator i = txn_list.iterator(); i.hasNext(); ) { + RpcDbTxn rtxn_child = (RpcDbTxn)i.next(); + if (rtxn_child != null && rtxn_child.timer == rtxn) + i.remove(); + } + } + + void delCursor(RpcDbc rdbc) + { + cursor_list.del(rdbc); + rdbc.dispose(); + } + + RpcDbEnv getEnv(int envid) + { + RpcDbEnv rdbenv = (RpcDbEnv)env_list.get(envid); + if (rdbenv != null) + rdbenv.timer.last_access = now; + return rdbenv; + } + + RpcDb getDb(int dbid) + { + RpcDb rdb = (RpcDb)db_list.get(dbid); + if (rdb != null) + rdb.rdbenv.timer.last_access = now; + return rdb; + } + + RpcDbTxn getTxn(int txnid) + { + RpcDbTxn rtxn = (RpcDbTxn)txn_list.get(txnid); + if (rtxn != null) + rtxn.timer.last_access = rtxn.rdbenv.timer.last_access = now; + return rtxn; + } + + RpcDbc getCursor(int dbcid) + { + RpcDbc rdbc = (RpcDbc)cursor_list.get(dbcid); + if (rdbc != null) + rdbc.last_access = rdbc.timer.last_access = rdbc.rdbenv.timer.last_access = now; + return rdbc; + } + + void doTimeouts() + { + if (now < hint) { + // DbServer.err.println("Skipping cleaner sweep - now = " + now + ", hint = " + hint); + return; + } + + // DbServer.err.println("Starting a cleaner sweep"); + hint = now + DbServer.maxto; + + for(LocalIterator i = cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + if (rdbc == null) + continue; + + long end_time = rdbc.timer.last_access + rdbc.rdbenv.timeout; + // DbServer.err.println("Examining " + rdbc + ", time left = " + (end_time - now)); + if (end_time < now) { + DbServer.err.println("Cleaning up " + rdbc); + delCursor(rdbc); + } else if (end_time < hint) + hint = end_time; + } + + for(LocalIterator i = txn_list.iterator(); i.hasNext(); ) { + RpcDbTxn rtxn = (RpcDbTxn)i.next(); + if (rtxn == null) + continue; + + long end_time = rtxn.timer.last_access + rtxn.rdbenv.timeout; + // DbServer.err.println("Examining " + rtxn + ", time left = " + (end_time - now)); + if (end_time < now) { + DbServer.err.println("Cleaning up " + rtxn); + delTxn(rtxn); + } else if (end_time < hint) + hint = end_time; + } + + for(LocalIterator i = env_list.iterator(); i.hasNext(); ) { + RpcDbEnv rdbenv = (RpcDbEnv)i.next(); + if (rdbenv == null) + continue; + + long end_time = rdbenv.timer.last_access + rdbenv.idletime; + // DbServer.err.println("Examining " + rdbenv + ", time left = " + (end_time - now)); + if (end_time < now) { + DbServer.err.println("Cleaning up " + rdbenv); + delEnv(rdbenv); + } + } + + // if we didn't find anything, reset the hint + if (hint == now + DbServer.maxto) + hint = 0; + + // DbServer.err.println("Finishing a cleaner sweep"); + } + + // Some constants that aren't available elsewhere + static final int DB_SERVER_FLAGMASK = Db.DB_LOCKDOWN | + Db.DB_PRIVATE | Db.DB_RECOVER | Db.DB_RECOVER_FATAL | + Db.DB_SYSTEM_MEM | Db.DB_USE_ENVIRON | + Db.DB_USE_ENVIRON_ROOT; + static final int DB_SERVER_ENVFLAGS = Db.DB_INIT_CDB | + Db.DB_INIT_LOCK | Db.DB_INIT_LOG | Db.DB_INIT_MPOOL | + Db.DB_INIT_TXN | Db.DB_JOINENV; + static final int DB_SERVER_DBFLAGS = Db.DB_DIRTY_READ | + Db.DB_NOMMAP | Db.DB_RDONLY; + static final int DB_SERVER_DBNOSHARE = Db.DB_EXCL | Db.DB_TRUNCATE; + + public static void main(String[] args) + { + System.out.println("Starting DbServer..."); + for (int i = 0; i < args.length; i++) { + if (args[i].charAt(0) != '-') + usage(); + + switch (args[i].charAt(1)) { + case 'h': + ++i; // add_home(args[++i]); + break; + case 'I': + idleto = Long.parseLong(args[++i]) * 1000L; + break; + case 'P': + passwd = args[++i]; + break; + case 't': + defto = Long.parseLong(args[++i]) * 1000L; + break; + case 'T': + maxto = Long.parseLong(args[++i]) * 1000L; + break; + case 'V': + // version; + break; + case 'v': + // verbose + break; + default: + usage(); + } + } + + try { + DbServer.err = new PrintWriter(new FileOutputStream("JavaRPCServer.trace", true)); + DbServer server = new DbServer(); + server.run(); + } catch (Throwable e) { + System.out.println("DbServer exception:"); + e.printStackTrace(DbServer.err); + } finally { + if (DbServer.err != null) + DbServer.err.close(); + } + + System.out.println("DbServer stopped."); + } + + static void usage() + { + System.err.println("usage: java com.sleepycat.db.rpcserver.DbServer \\"); + System.err.println("[-Vv] [-h home] [-P passwd] [-I idletimeout] [-L logfile] [-t def_timeout] [-T maxtimeout]"); + System.exit(1); + } +} diff --git a/db/rpc_server/java/FreeList.java b/db/rpc_server/java/FreeList.java new file mode 100644 index 000000000..d7eedd746 --- /dev/null +++ b/db/rpc_server/java/FreeList.java @@ -0,0 +1,102 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: FreeList.java,v 1.3 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import java.util.*; + +/** + * Keep track of a list of objects by id with a free list. + * Intentionally package-protected exposure. + */ +class FreeList +{ + class FreeIndex { + int index; + FreeIndex(int index) { this.index = index; } + int getIndex() { return index; } + } + + Vector items = new Vector(); + FreeIndex free_head = null; + + public synchronized int add(Object obj) { + int pos; + if (free_head == null) { + pos = items.size(); + items.addElement(obj); + if (pos % 1000 == 0) + DbServer.err.println(this + " grew to size " + pos); + } else { + pos = free_head.getIndex(); + free_head = (FreeIndex)items.elementAt(pos); + items.setElementAt(obj, pos); + } + return pos; + } + + public synchronized void del(int pos) { + Object obj = items.elementAt(pos); + if (obj != null && obj instanceof FreeIndex) + throw new NoSuchElementException("index " + pos + " has already been freed"); + items.setElementAt(free_head, pos); + free_head = new FreeIndex(pos); + } + + public void del(Object obj) { + del(items.indexOf(obj)); + } + + public Object get(int pos) { + Object obj = items.elementAt(pos); + if (obj instanceof FreeIndex) + obj = null; + return obj; + } + + public LocalIterator iterator() { + return new FreeListIterator(); + } + + /** + * Iterator for a FreeList. Note that this class doesn't implement + * java.util.Iterator to maintain compatibility with Java 1.1 + * Intentionally package-protected exposure. + */ + class FreeListIterator implements LocalIterator { + int current; + + FreeListIterator() { current = findNext(-1); } + + private int findNext(int start) { + int next = start; + while (++next < items.size()) { + Object obj = items.elementAt(next); + if (obj == null || !(obj instanceof FreeIndex)) + break; + } + return next; + } + + public boolean hasNext() { + return (findNext(current) < items.size()); + } + + public Object next() { + current = findNext(current); + if (current == items.size()) + throw new NoSuchElementException("enumerated past end of FreeList"); + return items.elementAt(current); + } + + public void remove() { + del(current); + } + } +} diff --git a/db/rpc_server/java/LocalIterator.java b/db/rpc_server/java/LocalIterator.java new file mode 100644 index 000000000..498ded344 --- /dev/null +++ b/db/rpc_server/java/LocalIterator.java @@ -0,0 +1,23 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: LocalIterator.java,v 1.2 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import java.util.*; + +/** + * Iterator interface. Note that this matches java.util.Iterator + * but maintains compatibility with Java 1.1 + * Intentionally package-protected exposure. + */ +interface LocalIterator { + boolean hasNext(); + Object next(); + void remove(); +} diff --git a/db/rpc_server/java/README b/db/rpc_server/java/README new file mode 100644 index 000000000..c2d8f3abd --- /dev/null +++ b/db/rpc_server/java/README @@ -0,0 +1,24 @@ +Berkeley DB Java RPC server, copyright (C) 2002 Sleepycat Software + +The Java implementation of the Berkeley DB RPC server is intended +primarily for testing purposes. It provides the same interface +as the C and C++ RPC servers, but is implemented via the Java API +rather than the C or C++ APIs. This allows the existing Tcl test +suite to exercise the Java API without modification. + +The Java RPC server relies on a Java version of rpcgen to +automatically generate appropriate Java classes from the RPC +interface specification (../db_server.x). We use jrpcgen, which +is part of the Remote Tea for Java project: + acplt.plt.rwth-aachen.de/ks/english/remotetea.html + +To rebuild the Java stubs from db_server.x, you will need to +download the full Remote Tea package, but if you just want to +compile the Java sources and run the Java RPC server, the runtime +component of Remote Tea is included in oncrpc.jar. Building +the Java RPC server is automatic when Berkeley DB is configured +with the both --enable-rpc and --enable-java. + +All of the Remote Tea project is licensed under the Library GNU +Public License, and we have made no modifications to their +released code. diff --git a/db/rpc_server/java/RpcDb.java b/db/rpc_server/java/RpcDb.java new file mode 100644 index 000000000..19320c179 --- /dev/null +++ b/db/rpc_server/java/RpcDb.java @@ -0,0 +1,694 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDb.java,v 1.8 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a db object for the Java RPC server. + */ +public class RpcDb extends Timer +{ + static final byte[] empty = new byte[0]; + Db db; + RpcDbEnv rdbenv; + int refcount = 1; + String dbname, subdbname; + int type, setflags, openflags; + + public RpcDb(RpcDbEnv rdbenv) + { + this.rdbenv = rdbenv; + } + + void dispose() + { + if (db != null) { + try { + db.close(0); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + db = null; + } + } + + public void associate(DbDispatcher server, + __db_associate_msg args, __db_associate_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + /* + * We do not support DB_CREATE for associate. Users + * can only access secondary indices on a read-only basis, + * so whatever they are looking for needs to be there already. + */ + db.associate(txn, server.getDb(args.sdbpcl_id).db, null, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void close(DbDispatcher server, + __db_close_msg args, __db_close_reply reply) + { + if (--refcount != 0) { + reply.status = 0; + return; + } + + try { + db.close(args.flags); + db = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delDb(this); + } + } + + public void create(DbDispatcher server, + __db_create_msg args, __db_create_reply reply) + { + try { + db = new Db(server.getEnv(args.dbenvcl_id).dbenv, args.flags); + reply.dbcl_id = server.addDb(this); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void cursor(DbDispatcher server, + __db_cursor_msg args, __db_cursor_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbc dbc = db.cursor(txn, args.flags); + RpcDbc rdbc = new RpcDbc(this, dbc, false); + rdbc.timer = (rtxn != null) ? rtxn.timer : this; + reply.dbcidcl_id = server.addCursor(rdbc); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void del(DbDispatcher server, + __db_del_msg args, __db_del_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(args.keyflags); + + db.del(txn, key, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void get(DbDispatcher server, + __db_get_msg args, __db_get_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(Db.DB_DBT_MALLOC | + (args.keyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + if ((args.flags & Db.DB_MULTIPLE) != 0) { + if (data.get_data().length == 0) + data.set_data(new byte[data.get_ulen()]); + data.set_flags(Db.DB_DBT_USERMEM | + (args.dataflags & Db.DB_DBT_PARTIAL)); + } else + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + reply.status = db.get(txn, key, data, args.flags); + + if (key.get_data() == args.keydata || + key.get_data().length != key.get_size()) { + reply.keydata = new byte[key.get_size()]; + System.arraycopy(key.get_data(), 0, reply.keydata, 0, key.get_size()); + } else + reply.keydata = key.get_data(); + + if (data.get_data() == args.datadata || + data.get_data().length != data.get_size()) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.keydata = reply.datadata = empty; + } + } + + public void join(DbDispatcher server, + __db_join_msg args, __db_join_reply reply) + { + try { + Dbc[] cursors = new Dbc[args.curs.length + 1]; + for(int i = 0; i < args.curs.length; i++) { + RpcDbc rdbc = server.getCursor(args.curs[i]); + if (rdbc == null) { + reply.status = Db.DB_NOSERVER_ID; + return; + } + cursors[i] = rdbc.dbc; + } + cursors[args.curs.length] = null; + + Dbc jdbc = db.join(cursors, args.flags); + + RpcDbc rjdbc = new RpcDbc(this, jdbc, true); + /* + * If our curslist has a parent txn, we need to use it too + * for the activity timeout. All cursors must be part of + * the same transaction, so just check the first. + */ + RpcDbc rdbc0 = server.getCursor(args.curs[0]); + if (rdbc0.timer != rdbc0) + rjdbc.timer = rdbc0.timer; + + /* + * All of the curslist cursors must point to the join + * cursor's timeout so that we do not timeout any of the + * curlist cursors while the join cursor is active. + */ + for(int i = 0; i < args.curs.length; i++) { + RpcDbc rdbc = server.getCursor(args.curs[i]); + rdbc.orig_timer = rdbc.timer; + rdbc.timer = rjdbc; + } + reply.dbcidcl_id = server.addCursor(rjdbc); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void key_range(DbDispatcher server, + __db_key_range_msg args, __db_key_range_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(args.keyflags); + + DbKeyRange range = new DbKeyRange(); + + db.key_range(txn, key, range, args.flags); + reply.status = 0; + reply.less = range.less; + reply.equal = range.equal; + reply.greater = range.greater; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + private boolean findSharedDb(DbDispatcher server, __db_open_reply reply) + throws DbException + { + RpcDb rdb = null; + boolean matchFound = false; + LocalIterator i = ((DbServer)server).db_list.iterator(); + + while (!matchFound && i.hasNext()) { + rdb = (RpcDb)i.next(); + if (rdb != null && rdb != this && rdb.rdbenv == rdbenv && + (type == Db.DB_UNKNOWN || rdb.type == type) && + openflags == rdb.openflags && + setflags == rdb.setflags && + dbname != null && rdb.dbname != null && + dbname.equals(rdb.dbname) && + (subdbname == rdb.subdbname || + (subdbname != null && rdb.subdbname != null && + subdbname.equals(rdb.subdbname)))) + matchFound = true; + } + + if (matchFound) { + ++rdb.refcount; + reply.dbcl_id = ((FreeList.FreeListIterator)i).current; + reply.type = rdb.db.get_type(); + reply.dbflags = rdb.db.get_flags_raw(); + // FIXME: not possible to work out byteorder from Java? + reply.lorder = rdb.db.get_byteswapped() ? 4321 : 1234; + reply.status = 0; + + DbServer.err.println("Sharing Db: " + reply.dbcl_id); + } + + return matchFound; + } + + public void open(DbDispatcher server, + __db_open_msg args, __db_open_reply reply) + { + try { + dbname = (args.name.length() > 0) ? args.name : null; + subdbname = (args.subdb.length() > 0) ? args.subdb : null; + type = args.type; + openflags = args.flags & DbServer.DB_SERVER_DBFLAGS; + + if (findSharedDb(server, reply)) { + db.close(0); + db = null; + server.delDb(this); + } else { + DbServer.err.println("Calling db.open(" + null + ", " + dbname + ", " + subdbname + ", " + args.type + ", " + Integer.toHexString(args.flags) + ", " + args.mode + ")"); + db.open(null, dbname, subdbname, args.type, args.flags, args.mode); + + reply.dbcl_id = args.dbpcl_id; + reply.type = this.type = db.get_type(); + reply.dbflags = db.get_flags_raw(); + // FIXME: not possible to work out byteorder from Java? + reply.lorder = db.get_byteswapped() ? 4321 : 1234; + reply.status = 0; + } + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + e.printStackTrace(DbServer.err); + reply.status = Db.DB_NOTFOUND; + } + + // System.err.println("Db.open: reply.status = " + reply.status + ", reply.dbcl_id = " + reply.dbcl_id); + } + + public void pget(DbDispatcher server, + __db_pget_msg args, __db_pget_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt skey = new Dbt(args.skeydata); + skey.set_dlen(args.skeydlen); + skey.set_doff(args.skeydoff); + skey.set_ulen(args.skeyulen); + skey.set_flags(Db.DB_DBT_MALLOC | + (args.skeyflags & Db.DB_DBT_PARTIAL)); + + Dbt pkey = new Dbt(args.pkeydata); + pkey.set_dlen(args.pkeydlen); + pkey.set_doff(args.pkeydoff); + pkey.set_ulen(args.pkeyulen); + pkey.set_flags(Db.DB_DBT_MALLOC | + (args.pkeyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + db.pget(txn, skey, pkey, data, args.flags); + + if (skey.get_data() == args.skeydata || + skey.get_data().length != skey.get_size()) { + reply.skeydata = new byte[skey.get_size()]; + System.arraycopy(skey.get_data(), 0, reply.skeydata, 0, skey.get_size()); + } else + reply.skeydata = skey.get_data(); + + if (pkey.get_data() == args.pkeydata || + pkey.get_data().length != pkey.get_size()) { + reply.pkeydata = new byte[pkey.get_size()]; + System.arraycopy(pkey.get_data(), 0, reply.pkeydata, 0, pkey.get_size()); + } else + reply.pkeydata = pkey.get_data(); + + if (data.get_data() == args.datadata || + data.get_data().length != data.get_size()) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.skeydata = reply.pkeydata = reply.datadata = empty; + } + } + + public void put(DbDispatcher server, + __db_put_msg args, __db_put_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(Db.DB_DBT_MALLOC | + (args.keyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + data.set_flags(args.dataflags); + + reply.status = db.put(txn, key, data, args.flags); + + /* + * If the client did a DB_APPEND, set up key in reply. + * Otherwise just status. + */ + if ((args.flags & Db.DB_APPEND) != 0) { + if (key.get_data() == args.keydata || + key.get_data().length != key.get_size()) { + reply.keydata = new byte[key.get_size()]; + System.arraycopy(key.get_data(), 0, reply.keydata, 0, key.get_size()); + } else + reply.keydata = key.get_data(); + } else + reply.keydata = empty; + } catch(DbException e) { + reply.keydata = empty; + reply.status = e.get_errno(); + DbServer.err.println("Exception, setting status to " + reply.status); + e.printStackTrace(DbServer.err); + } + } + + public void remove(DbDispatcher server, + __db_remove_msg args, __db_remove_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + db.remove(args.name, args.subdb, args.flags); + db = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + e.printStackTrace(DbServer.err); + reply.status = Db.DB_NOTFOUND; + } finally { + server.delDb(this); + } + } + + public void rename(DbDispatcher server, + __db_rename_msg args, __db_rename_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + args.newname = (args.newname.length() > 0) ? args.newname : null; + db.rename(args.name, args.subdb, args.newname, args.flags); + db = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + e.printStackTrace(DbServer.err); + reply.status = Db.DB_NOTFOUND; + } finally { + server.delDb(this); + } + } + + public void set_bt_maxkey(DbDispatcher server, + __db_bt_maxkey_msg args, __db_bt_maxkey_reply reply) + { + try { + db.set_bt_maxkey(args.maxkey); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_bt_minkey(DbDispatcher server, + __db_bt_minkey_msg args, __db_bt_minkey_reply reply) + { + try { + db.set_bt_minkey(args.minkey); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_encrypt(DbDispatcher server, + __db_encrypt_msg args, __db_encrypt_reply reply) + { + try { + db.set_encrypt(args.passwd, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_flags(DbDispatcher server, + __db_flags_msg args, __db_flags_reply reply) + { + try { + // DbServer.err.println("Calling db.setflags(" + Integer.toHexString(args.flags) + ")"); + db.set_flags(args.flags); + setflags |= args.flags; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_h_ffactor(DbDispatcher server, + __db_h_ffactor_msg args, __db_h_ffactor_reply reply) + { + try { + db.set_h_ffactor(args.ffactor); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_h_nelem(DbDispatcher server, + __db_h_nelem_msg args, __db_h_nelem_reply reply) + { + try { + db.set_h_nelem(args.nelem); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_lorder(DbDispatcher server, + __db_lorder_msg args, __db_lorder_reply reply) + { + try { + db.set_lorder(args.lorder); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_pagesize(DbDispatcher server, + __db_pagesize_msg args, __db_pagesize_reply reply) + { + try { + db.set_pagesize(args.pagesize); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_q_extentsize(DbDispatcher server, + __db_extentsize_msg args, __db_extentsize_reply reply) + { + try { + db.set_q_extentsize(args.extentsize); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_re_delim(DbDispatcher server, + __db_re_delim_msg args, __db_re_delim_reply reply) + { + try { + db.set_re_delim(args.delim); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_re_len(DbDispatcher server, + __db_re_len_msg args, __db_re_len_reply reply) + { + try { + db.set_re_len(args.len); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_re_pad(DbDispatcher server, + __db_re_pad_msg args, __db_re_pad_reply reply) + { + try { + db.set_re_pad(args.pad); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void stat(DbDispatcher server, + __db_stat_msg args, __db_stat_reply reply) + { + try { + Object raw_stat = db.stat(args.flags); + + if (raw_stat instanceof DbHashStat) { + DbHashStat hs = (DbHashStat)raw_stat; + int[] raw_stats = { + hs.hash_magic, hs.hash_version, + hs.hash_metaflags, hs.hash_nkeys, + hs.hash_ndata, hs.hash_pagesize, + hs.hash_ffactor, hs.hash_buckets, + hs.hash_free, hs.hash_bfree, + hs.hash_bigpages, hs.hash_big_bfree, + hs.hash_overflows, hs.hash_ovfl_free, + hs.hash_dup, hs.hash_dup_free + }; + reply.stats = raw_stats; + } else if (raw_stat instanceof DbQueueStat) { + DbQueueStat qs = (DbQueueStat)raw_stat; + int[] raw_stats = { + qs.qs_magic, qs.qs_version, + qs.qs_metaflags, qs.qs_nkeys, + qs.qs_ndata, qs.qs_pagesize, + qs.qs_extentsize, qs.qs_pages, + qs.qs_re_len, qs.qs_re_pad, + qs.qs_pgfree, qs.qs_first_recno, + qs.qs_cur_recno + }; + reply.stats = raw_stats; + } else if (raw_stat instanceof DbBtreeStat) { + DbBtreeStat bs = (DbBtreeStat)raw_stat; + int[] raw_stats = { + bs.bt_magic, bs.bt_version, + bs.bt_metaflags, bs.bt_nkeys, + bs.bt_ndata, bs.bt_pagesize, + bs.bt_maxkey, bs.bt_minkey, + bs.bt_re_len, bs.bt_re_pad, + bs.bt_levels, bs.bt_int_pg, + bs.bt_leaf_pg, bs.bt_dup_pg, + bs.bt_over_pg, bs.bt_free, + bs.bt_int_pgfree, bs.bt_leaf_pgfree, + bs.bt_dup_pgfree, bs.bt_over_pgfree + }; + reply.stats = raw_stats; + } else + throw new DbException("Invalid return type from db.stat()", Db.DB_NOTFOUND); + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.stats = new int[0]; + } + } + + public void sync(DbDispatcher server, + __db_sync_msg args, __db_sync_reply reply) + { + try { + db.sync(args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void truncate(DbDispatcher server, + __db_truncate_msg args, __db_truncate_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + reply.count = db.truncate(txn, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } +} diff --git a/db/rpc_server/java/RpcDbEnv.java b/db/rpc_server/java/RpcDbEnv.java new file mode 100644 index 000000000..3dbaea7c1 --- /dev/null +++ b/db/rpc_server/java/RpcDbEnv.java @@ -0,0 +1,264 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDbEnv.java,v 1.5 2002/08/09 01:56:10 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a dbenv for the Java RPC server. + */ +public class RpcDbEnv extends Timer +{ + DbEnv dbenv; + String home; + long idletime, timeout; + int openflags, onflags, offflags; + int refcount = 1; + + void dispose() + { + if (dbenv != null) { + try { + dbenv.close(0); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + dbenv = null; + } + } + + public void close(DbDispatcher server, + __env_close_msg args, __env_close_reply reply) + { + if (--refcount != 0) { + reply.status = 0; + return; + } + + try { + dbenv.close(args.flags); + dbenv = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delEnv(this); + } + } + + public void create(DbDispatcher server, + __env_create_msg args, __env_create_reply reply) + { + this.idletime = (args.timeout != 0) ? args.timeout : DbServer.idleto; + this.timeout = DbServer.defto; + dbenv = new DbEnv(0); + reply.envcl_id = server.addEnv(this); + reply.status = 0; + } + + public void dbremove(DbDispatcher server, + __env_dbremove_msg args, __env_dbremove_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + dbenv.dbremove(txn, args.name, args.subdb, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void dbrename(DbDispatcher server, + __env_dbrename_msg args, __env_dbrename_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + args.newname = (args.newname.length() > 0) ? args.newname : null; + + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + dbenv.dbrename(txn, args.name, args.subdb, args.newname, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + private boolean findSharedDbEnv(DbDispatcher server, __env_open_reply reply) + throws DbException + { + RpcDbEnv rdbenv = null; + boolean matchFound = false; + LocalIterator i = ((DbServer)server).env_list.iterator(); + + while (!matchFound && i.hasNext()) { + rdbenv = (RpcDbEnv)i.next(); + if (rdbenv != null && rdbenv != this && + (home == rdbenv.home || + (home != null && home.equals(rdbenv.home))) && + openflags == rdbenv.openflags && + onflags == rdbenv.onflags && + offflags == rdbenv.offflags) + matchFound = true; + } + + if (matchFound) { + /* + * The only thing left to check is the timeout. + * Since the server timeout set by the client is a hint, for sharing + * we'll give them the benefit of the doubt and grant them the + * longer timeout. + */ + if (rdbenv.timeout < timeout) + rdbenv.timeout = timeout; + + ++rdbenv.refcount; + reply.envcl_id = ((FreeList.FreeListIterator)i).current; + reply.status = 0; + + DbServer.err.println("Sharing DbEnv: " + reply.envcl_id); + } + + return matchFound; + } + + public void open(DbDispatcher server, + __env_open_msg args, __env_open_reply reply) + { + try { + home = (args.home.length() > 0) ? args.home : null; + + /* + * If they are using locking do deadlock detection for them, + * internally. + */ + if ((args.flags & Db.DB_INIT_LOCK) != 0) + dbenv.set_lk_detect(Db.DB_LOCK_DEFAULT); + + // adjust flags for RPC + int newflags = (args.flags & ~DbServer.DB_SERVER_FLAGMASK); + openflags = (newflags & DbServer.DB_SERVER_ENVFLAGS); + + if (findSharedDbEnv(server, reply)) { + dbenv.close(0); + dbenv = null; + server.delEnv(this); + } else { + // TODO: check home? + dbenv.open(home, newflags, args.mode); + reply.status = 0; + reply.envcl_id = args.dbenvcl_id; + } + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + reply.status = Db.DB_NOTFOUND; + } + + // System.err.println("DbEnv.open: reply.status = " + reply.status + ", reply.envcl_id = " + reply.envcl_id); + } + + public void remove(DbDispatcher server, + __env_remove_msg args, __env_remove_reply reply) + { + try { + args.home = (args.home.length() > 0) ? args.home : null; + // TODO: check home? + + dbenv.remove(args.home, args.flags); + dbenv = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + reply.status = Db.DB_NOTFOUND; + } finally { + server.delEnv(this); + } + } + + public void set_cachesize(DbDispatcher server, + __env_cachesize_msg args, __env_cachesize_reply reply) + { + try { + dbenv.set_cachesize(args.gbytes, args.bytes, args.ncache); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_encrypt(DbDispatcher server, + __env_encrypt_msg args, __env_encrypt_reply reply) + { + try { + dbenv.set_encrypt(args.passwd, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_flags(DbDispatcher server, + __env_flags_msg args, __env_flags_reply reply) + { + try { + dbenv.set_flags(args.flags, args.onoff != 0); + if (args.onoff != 0) + onflags |= args.flags; + else + offflags |= args.flags; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + // txn_recover implementation + public void txn_recover(DbDispatcher server, + __txn_recover_msg args, __txn_recover_reply reply) + { + try { + DbPreplist[] prep_list = dbenv.txn_recover(args.count, args.flags); + if (prep_list != null && prep_list.length > 0) { + int count = prep_list.length; + reply.retcount = count; + reply.txn = new int[count]; + reply.gid = new byte[count * Db.DB_XIDDATASIZE]; + + for(int i = 0; i < count; i++) { + reply.txn[i] = server.addTxn(new RpcDbTxn(this, prep_list[i].txn)); + System.arraycopy(prep_list[i].gid, 0, reply.gid, i * Db.DB_XIDDATASIZE, Db.DB_XIDDATASIZE); + } + } + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } +} diff --git a/db/rpc_server/java/RpcDbTxn.java b/db/rpc_server/java/RpcDbTxn.java new file mode 100644 index 000000000..feaa4d7d9 --- /dev/null +++ b/db/rpc_server/java/RpcDbTxn.java @@ -0,0 +1,123 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDbTxn.java,v 1.2 2002/08/09 01:56:10 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a txn object for the Java RPC server. + */ +public class RpcDbTxn extends Timer +{ + RpcDbEnv rdbenv; + DbTxn txn; + + public RpcDbTxn(RpcDbEnv rdbenv, DbTxn txn) + { + this.rdbenv = rdbenv; + this.txn = txn; + } + + void dispose() + { + if (txn != null) { + try { + txn.abort(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + txn = null; + } + } + + public void abort(DbDispatcher server, + __txn_abort_msg args, __txn_abort_reply reply) + { + try { + txn.abort(); + txn = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delTxn(this); + } + } + + public void begin(DbDispatcher server, + __txn_begin_msg args, __txn_begin_reply reply) + { + try { + if (rdbenv == null) { + reply.status = Db.DB_NOSERVER_ID; + return; + } + DbEnv dbenv = rdbenv.dbenv; + RpcDbTxn rparent = server.getTxn(args.parentcl_id); + DbTxn parent = (rparent != null) ? rparent.txn : null; + + txn = dbenv.txn_begin(parent, args.flags); + + if (rparent != null) + timer = rparent.timer; + reply.txnidcl_id = server.addTxn(this); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void commit(DbDispatcher server, + __txn_commit_msg args, __txn_commit_reply reply) + { + try { + txn.commit(args.flags); + txn = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delTxn(this); + } + } + + public void discard(DbDispatcher server, + __txn_discard_msg args, __txn_discard_reply reply) + { + try { + txn.discard(args.flags); + txn = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delTxn(this); + } + } + + public void prepare(DbDispatcher server, + __txn_prepare_msg args, __txn_prepare_reply reply) + { + try { + txn.prepare(args.gid); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } +} diff --git a/db/rpc_server/java/RpcDbc.java b/db/rpc_server/java/RpcDbc.java new file mode 100644 index 000000000..9419e792f --- /dev/null +++ b/db/rpc_server/java/RpcDbc.java @@ -0,0 +1,238 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDbc.java,v 1.3 2002/08/09 01:56:10 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a dbc object for the Java RPC server. + */ +public class RpcDbc extends Timer +{ + static final byte[] empty = new byte[0]; + RpcDbEnv rdbenv; + RpcDb rdb; + Dbc dbc; + Timer orig_timer; + boolean isJoin; + + public RpcDbc(RpcDb rdb, Dbc dbc, boolean isJoin) + { + this.rdb = rdb; + this.rdbenv = rdb.rdbenv; + this.dbc = dbc; + this.isJoin = isJoin; + } + + void dispose() + { + if (dbc != null) { + try { + dbc.close(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + dbc = null; + } + } + + public void close(DbDispatcher server, + __dbc_close_msg args, __dbc_close_reply reply) + { + try { + dbc.close(); + dbc = null; + + if (isJoin) + for(LocalIterator i = ((DbServer)server).cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + // Unjoin cursors that were joined to create this + if (rdbc != null && rdbc.timer == this) + rdbc.timer = rdbc.orig_timer; + } + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delCursor(this); + } + } + + public void count(DbDispatcher server, + __dbc_count_msg args, __dbc_count_reply reply) + { + try { + reply.dupcount = dbc.count(args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void del(DbDispatcher server, + __dbc_del_msg args, __dbc_del_reply reply) + { + try { + reply.status = dbc.del(args.flags); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void dup(DbDispatcher server, + __dbc_dup_msg args, __dbc_dup_reply reply) + { + try { + Dbc newdbc = dbc.dup(args.flags); + RpcDbc rdbc = new RpcDbc(rdb, newdbc, false); + /* If this cursor has a parent txn, we need to use it too. */ + if (timer != this) + rdbc.timer = timer; + reply.dbcidcl_id = server.addCursor(rdbc); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void get(DbDispatcher server, + __dbc_get_msg args, __dbc_get_reply reply) + { + try { + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_ulen(args.keyulen); + key.set_doff(args.keydoff); + key.set_flags(Db.DB_DBT_MALLOC | + (args.keyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_ulen(args.dataulen); + data.set_doff(args.datadoff); + if ((args.flags & Db.DB_MULTIPLE) != 0 || + (args.flags & Db.DB_MULTIPLE_KEY) != 0) { + if (data.get_data().length == 0) + data.set_data(new byte[data.get_ulen()]); + data.set_flags(Db.DB_DBT_USERMEM | + (args.dataflags & Db.DB_DBT_PARTIAL)); + } else + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + reply.status = dbc.get(key, data, args.flags); + + if (key.get_data() == args.keydata) { + reply.keydata = new byte[key.get_size()]; + System.arraycopy(key.get_data(), 0, reply.keydata, 0, key.get_size()); + } else + reply.keydata = key.get_data(); + + if (data.get_data() == args.datadata) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.keydata = reply.datadata = empty; + } + } + + public void pget(DbDispatcher server, + __dbc_pget_msg args, __dbc_pget_reply reply) + { + try { + Dbt skey = new Dbt(args.skeydata); + skey.set_dlen(args.skeydlen); + skey.set_doff(args.skeydoff); + skey.set_ulen(args.skeyulen); + skey.set_flags(Db.DB_DBT_MALLOC | + (args.skeyflags & Db.DB_DBT_PARTIAL)); + + Dbt pkey = new Dbt(args.pkeydata); + pkey.set_dlen(args.pkeydlen); + pkey.set_doff(args.pkeydoff); + pkey.set_ulen(args.pkeyulen); + pkey.set_flags(Db.DB_DBT_MALLOC | + (args.pkeyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + reply.status = dbc.pget(skey, pkey, data, args.flags); + + if (skey.get_data() == args.skeydata) { + reply.skeydata = new byte[skey.get_size()]; + System.arraycopy(skey.get_data(), 0, reply.skeydata, 0, skey.get_size()); + } else + reply.skeydata = skey.get_data(); + + if (pkey.get_data() == args.pkeydata) { + reply.pkeydata = new byte[pkey.get_size()]; + System.arraycopy(pkey.get_data(), 0, reply.pkeydata, 0, pkey.get_size()); + } else + reply.pkeydata = pkey.get_data(); + + if (data.get_data() == args.datadata) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void put(DbDispatcher server, + __dbc_put_msg args, __dbc_put_reply reply) + { + try { + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_ulen(args.keyulen); + key.set_doff(args.keydoff); + key.set_flags(args.keyflags & Db.DB_DBT_PARTIAL); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_ulen(args.dataulen); + data.set_doff(args.datadoff); + data.set_flags(args.dataflags); + + reply.status = dbc.put(key, data, args.flags); + + if (reply.status == 0 && + (args.flags == Db.DB_AFTER || args.flags == Db.DB_BEFORE) && + rdb.db.get_type() == Db.DB_RECNO) + reply.keydata = key.get_data(); + else + reply.keydata = empty; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.keydata = empty; + } + } +} diff --git a/db/rpc_server/java/Timer.java b/db/rpc_server/java/Timer.java new file mode 100644 index 000000000..5aa133d28 --- /dev/null +++ b/db/rpc_server/java/Timer.java @@ -0,0 +1,22 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: Timer.java,v 1.1 2002/01/03 02:59:39 mjc Exp + */ + +package com.sleepycat.db.rpcserver; + +/** + * Class to keep track of access times. This is slightly devious by having + * both the access_time and a reference to another Timer that can be + * used to group/share access times. This is done to keep the Java code + * close to the canonical C implementation of the RPC server. + */ +public class Timer +{ + Timer timer = this; + long last_access; +} diff --git a/db/rpc_server/java/gen/DbServerStub.java b/db/rpc_server/java/gen/DbServerStub.java new file mode 100644 index 000000000..90fc13a6d --- /dev/null +++ b/db/rpc_server/java/gen/DbServerStub.java @@ -0,0 +1,495 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +import org.acplt.oncrpc.server.*; + +/** + */ +public abstract class DbServerStub extends OncRpcServerStub implements OncRpcDispatchable { + + public DbServerStub() + throws OncRpcException, IOException { + this(0); + } + + public DbServerStub(int port) + throws OncRpcException, IOException { + info = new OncRpcServerTransportRegistrationInfo [] { + new OncRpcServerTransportRegistrationInfo(db_server.DB_RPC_SERVERPROG, 4001), + }; + transports = new OncRpcServerTransport [] { + new OncRpcUdpServerTransport(this, port, info, 32768), + new OncRpcTcpServerTransport(this, port, info, 32768) + }; + } + + public void dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure) + throws OncRpcException, IOException { + if ( version == 4001 ) { + switch ( procedure ) { + case 1: { + __env_cachesize_msg args$ = new __env_cachesize_msg(); + call.retrieveCall(args$); + __env_cachesize_reply result$ = __DB_env_cachesize_4001(args$); + call.reply(result$); + break; + } + case 2: { + __env_close_msg args$ = new __env_close_msg(); + call.retrieveCall(args$); + __env_close_reply result$ = __DB_env_close_4001(args$); + call.reply(result$); + break; + } + case 3: { + __env_create_msg args$ = new __env_create_msg(); + call.retrieveCall(args$); + __env_create_reply result$ = __DB_env_create_4001(args$); + call.reply(result$); + break; + } + case 4: { + __env_dbremove_msg args$ = new __env_dbremove_msg(); + call.retrieveCall(args$); + __env_dbremove_reply result$ = __DB_env_dbremove_4001(args$); + call.reply(result$); + break; + } + case 5: { + __env_dbrename_msg args$ = new __env_dbrename_msg(); + call.retrieveCall(args$); + __env_dbrename_reply result$ = __DB_env_dbrename_4001(args$); + call.reply(result$); + break; + } + case 6: { + __env_encrypt_msg args$ = new __env_encrypt_msg(); + call.retrieveCall(args$); + __env_encrypt_reply result$ = __DB_env_encrypt_4001(args$); + call.reply(result$); + break; + } + case 7: { + __env_flags_msg args$ = new __env_flags_msg(); + call.retrieveCall(args$); + __env_flags_reply result$ = __DB_env_flags_4001(args$); + call.reply(result$); + break; + } + case 8: { + __env_open_msg args$ = new __env_open_msg(); + call.retrieveCall(args$); + __env_open_reply result$ = __DB_env_open_4001(args$); + call.reply(result$); + break; + } + case 9: { + __env_remove_msg args$ = new __env_remove_msg(); + call.retrieveCall(args$); + __env_remove_reply result$ = __DB_env_remove_4001(args$); + call.reply(result$); + break; + } + case 10: { + __txn_abort_msg args$ = new __txn_abort_msg(); + call.retrieveCall(args$); + __txn_abort_reply result$ = __DB_txn_abort_4001(args$); + call.reply(result$); + break; + } + case 11: { + __txn_begin_msg args$ = new __txn_begin_msg(); + call.retrieveCall(args$); + __txn_begin_reply result$ = __DB_txn_begin_4001(args$); + call.reply(result$); + break; + } + case 12: { + __txn_commit_msg args$ = new __txn_commit_msg(); + call.retrieveCall(args$); + __txn_commit_reply result$ = __DB_txn_commit_4001(args$); + call.reply(result$); + break; + } + case 13: { + __txn_discard_msg args$ = new __txn_discard_msg(); + call.retrieveCall(args$); + __txn_discard_reply result$ = __DB_txn_discard_4001(args$); + call.reply(result$); + break; + } + case 14: { + __txn_prepare_msg args$ = new __txn_prepare_msg(); + call.retrieveCall(args$); + __txn_prepare_reply result$ = __DB_txn_prepare_4001(args$); + call.reply(result$); + break; + } + case 15: { + __txn_recover_msg args$ = new __txn_recover_msg(); + call.retrieveCall(args$); + __txn_recover_reply result$ = __DB_txn_recover_4001(args$); + call.reply(result$); + break; + } + case 16: { + __db_associate_msg args$ = new __db_associate_msg(); + call.retrieveCall(args$); + __db_associate_reply result$ = __DB_db_associate_4001(args$); + call.reply(result$); + break; + } + case 17: { + __db_bt_maxkey_msg args$ = new __db_bt_maxkey_msg(); + call.retrieveCall(args$); + __db_bt_maxkey_reply result$ = __DB_db_bt_maxkey_4001(args$); + call.reply(result$); + break; + } + case 18: { + __db_bt_minkey_msg args$ = new __db_bt_minkey_msg(); + call.retrieveCall(args$); + __db_bt_minkey_reply result$ = __DB_db_bt_minkey_4001(args$); + call.reply(result$); + break; + } + case 19: { + __db_close_msg args$ = new __db_close_msg(); + call.retrieveCall(args$); + __db_close_reply result$ = __DB_db_close_4001(args$); + call.reply(result$); + break; + } + case 20: { + __db_create_msg args$ = new __db_create_msg(); + call.retrieveCall(args$); + __db_create_reply result$ = __DB_db_create_4001(args$); + call.reply(result$); + break; + } + case 21: { + __db_del_msg args$ = new __db_del_msg(); + call.retrieveCall(args$); + __db_del_reply result$ = __DB_db_del_4001(args$); + call.reply(result$); + break; + } + case 22: { + __db_encrypt_msg args$ = new __db_encrypt_msg(); + call.retrieveCall(args$); + __db_encrypt_reply result$ = __DB_db_encrypt_4001(args$); + call.reply(result$); + break; + } + case 23: { + __db_extentsize_msg args$ = new __db_extentsize_msg(); + call.retrieveCall(args$); + __db_extentsize_reply result$ = __DB_db_extentsize_4001(args$); + call.reply(result$); + break; + } + case 24: { + __db_flags_msg args$ = new __db_flags_msg(); + call.retrieveCall(args$); + __db_flags_reply result$ = __DB_db_flags_4001(args$); + call.reply(result$); + break; + } + case 25: { + __db_get_msg args$ = new __db_get_msg(); + call.retrieveCall(args$); + __db_get_reply result$ = __DB_db_get_4001(args$); + call.reply(result$); + break; + } + case 26: { + __db_h_ffactor_msg args$ = new __db_h_ffactor_msg(); + call.retrieveCall(args$); + __db_h_ffactor_reply result$ = __DB_db_h_ffactor_4001(args$); + call.reply(result$); + break; + } + case 27: { + __db_h_nelem_msg args$ = new __db_h_nelem_msg(); + call.retrieveCall(args$); + __db_h_nelem_reply result$ = __DB_db_h_nelem_4001(args$); + call.reply(result$); + break; + } + case 28: { + __db_key_range_msg args$ = new __db_key_range_msg(); + call.retrieveCall(args$); + __db_key_range_reply result$ = __DB_db_key_range_4001(args$); + call.reply(result$); + break; + } + case 29: { + __db_lorder_msg args$ = new __db_lorder_msg(); + call.retrieveCall(args$); + __db_lorder_reply result$ = __DB_db_lorder_4001(args$); + call.reply(result$); + break; + } + case 30: { + __db_open_msg args$ = new __db_open_msg(); + call.retrieveCall(args$); + __db_open_reply result$ = __DB_db_open_4001(args$); + call.reply(result$); + break; + } + case 31: { + __db_pagesize_msg args$ = new __db_pagesize_msg(); + call.retrieveCall(args$); + __db_pagesize_reply result$ = __DB_db_pagesize_4001(args$); + call.reply(result$); + break; + } + case 32: { + __db_pget_msg args$ = new __db_pget_msg(); + call.retrieveCall(args$); + __db_pget_reply result$ = __DB_db_pget_4001(args$); + call.reply(result$); + break; + } + case 33: { + __db_put_msg args$ = new __db_put_msg(); + call.retrieveCall(args$); + __db_put_reply result$ = __DB_db_put_4001(args$); + call.reply(result$); + break; + } + case 34: { + __db_re_delim_msg args$ = new __db_re_delim_msg(); + call.retrieveCall(args$); + __db_re_delim_reply result$ = __DB_db_re_delim_4001(args$); + call.reply(result$); + break; + } + case 35: { + __db_re_len_msg args$ = new __db_re_len_msg(); + call.retrieveCall(args$); + __db_re_len_reply result$ = __DB_db_re_len_4001(args$); + call.reply(result$); + break; + } + case 36: { + __db_re_pad_msg args$ = new __db_re_pad_msg(); + call.retrieveCall(args$); + __db_re_pad_reply result$ = __DB_db_re_pad_4001(args$); + call.reply(result$); + break; + } + case 37: { + __db_remove_msg args$ = new __db_remove_msg(); + call.retrieveCall(args$); + __db_remove_reply result$ = __DB_db_remove_4001(args$); + call.reply(result$); + break; + } + case 38: { + __db_rename_msg args$ = new __db_rename_msg(); + call.retrieveCall(args$); + __db_rename_reply result$ = __DB_db_rename_4001(args$); + call.reply(result$); + break; + } + case 39: { + __db_stat_msg args$ = new __db_stat_msg(); + call.retrieveCall(args$); + __db_stat_reply result$ = __DB_db_stat_4001(args$); + call.reply(result$); + break; + } + case 40: { + __db_sync_msg args$ = new __db_sync_msg(); + call.retrieveCall(args$); + __db_sync_reply result$ = __DB_db_sync_4001(args$); + call.reply(result$); + break; + } + case 41: { + __db_truncate_msg args$ = new __db_truncate_msg(); + call.retrieveCall(args$); + __db_truncate_reply result$ = __DB_db_truncate_4001(args$); + call.reply(result$); + break; + } + case 42: { + __db_cursor_msg args$ = new __db_cursor_msg(); + call.retrieveCall(args$); + __db_cursor_reply result$ = __DB_db_cursor_4001(args$); + call.reply(result$); + break; + } + case 43: { + __db_join_msg args$ = new __db_join_msg(); + call.retrieveCall(args$); + __db_join_reply result$ = __DB_db_join_4001(args$); + call.reply(result$); + break; + } + case 44: { + __dbc_close_msg args$ = new __dbc_close_msg(); + call.retrieveCall(args$); + __dbc_close_reply result$ = __DB_dbc_close_4001(args$); + call.reply(result$); + break; + } + case 45: { + __dbc_count_msg args$ = new __dbc_count_msg(); + call.retrieveCall(args$); + __dbc_count_reply result$ = __DB_dbc_count_4001(args$); + call.reply(result$); + break; + } + case 46: { + __dbc_del_msg args$ = new __dbc_del_msg(); + call.retrieveCall(args$); + __dbc_del_reply result$ = __DB_dbc_del_4001(args$); + call.reply(result$); + break; + } + case 47: { + __dbc_dup_msg args$ = new __dbc_dup_msg(); + call.retrieveCall(args$); + __dbc_dup_reply result$ = __DB_dbc_dup_4001(args$); + call.reply(result$); + break; + } + case 48: { + __dbc_get_msg args$ = new __dbc_get_msg(); + call.retrieveCall(args$); + __dbc_get_reply result$ = __DB_dbc_get_4001(args$); + call.reply(result$); + break; + } + case 49: { + __dbc_pget_msg args$ = new __dbc_pget_msg(); + call.retrieveCall(args$); + __dbc_pget_reply result$ = __DB_dbc_pget_4001(args$); + call.reply(result$); + break; + } + case 50: { + __dbc_put_msg args$ = new __dbc_put_msg(); + call.retrieveCall(args$); + __dbc_put_reply result$ = __DB_dbc_put_4001(args$); + call.reply(result$); + break; + } + default: + call.failProcedureUnavailable(); + } + } else { + call.failProcedureUnavailable(); + } + } + + public abstract __env_cachesize_reply __DB_env_cachesize_4001(__env_cachesize_msg arg1); + + public abstract __env_close_reply __DB_env_close_4001(__env_close_msg arg1); + + public abstract __env_create_reply __DB_env_create_4001(__env_create_msg arg1); + + public abstract __env_dbremove_reply __DB_env_dbremove_4001(__env_dbremove_msg arg1); + + public abstract __env_dbrename_reply __DB_env_dbrename_4001(__env_dbrename_msg arg1); + + public abstract __env_encrypt_reply __DB_env_encrypt_4001(__env_encrypt_msg arg1); + + public abstract __env_flags_reply __DB_env_flags_4001(__env_flags_msg arg1); + + public abstract __env_open_reply __DB_env_open_4001(__env_open_msg arg1); + + public abstract __env_remove_reply __DB_env_remove_4001(__env_remove_msg arg1); + + public abstract __txn_abort_reply __DB_txn_abort_4001(__txn_abort_msg arg1); + + public abstract __txn_begin_reply __DB_txn_begin_4001(__txn_begin_msg arg1); + + public abstract __txn_commit_reply __DB_txn_commit_4001(__txn_commit_msg arg1); + + public abstract __txn_discard_reply __DB_txn_discard_4001(__txn_discard_msg arg1); + + public abstract __txn_prepare_reply __DB_txn_prepare_4001(__txn_prepare_msg arg1); + + public abstract __txn_recover_reply __DB_txn_recover_4001(__txn_recover_msg arg1); + + public abstract __db_associate_reply __DB_db_associate_4001(__db_associate_msg arg1); + + public abstract __db_bt_maxkey_reply __DB_db_bt_maxkey_4001(__db_bt_maxkey_msg arg1); + + public abstract __db_bt_minkey_reply __DB_db_bt_minkey_4001(__db_bt_minkey_msg arg1); + + public abstract __db_close_reply __DB_db_close_4001(__db_close_msg arg1); + + public abstract __db_create_reply __DB_db_create_4001(__db_create_msg arg1); + + public abstract __db_del_reply __DB_db_del_4001(__db_del_msg arg1); + + public abstract __db_encrypt_reply __DB_db_encrypt_4001(__db_encrypt_msg arg1); + + public abstract __db_extentsize_reply __DB_db_extentsize_4001(__db_extentsize_msg arg1); + + public abstract __db_flags_reply __DB_db_flags_4001(__db_flags_msg arg1); + + public abstract __db_get_reply __DB_db_get_4001(__db_get_msg arg1); + + public abstract __db_h_ffactor_reply __DB_db_h_ffactor_4001(__db_h_ffactor_msg arg1); + + public abstract __db_h_nelem_reply __DB_db_h_nelem_4001(__db_h_nelem_msg arg1); + + public abstract __db_key_range_reply __DB_db_key_range_4001(__db_key_range_msg arg1); + + public abstract __db_lorder_reply __DB_db_lorder_4001(__db_lorder_msg arg1); + + public abstract __db_open_reply __DB_db_open_4001(__db_open_msg arg1); + + public abstract __db_pagesize_reply __DB_db_pagesize_4001(__db_pagesize_msg arg1); + + public abstract __db_pget_reply __DB_db_pget_4001(__db_pget_msg arg1); + + public abstract __db_put_reply __DB_db_put_4001(__db_put_msg arg1); + + public abstract __db_re_delim_reply __DB_db_re_delim_4001(__db_re_delim_msg arg1); + + public abstract __db_re_len_reply __DB_db_re_len_4001(__db_re_len_msg arg1); + + public abstract __db_re_pad_reply __DB_db_re_pad_4001(__db_re_pad_msg arg1); + + public abstract __db_remove_reply __DB_db_remove_4001(__db_remove_msg arg1); + + public abstract __db_rename_reply __DB_db_rename_4001(__db_rename_msg arg1); + + public abstract __db_stat_reply __DB_db_stat_4001(__db_stat_msg arg1); + + public abstract __db_sync_reply __DB_db_sync_4001(__db_sync_msg arg1); + + public abstract __db_truncate_reply __DB_db_truncate_4001(__db_truncate_msg arg1); + + public abstract __db_cursor_reply __DB_db_cursor_4001(__db_cursor_msg arg1); + + public abstract __db_join_reply __DB_db_join_4001(__db_join_msg arg1); + + public abstract __dbc_close_reply __DB_dbc_close_4001(__dbc_close_msg arg1); + + public abstract __dbc_count_reply __DB_dbc_count_4001(__dbc_count_msg arg1); + + public abstract __dbc_del_reply __DB_dbc_del_4001(__dbc_del_msg arg1); + + public abstract __dbc_dup_reply __DB_dbc_dup_4001(__dbc_dup_msg arg1); + + public abstract __dbc_get_reply __DB_dbc_get_4001(__dbc_get_msg arg1); + + public abstract __dbc_pget_reply __DB_dbc_pget_4001(__dbc_pget_msg arg1); + + public abstract __dbc_put_reply __DB_dbc_put_4001(__dbc_put_msg arg1); + +} +// End of DbServerStub.java diff --git a/db/rpc_server/java/gen/__db_associate_msg.java b/db/rpc_server/java/gen/__db_associate_msg.java new file mode 100644 index 000000000..8977303b9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_associate_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 4/25/02 11:01 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_associate_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int sdbpcl_id; + public int flags; + + public __db_associate_msg() { + } + + public __db_associate_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(sdbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + sdbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_associate_msg.java diff --git a/db/rpc_server/java/gen/__db_associate_reply.java b/db/rpc_server/java/gen/__db_associate_reply.java new file mode 100644 index 000000000..476d0868b --- /dev/null +++ b/db/rpc_server/java/gen/__db_associate_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_associate_reply implements XdrAble { + public int status; + + public __db_associate_reply() { + } + + public __db_associate_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_associate_reply.java diff --git a/db/rpc_server/java/gen/__db_bt_maxkey_msg.java b/db/rpc_server/java/gen/__db_bt_maxkey_msg.java new file mode 100644 index 000000000..007ce16a9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_maxkey_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_maxkey_msg implements XdrAble { + public int dbpcl_id; + public int maxkey; + + public __db_bt_maxkey_msg() { + } + + public __db_bt_maxkey_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(maxkey); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + maxkey = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_maxkey_msg.java diff --git a/db/rpc_server/java/gen/__db_bt_maxkey_reply.java b/db/rpc_server/java/gen/__db_bt_maxkey_reply.java new file mode 100644 index 000000000..855573271 --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_maxkey_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_maxkey_reply implements XdrAble { + public int status; + + public __db_bt_maxkey_reply() { + } + + public __db_bt_maxkey_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_maxkey_reply.java diff --git a/db/rpc_server/java/gen/__db_bt_minkey_msg.java b/db/rpc_server/java/gen/__db_bt_minkey_msg.java new file mode 100644 index 000000000..c86ec3824 --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_minkey_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_minkey_msg implements XdrAble { + public int dbpcl_id; + public int minkey; + + public __db_bt_minkey_msg() { + } + + public __db_bt_minkey_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(minkey); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + minkey = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_minkey_msg.java diff --git a/db/rpc_server/java/gen/__db_bt_minkey_reply.java b/db/rpc_server/java/gen/__db_bt_minkey_reply.java new file mode 100644 index 000000000..4d944b6bf --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_minkey_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_minkey_reply implements XdrAble { + public int status; + + public __db_bt_minkey_reply() { + } + + public __db_bt_minkey_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_minkey_reply.java diff --git a/db/rpc_server/java/gen/__db_close_msg.java b/db/rpc_server/java/gen/__db_close_msg.java new file mode 100644 index 000000000..ce8d21370 --- /dev/null +++ b/db/rpc_server/java/gen/__db_close_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_close_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_close_msg() { + } + + public __db_close_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_close_msg.java diff --git a/db/rpc_server/java/gen/__db_close_reply.java b/db/rpc_server/java/gen/__db_close_reply.java new file mode 100644 index 000000000..a9380e9c0 --- /dev/null +++ b/db/rpc_server/java/gen/__db_close_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_close_reply implements XdrAble { + public int status; + + public __db_close_reply() { + } + + public __db_close_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_close_reply.java diff --git a/db/rpc_server/java/gen/__db_create_msg.java b/db/rpc_server/java/gen/__db_create_msg.java new file mode 100644 index 000000000..d21ca50f8 --- /dev/null +++ b/db/rpc_server/java/gen/__db_create_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_create_msg implements XdrAble { + public int dbenvcl_id; + public int flags; + + public __db_create_msg() { + } + + public __db_create_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_create_msg.java diff --git a/db/rpc_server/java/gen/__db_create_reply.java b/db/rpc_server/java/gen/__db_create_reply.java new file mode 100644 index 000000000..e3dcbbab1 --- /dev/null +++ b/db/rpc_server/java/gen/__db_create_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_create_reply implements XdrAble { + public int status; + public int dbcl_id; + + public __db_create_reply() { + } + + public __db_create_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __db_create_reply.java diff --git a/db/rpc_server/java/gen/__db_cursor_msg.java b/db/rpc_server/java/gen/__db_cursor_msg.java new file mode 100644 index 000000000..60e09db6e --- /dev/null +++ b/db/rpc_server/java/gen/__db_cursor_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_cursor_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int flags; + + public __db_cursor_msg() { + } + + public __db_cursor_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_cursor_msg.java diff --git a/db/rpc_server/java/gen/__db_cursor_reply.java b/db/rpc_server/java/gen/__db_cursor_reply.java new file mode 100644 index 000000000..bafd2817c --- /dev/null +++ b/db/rpc_server/java/gen/__db_cursor_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_cursor_reply implements XdrAble { + public int status; + public int dbcidcl_id; + + public __db_cursor_reply() { + } + + public __db_cursor_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __db_cursor_reply.java diff --git a/db/rpc_server/java/gen/__db_del_msg.java b/db/rpc_server/java/gen/__db_del_msg.java new file mode 100644 index 000000000..fdf47907d --- /dev/null +++ b/db/rpc_server/java/gen/__db_del_msg.java @@ -0,0 +1,53 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_del_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int flags; + + public __db_del_msg() { + } + + public __db_del_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_del_msg.java diff --git a/db/rpc_server/java/gen/__db_del_reply.java b/db/rpc_server/java/gen/__db_del_reply.java new file mode 100644 index 000000000..8a5544594 --- /dev/null +++ b/db/rpc_server/java/gen/__db_del_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_del_reply implements XdrAble { + public int status; + + public __db_del_reply() { + } + + public __db_del_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_del_reply.java diff --git a/db/rpc_server/java/gen/__db_encrypt_msg.java b/db/rpc_server/java/gen/__db_encrypt_msg.java new file mode 100644 index 000000000..46d9f8ee7 --- /dev/null +++ b/db/rpc_server/java/gen/__db_encrypt_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_encrypt_msg implements XdrAble { + public int dbpcl_id; + public String passwd; + public int flags; + + public __db_encrypt_msg() { + } + + public __db_encrypt_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeString(passwd); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + passwd = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_encrypt_msg.java diff --git a/db/rpc_server/java/gen/__db_encrypt_reply.java b/db/rpc_server/java/gen/__db_encrypt_reply.java new file mode 100644 index 000000000..a97cc98c9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_encrypt_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_encrypt_reply implements XdrAble { + public int status; + + public __db_encrypt_reply() { + } + + public __db_encrypt_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_encrypt_reply.java diff --git a/db/rpc_server/java/gen/__db_extentsize_msg.java b/db/rpc_server/java/gen/__db_extentsize_msg.java new file mode 100644 index 000000000..41a51cff9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_extentsize_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_extentsize_msg implements XdrAble { + public int dbpcl_id; + public int extentsize; + + public __db_extentsize_msg() { + } + + public __db_extentsize_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(extentsize); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + extentsize = xdr.xdrDecodeInt(); + } + +} +// End of __db_extentsize_msg.java diff --git a/db/rpc_server/java/gen/__db_extentsize_reply.java b/db/rpc_server/java/gen/__db_extentsize_reply.java new file mode 100644 index 000000000..409625486 --- /dev/null +++ b/db/rpc_server/java/gen/__db_extentsize_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_extentsize_reply implements XdrAble { + public int status; + + public __db_extentsize_reply() { + } + + public __db_extentsize_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_extentsize_reply.java diff --git a/db/rpc_server/java/gen/__db_flags_msg.java b/db/rpc_server/java/gen/__db_flags_msg.java new file mode 100644 index 000000000..d8752e2e4 --- /dev/null +++ b/db/rpc_server/java/gen/__db_flags_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_flags_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_flags_msg() { + } + + public __db_flags_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_flags_msg.java diff --git a/db/rpc_server/java/gen/__db_flags_reply.java b/db/rpc_server/java/gen/__db_flags_reply.java new file mode 100644 index 000000000..c4ec253db --- /dev/null +++ b/db/rpc_server/java/gen/__db_flags_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_flags_reply implements XdrAble { + public int status; + + public __db_flags_reply() { + } + + public __db_flags_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_flags_reply.java diff --git a/db/rpc_server/java/gen/__db_get_msg.java b/db/rpc_server/java/gen/__db_get_msg.java new file mode 100644 index 000000000..3dfe8e9d8 --- /dev/null +++ b/db/rpc_server/java/gen/__db_get_msg.java @@ -0,0 +1,68 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_get_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __db_get_msg() { + } + + public __db_get_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_get_msg.java diff --git a/db/rpc_server/java/gen/__db_get_reply.java b/db/rpc_server/java/gen/__db_get_reply.java new file mode 100644 index 000000000..64ce52572 --- /dev/null +++ b/db/rpc_server/java/gen/__db_get_reply.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_get_reply implements XdrAble { + public int status; + public byte [] keydata; + public byte [] datadata; + + public __db_get_reply() { + } + + public __db_get_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __db_get_reply.java diff --git a/db/rpc_server/java/gen/__db_h_ffactor_msg.java b/db/rpc_server/java/gen/__db_h_ffactor_msg.java new file mode 100644 index 000000000..8d2ed1b1c --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_ffactor_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_ffactor_msg implements XdrAble { + public int dbpcl_id; + public int ffactor; + + public __db_h_ffactor_msg() { + } + + public __db_h_ffactor_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(ffactor); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + ffactor = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_ffactor_msg.java diff --git a/db/rpc_server/java/gen/__db_h_ffactor_reply.java b/db/rpc_server/java/gen/__db_h_ffactor_reply.java new file mode 100644 index 000000000..1885ec502 --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_ffactor_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_ffactor_reply implements XdrAble { + public int status; + + public __db_h_ffactor_reply() { + } + + public __db_h_ffactor_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_ffactor_reply.java diff --git a/db/rpc_server/java/gen/__db_h_nelem_msg.java b/db/rpc_server/java/gen/__db_h_nelem_msg.java new file mode 100644 index 000000000..7d0843517 --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_nelem_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_nelem_msg implements XdrAble { + public int dbpcl_id; + public int nelem; + + public __db_h_nelem_msg() { + } + + public __db_h_nelem_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(nelem); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + nelem = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_nelem_msg.java diff --git a/db/rpc_server/java/gen/__db_h_nelem_reply.java b/db/rpc_server/java/gen/__db_h_nelem_reply.java new file mode 100644 index 000000000..20c5c774e --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_nelem_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_nelem_reply implements XdrAble { + public int status; + + public __db_h_nelem_reply() { + } + + public __db_h_nelem_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_nelem_reply.java diff --git a/db/rpc_server/java/gen/__db_join_msg.java b/db/rpc_server/java/gen/__db_join_msg.java new file mode 100644 index 000000000..88c72dbd6 --- /dev/null +++ b/db/rpc_server/java/gen/__db_join_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_join_msg implements XdrAble { + public int dbpcl_id; + public int [] curs; + public int flags; + + public __db_join_msg() { + } + + public __db_join_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeIntVector(curs); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + curs = xdr.xdrDecodeIntVector(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_join_msg.java diff --git a/db/rpc_server/java/gen/__db_join_reply.java b/db/rpc_server/java/gen/__db_join_reply.java new file mode 100644 index 000000000..80980e23d --- /dev/null +++ b/db/rpc_server/java/gen/__db_join_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_join_reply implements XdrAble { + public int status; + public int dbcidcl_id; + + public __db_join_reply() { + } + + public __db_join_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __db_join_reply.java diff --git a/db/rpc_server/java/gen/__db_key_range_msg.java b/db/rpc_server/java/gen/__db_key_range_msg.java new file mode 100644 index 000000000..233077e09 --- /dev/null +++ b/db/rpc_server/java/gen/__db_key_range_msg.java @@ -0,0 +1,53 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_key_range_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int flags; + + public __db_key_range_msg() { + } + + public __db_key_range_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_key_range_msg.java diff --git a/db/rpc_server/java/gen/__db_key_range_reply.java b/db/rpc_server/java/gen/__db_key_range_reply.java new file mode 100644 index 000000000..09244c13d --- /dev/null +++ b/db/rpc_server/java/gen/__db_key_range_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_key_range_reply implements XdrAble { + public int status; + public double less; + public double equal; + public double greater; + + public __db_key_range_reply() { + } + + public __db_key_range_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDouble(less); + xdr.xdrEncodeDouble(equal); + xdr.xdrEncodeDouble(greater); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + less = xdr.xdrDecodeDouble(); + equal = xdr.xdrDecodeDouble(); + greater = xdr.xdrDecodeDouble(); + } + +} +// End of __db_key_range_reply.java diff --git a/db/rpc_server/java/gen/__db_lorder_msg.java b/db/rpc_server/java/gen/__db_lorder_msg.java new file mode 100644 index 000000000..3399ad8da --- /dev/null +++ b/db/rpc_server/java/gen/__db_lorder_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_lorder_msg implements XdrAble { + public int dbpcl_id; + public int lorder; + + public __db_lorder_msg() { + } + + public __db_lorder_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(lorder); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + lorder = xdr.xdrDecodeInt(); + } + +} +// End of __db_lorder_msg.java diff --git a/db/rpc_server/java/gen/__db_lorder_reply.java b/db/rpc_server/java/gen/__db_lorder_reply.java new file mode 100644 index 000000000..cdcda4d4f --- /dev/null +++ b/db/rpc_server/java/gen/__db_lorder_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_lorder_reply implements XdrAble { + public int status; + + public __db_lorder_reply() { + } + + public __db_lorder_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_lorder_reply.java diff --git a/db/rpc_server/java/gen/__db_open_msg.java b/db/rpc_server/java/gen/__db_open_msg.java new file mode 100644 index 000000000..14dbd9e3b --- /dev/null +++ b/db/rpc_server/java/gen/__db_open_msg.java @@ -0,0 +1,50 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_open_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public String name; + public String subdb; + public int type; + public int flags; + public int mode; + + public __db_open_msg() { + } + + public __db_open_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeInt(type); + xdr.xdrEncodeInt(flags); + xdr.xdrEncodeInt(mode); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + type = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + mode = xdr.xdrDecodeInt(); + } + +} +// End of __db_open_msg.java diff --git a/db/rpc_server/java/gen/__db_open_reply.java b/db/rpc_server/java/gen/__db_open_reply.java new file mode 100644 index 000000000..d90c3754c --- /dev/null +++ b/db/rpc_server/java/gen/__db_open_reply.java @@ -0,0 +1,44 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_open_reply implements XdrAble { + public int status; + public int dbcl_id; + public int type; + public int dbflags; + public int lorder; + + public __db_open_reply() { + } + + public __db_open_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcl_id); + xdr.xdrEncodeInt(type); + xdr.xdrEncodeInt(dbflags); + xdr.xdrEncodeInt(lorder); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcl_id = xdr.xdrDecodeInt(); + type = xdr.xdrDecodeInt(); + dbflags = xdr.xdrDecodeInt(); + lorder = xdr.xdrDecodeInt(); + } + +} +// End of __db_open_reply.java diff --git a/db/rpc_server/java/gen/__db_pagesize_msg.java b/db/rpc_server/java/gen/__db_pagesize_msg.java new file mode 100644 index 000000000..a452ea4e3 --- /dev/null +++ b/db/rpc_server/java/gen/__db_pagesize_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pagesize_msg implements XdrAble { + public int dbpcl_id; + public int pagesize; + + public __db_pagesize_msg() { + } + + public __db_pagesize_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(pagesize); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + pagesize = xdr.xdrDecodeInt(); + } + +} +// End of __db_pagesize_msg.java diff --git a/db/rpc_server/java/gen/__db_pagesize_reply.java b/db/rpc_server/java/gen/__db_pagesize_reply.java new file mode 100644 index 000000000..830b2078b --- /dev/null +++ b/db/rpc_server/java/gen/__db_pagesize_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pagesize_reply implements XdrAble { + public int status; + + public __db_pagesize_reply() { + } + + public __db_pagesize_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_pagesize_reply.java diff --git a/db/rpc_server/java/gen/__db_pget_msg.java b/db/rpc_server/java/gen/__db_pget_msg.java new file mode 100644 index 000000000..11d27ca9e --- /dev/null +++ b/db/rpc_server/java/gen/__db_pget_msg.java @@ -0,0 +1,83 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pget_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int skeydlen; + public int skeydoff; + public int skeyulen; + public int skeyflags; + public byte [] skeydata; + public int pkeydlen; + public int pkeydoff; + public int pkeyulen; + public int pkeyflags; + public byte [] pkeydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __db_pget_msg() { + } + + public __db_pget_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(skeydlen); + xdr.xdrEncodeInt(skeydoff); + xdr.xdrEncodeInt(skeyulen); + xdr.xdrEncodeInt(skeyflags); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeInt(pkeydlen); + xdr.xdrEncodeInt(pkeydoff); + xdr.xdrEncodeInt(pkeyulen); + xdr.xdrEncodeInt(pkeyflags); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + skeydlen = xdr.xdrDecodeInt(); + skeydoff = xdr.xdrDecodeInt(); + skeyulen = xdr.xdrDecodeInt(); + skeyflags = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydlen = xdr.xdrDecodeInt(); + pkeydoff = xdr.xdrDecodeInt(); + pkeyulen = xdr.xdrDecodeInt(); + pkeyflags = xdr.xdrDecodeInt(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_pget_msg.java diff --git a/db/rpc_server/java/gen/__db_pget_reply.java b/db/rpc_server/java/gen/__db_pget_reply.java new file mode 100644 index 000000000..86c9c2111 --- /dev/null +++ b/db/rpc_server/java/gen/__db_pget_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pget_reply implements XdrAble { + public int status; + public byte [] skeydata; + public byte [] pkeydata; + public byte [] datadata; + + public __db_pget_reply() { + } + + public __db_pget_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __db_pget_reply.java diff --git a/db/rpc_server/java/gen/__db_put_msg.java b/db/rpc_server/java/gen/__db_put_msg.java new file mode 100644 index 000000000..b6159cff3 --- /dev/null +++ b/db/rpc_server/java/gen/__db_put_msg.java @@ -0,0 +1,68 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_put_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __db_put_msg() { + } + + public __db_put_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_put_msg.java diff --git a/db/rpc_server/java/gen/__db_put_reply.java b/db/rpc_server/java/gen/__db_put_reply.java new file mode 100644 index 000000000..fc89ae1c3 --- /dev/null +++ b/db/rpc_server/java/gen/__db_put_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_put_reply implements XdrAble { + public int status; + public byte [] keydata; + + public __db_put_reply() { + } + + public __db_put_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __db_put_reply.java diff --git a/db/rpc_server/java/gen/__db_re_delim_msg.java b/db/rpc_server/java/gen/__db_re_delim_msg.java new file mode 100644 index 000000000..c386bddd2 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_delim_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_delim_msg implements XdrAble { + public int dbpcl_id; + public int delim; + + public __db_re_delim_msg() { + } + + public __db_re_delim_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(delim); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + delim = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_delim_msg.java diff --git a/db/rpc_server/java/gen/__db_re_delim_reply.java b/db/rpc_server/java/gen/__db_re_delim_reply.java new file mode 100644 index 000000000..aa8a797f5 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_delim_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_delim_reply implements XdrAble { + public int status; + + public __db_re_delim_reply() { + } + + public __db_re_delim_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_delim_reply.java diff --git a/db/rpc_server/java/gen/__db_re_len_msg.java b/db/rpc_server/java/gen/__db_re_len_msg.java new file mode 100644 index 000000000..664de5c89 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_len_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_len_msg implements XdrAble { + public int dbpcl_id; + public int len; + + public __db_re_len_msg() { + } + + public __db_re_len_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(len); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + len = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_len_msg.java diff --git a/db/rpc_server/java/gen/__db_re_len_reply.java b/db/rpc_server/java/gen/__db_re_len_reply.java new file mode 100644 index 000000000..dda27c8c1 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_len_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_len_reply implements XdrAble { + public int status; + + public __db_re_len_reply() { + } + + public __db_re_len_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_len_reply.java diff --git a/db/rpc_server/java/gen/__db_re_pad_msg.java b/db/rpc_server/java/gen/__db_re_pad_msg.java new file mode 100644 index 000000000..2c1290b6e --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_pad_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_pad_msg implements XdrAble { + public int dbpcl_id; + public int pad; + + public __db_re_pad_msg() { + } + + public __db_re_pad_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(pad); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + pad = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_pad_msg.java diff --git a/db/rpc_server/java/gen/__db_re_pad_reply.java b/db/rpc_server/java/gen/__db_re_pad_reply.java new file mode 100644 index 000000000..f0aaa9a3a --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_pad_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_pad_reply implements XdrAble { + public int status; + + public __db_re_pad_reply() { + } + + public __db_re_pad_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_pad_reply.java diff --git a/db/rpc_server/java/gen/__db_remove_msg.java b/db/rpc_server/java/gen/__db_remove_msg.java new file mode 100644 index 000000000..dfa9066a7 --- /dev/null +++ b/db/rpc_server/java/gen/__db_remove_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_remove_msg implements XdrAble { + public int dbpcl_id; + public String name; + public String subdb; + public int flags; + + public __db_remove_msg() { + } + + public __db_remove_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_remove_msg.java diff --git a/db/rpc_server/java/gen/__db_remove_reply.java b/db/rpc_server/java/gen/__db_remove_reply.java new file mode 100644 index 000000000..a2b86c049 --- /dev/null +++ b/db/rpc_server/java/gen/__db_remove_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_remove_reply implements XdrAble { + public int status; + + public __db_remove_reply() { + } + + public __db_remove_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_remove_reply.java diff --git a/db/rpc_server/java/gen/__db_rename_msg.java b/db/rpc_server/java/gen/__db_rename_msg.java new file mode 100644 index 000000000..12b434e33 --- /dev/null +++ b/db/rpc_server/java/gen/__db_rename_msg.java @@ -0,0 +1,44 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_rename_msg implements XdrAble { + public int dbpcl_id; + public String name; + public String subdb; + public String newname; + public int flags; + + public __db_rename_msg() { + } + + public __db_rename_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeString(newname); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + newname = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_rename_msg.java diff --git a/db/rpc_server/java/gen/__db_rename_reply.java b/db/rpc_server/java/gen/__db_rename_reply.java new file mode 100644 index 000000000..4e4a22be5 --- /dev/null +++ b/db/rpc_server/java/gen/__db_rename_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_rename_reply implements XdrAble { + public int status; + + public __db_rename_reply() { + } + + public __db_rename_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_rename_reply.java diff --git a/db/rpc_server/java/gen/__db_stat_msg.java b/db/rpc_server/java/gen/__db_stat_msg.java new file mode 100644 index 000000000..af536b5f7 --- /dev/null +++ b/db/rpc_server/java/gen/__db_stat_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_stat_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_stat_msg() { + } + + public __db_stat_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_stat_msg.java diff --git a/db/rpc_server/java/gen/__db_stat_reply.java b/db/rpc_server/java/gen/__db_stat_reply.java new file mode 100644 index 000000000..8df146014 --- /dev/null +++ b/db/rpc_server/java/gen/__db_stat_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_stat_reply implements XdrAble { + public int status; + public int [] stats; + + public __db_stat_reply() { + } + + public __db_stat_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeIntVector(stats); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + stats = xdr.xdrDecodeIntVector(); + } + +} +// End of __db_stat_reply.java diff --git a/db/rpc_server/java/gen/__db_sync_msg.java b/db/rpc_server/java/gen/__db_sync_msg.java new file mode 100644 index 000000000..c6594670f --- /dev/null +++ b/db/rpc_server/java/gen/__db_sync_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_sync_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_sync_msg() { + } + + public __db_sync_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_sync_msg.java diff --git a/db/rpc_server/java/gen/__db_sync_reply.java b/db/rpc_server/java/gen/__db_sync_reply.java new file mode 100644 index 000000000..d0a8bc8b1 --- /dev/null +++ b/db/rpc_server/java/gen/__db_sync_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_sync_reply implements XdrAble { + public int status; + + public __db_sync_reply() { + } + + public __db_sync_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_sync_reply.java diff --git a/db/rpc_server/java/gen/__db_truncate_msg.java b/db/rpc_server/java/gen/__db_truncate_msg.java new file mode 100644 index 000000000..38810d656 --- /dev/null +++ b/db/rpc_server/java/gen/__db_truncate_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_truncate_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int flags; + + public __db_truncate_msg() { + } + + public __db_truncate_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_truncate_msg.java diff --git a/db/rpc_server/java/gen/__db_truncate_reply.java b/db/rpc_server/java/gen/__db_truncate_reply.java new file mode 100644 index 000000000..c4f688690 --- /dev/null +++ b/db/rpc_server/java/gen/__db_truncate_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_truncate_reply implements XdrAble { + public int status; + public int count; + + public __db_truncate_reply() { + } + + public __db_truncate_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(count); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + count = xdr.xdrDecodeInt(); + } + +} +// End of __db_truncate_reply.java diff --git a/db/rpc_server/java/gen/__dbc_close_msg.java b/db/rpc_server/java/gen/__dbc_close_msg.java new file mode 100644 index 000000000..eb1ca7f7e --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_close_msg.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_close_msg implements XdrAble { + public int dbccl_id; + + public __dbc_close_msg() { + } + + public __dbc_close_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_close_msg.java diff --git a/db/rpc_server/java/gen/__dbc_close_reply.java b/db/rpc_server/java/gen/__dbc_close_reply.java new file mode 100644 index 000000000..47459aace --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_close_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_close_reply implements XdrAble { + public int status; + + public __dbc_close_reply() { + } + + public __dbc_close_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_close_reply.java diff --git a/db/rpc_server/java/gen/__dbc_count_msg.java b/db/rpc_server/java/gen/__dbc_count_msg.java new file mode 100644 index 000000000..5f554e18a --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_count_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_count_msg implements XdrAble { + public int dbccl_id; + public int flags; + + public __dbc_count_msg() { + } + + public __dbc_count_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_count_msg.java diff --git a/db/rpc_server/java/gen/__dbc_count_reply.java b/db/rpc_server/java/gen/__dbc_count_reply.java new file mode 100644 index 000000000..4daecdd22 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_count_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_count_reply implements XdrAble { + public int status; + public int dupcount; + + public __dbc_count_reply() { + } + + public __dbc_count_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dupcount); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dupcount = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_count_reply.java diff --git a/db/rpc_server/java/gen/__dbc_del_msg.java b/db/rpc_server/java/gen/__dbc_del_msg.java new file mode 100644 index 000000000..bc4bd05f5 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_del_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_del_msg implements XdrAble { + public int dbccl_id; + public int flags; + + public __dbc_del_msg() { + } + + public __dbc_del_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_del_msg.java diff --git a/db/rpc_server/java/gen/__dbc_del_reply.java b/db/rpc_server/java/gen/__dbc_del_reply.java new file mode 100644 index 000000000..e55ac9ffa --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_del_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_del_reply implements XdrAble { + public int status; + + public __dbc_del_reply() { + } + + public __dbc_del_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_del_reply.java diff --git a/db/rpc_server/java/gen/__dbc_dup_msg.java b/db/rpc_server/java/gen/__dbc_dup_msg.java new file mode 100644 index 000000000..9a3894e61 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_dup_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_dup_msg implements XdrAble { + public int dbccl_id; + public int flags; + + public __dbc_dup_msg() { + } + + public __dbc_dup_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_dup_msg.java diff --git a/db/rpc_server/java/gen/__dbc_dup_reply.java b/db/rpc_server/java/gen/__dbc_dup_reply.java new file mode 100644 index 000000000..6b942f1a6 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_dup_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_dup_reply implements XdrAble { + public int status; + public int dbcidcl_id; + + public __dbc_dup_reply() { + } + + public __dbc_dup_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_dup_reply.java diff --git a/db/rpc_server/java/gen/__dbc_get_msg.java b/db/rpc_server/java/gen/__dbc_get_msg.java new file mode 100644 index 000000000..672ace43f --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_get_msg.java @@ -0,0 +1,65 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_get_msg implements XdrAble { + public int dbccl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __dbc_get_msg() { + } + + public __dbc_get_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_get_msg.java diff --git a/db/rpc_server/java/gen/__dbc_get_reply.java b/db/rpc_server/java/gen/__dbc_get_reply.java new file mode 100644 index 000000000..8671fec63 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_get_reply.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_get_reply implements XdrAble { + public int status; + public byte [] keydata; + public byte [] datadata; + + public __dbc_get_reply() { + } + + public __dbc_get_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __dbc_get_reply.java diff --git a/db/rpc_server/java/gen/__dbc_pget_msg.java b/db/rpc_server/java/gen/__dbc_pget_msg.java new file mode 100644 index 000000000..8ca3c6171 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_pget_msg.java @@ -0,0 +1,80 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_pget_msg implements XdrAble { + public int dbccl_id; + public int skeydlen; + public int skeydoff; + public int skeyulen; + public int skeyflags; + public byte [] skeydata; + public int pkeydlen; + public int pkeydoff; + public int pkeyulen; + public int pkeyflags; + public byte [] pkeydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __dbc_pget_msg() { + } + + public __dbc_pget_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(skeydlen); + xdr.xdrEncodeInt(skeydoff); + xdr.xdrEncodeInt(skeyulen); + xdr.xdrEncodeInt(skeyflags); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeInt(pkeydlen); + xdr.xdrEncodeInt(pkeydoff); + xdr.xdrEncodeInt(pkeyulen); + xdr.xdrEncodeInt(pkeyflags); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + skeydlen = xdr.xdrDecodeInt(); + skeydoff = xdr.xdrDecodeInt(); + skeyulen = xdr.xdrDecodeInt(); + skeyflags = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydlen = xdr.xdrDecodeInt(); + pkeydoff = xdr.xdrDecodeInt(); + pkeyulen = xdr.xdrDecodeInt(); + pkeyflags = xdr.xdrDecodeInt(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_pget_msg.java diff --git a/db/rpc_server/java/gen/__dbc_pget_reply.java b/db/rpc_server/java/gen/__dbc_pget_reply.java new file mode 100644 index 000000000..16cc79587 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_pget_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_pget_reply implements XdrAble { + public int status; + public byte [] skeydata; + public byte [] pkeydata; + public byte [] datadata; + + public __dbc_pget_reply() { + } + + public __dbc_pget_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __dbc_pget_reply.java diff --git a/db/rpc_server/java/gen/__dbc_put_msg.java b/db/rpc_server/java/gen/__dbc_put_msg.java new file mode 100644 index 000000000..98d12423d --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_put_msg.java @@ -0,0 +1,65 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_put_msg implements XdrAble { + public int dbccl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __dbc_put_msg() { + } + + public __dbc_put_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_put_msg.java diff --git a/db/rpc_server/java/gen/__dbc_put_reply.java b/db/rpc_server/java/gen/__dbc_put_reply.java new file mode 100644 index 000000000..385f9f783 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_put_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_put_reply implements XdrAble { + public int status; + public byte [] keydata; + + public __dbc_put_reply() { + } + + public __dbc_put_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __dbc_put_reply.java diff --git a/db/rpc_server/java/gen/__env_cachesize_msg.java b/db/rpc_server/java/gen/__env_cachesize_msg.java new file mode 100644 index 000000000..d1fce1ffa --- /dev/null +++ b/db/rpc_server/java/gen/__env_cachesize_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_cachesize_msg implements XdrAble { + public int dbenvcl_id; + public int gbytes; + public int bytes; + public int ncache; + + public __env_cachesize_msg() { + } + + public __env_cachesize_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(gbytes); + xdr.xdrEncodeInt(bytes); + xdr.xdrEncodeInt(ncache); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + gbytes = xdr.xdrDecodeInt(); + bytes = xdr.xdrDecodeInt(); + ncache = xdr.xdrDecodeInt(); + } + +} +// End of __env_cachesize_msg.java diff --git a/db/rpc_server/java/gen/__env_cachesize_reply.java b/db/rpc_server/java/gen/__env_cachesize_reply.java new file mode 100644 index 000000000..193f8355d --- /dev/null +++ b/db/rpc_server/java/gen/__env_cachesize_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_cachesize_reply implements XdrAble { + public int status; + + public __env_cachesize_reply() { + } + + public __env_cachesize_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_cachesize_reply.java diff --git a/db/rpc_server/java/gen/__env_close_msg.java b/db/rpc_server/java/gen/__env_close_msg.java new file mode 100644 index 000000000..5e657bacf --- /dev/null +++ b/db/rpc_server/java/gen/__env_close_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_close_msg implements XdrAble { + public int dbenvcl_id; + public int flags; + + public __env_close_msg() { + } + + public __env_close_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_close_msg.java diff --git a/db/rpc_server/java/gen/__env_close_reply.java b/db/rpc_server/java/gen/__env_close_reply.java new file mode 100644 index 000000000..11e61f7c8 --- /dev/null +++ b/db/rpc_server/java/gen/__env_close_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_close_reply implements XdrAble { + public int status; + + public __env_close_reply() { + } + + public __env_close_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_close_reply.java diff --git a/db/rpc_server/java/gen/__env_create_msg.java b/db/rpc_server/java/gen/__env_create_msg.java new file mode 100644 index 000000000..dbe546ae2 --- /dev/null +++ b/db/rpc_server/java/gen/__env_create_msg.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_create_msg implements XdrAble { + public int timeout; + + public __env_create_msg() { + } + + public __env_create_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(timeout); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + timeout = xdr.xdrDecodeInt(); + } + +} +// End of __env_create_msg.java diff --git a/db/rpc_server/java/gen/__env_create_reply.java b/db/rpc_server/java/gen/__env_create_reply.java new file mode 100644 index 000000000..5427fc4bc --- /dev/null +++ b/db/rpc_server/java/gen/__env_create_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_create_reply implements XdrAble { + public int status; + public int envcl_id; + + public __env_create_reply() { + } + + public __env_create_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(envcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + envcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __env_create_reply.java diff --git a/db/rpc_server/java/gen/__env_dbremove_msg.java b/db/rpc_server/java/gen/__env_dbremove_msg.java new file mode 100644 index 000000000..9730a92c5 --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbremove_msg.java @@ -0,0 +1,44 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbremove_msg implements XdrAble { + public int dbenvcl_id; + public int txnpcl_id; + public String name; + public String subdb; + public int flags; + + public __env_dbremove_msg() { + } + + public __env_dbremove_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbremove_msg.java diff --git a/db/rpc_server/java/gen/__env_dbremove_reply.java b/db/rpc_server/java/gen/__env_dbremove_reply.java new file mode 100644 index 000000000..75cc5a940 --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbremove_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbremove_reply implements XdrAble { + public int status; + + public __env_dbremove_reply() { + } + + public __env_dbremove_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbremove_reply.java diff --git a/db/rpc_server/java/gen/__env_dbrename_msg.java b/db/rpc_server/java/gen/__env_dbrename_msg.java new file mode 100644 index 000000000..0bbda262b --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbrename_msg.java @@ -0,0 +1,47 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbrename_msg implements XdrAble { + public int dbenvcl_id; + public int txnpcl_id; + public String name; + public String subdb; + public String newname; + public int flags; + + public __env_dbrename_msg() { + } + + public __env_dbrename_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeString(newname); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + newname = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbrename_msg.java diff --git a/db/rpc_server/java/gen/__env_dbrename_reply.java b/db/rpc_server/java/gen/__env_dbrename_reply.java new file mode 100644 index 000000000..0cc888230 --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbrename_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbrename_reply implements XdrAble { + public int status; + + public __env_dbrename_reply() { + } + + public __env_dbrename_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbrename_reply.java diff --git a/db/rpc_server/java/gen/__env_encrypt_msg.java b/db/rpc_server/java/gen/__env_encrypt_msg.java new file mode 100644 index 000000000..84e9a36d3 --- /dev/null +++ b/db/rpc_server/java/gen/__env_encrypt_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_encrypt_msg implements XdrAble { + public int dbenvcl_id; + public String passwd; + public int flags; + + public __env_encrypt_msg() { + } + + public __env_encrypt_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeString(passwd); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + passwd = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_encrypt_msg.java diff --git a/db/rpc_server/java/gen/__env_encrypt_reply.java b/db/rpc_server/java/gen/__env_encrypt_reply.java new file mode 100644 index 000000000..e202a3089 --- /dev/null +++ b/db/rpc_server/java/gen/__env_encrypt_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_encrypt_reply implements XdrAble { + public int status; + + public __env_encrypt_reply() { + } + + public __env_encrypt_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_encrypt_reply.java diff --git a/db/rpc_server/java/gen/__env_flags_msg.java b/db/rpc_server/java/gen/__env_flags_msg.java new file mode 100644 index 000000000..25cd5f85f --- /dev/null +++ b/db/rpc_server/java/gen/__env_flags_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_flags_msg implements XdrAble { + public int dbenvcl_id; + public int flags; + public int onoff; + + public __env_flags_msg() { + } + + public __env_flags_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(flags); + xdr.xdrEncodeInt(onoff); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + onoff = xdr.xdrDecodeInt(); + } + +} +// End of __env_flags_msg.java diff --git a/db/rpc_server/java/gen/__env_flags_reply.java b/db/rpc_server/java/gen/__env_flags_reply.java new file mode 100644 index 000000000..d348a9224 --- /dev/null +++ b/db/rpc_server/java/gen/__env_flags_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_flags_reply implements XdrAble { + public int status; + + public __env_flags_reply() { + } + + public __env_flags_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_flags_reply.java diff --git a/db/rpc_server/java/gen/__env_open_msg.java b/db/rpc_server/java/gen/__env_open_msg.java new file mode 100644 index 000000000..e4649b41f --- /dev/null +++ b/db/rpc_server/java/gen/__env_open_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_open_msg implements XdrAble { + public int dbenvcl_id; + public String home; + public int flags; + public int mode; + + public __env_open_msg() { + } + + public __env_open_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeString(home); + xdr.xdrEncodeInt(flags); + xdr.xdrEncodeInt(mode); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + home = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + mode = xdr.xdrDecodeInt(); + } + +} +// End of __env_open_msg.java diff --git a/db/rpc_server/java/gen/__env_open_reply.java b/db/rpc_server/java/gen/__env_open_reply.java new file mode 100644 index 000000000..1994afb4c --- /dev/null +++ b/db/rpc_server/java/gen/__env_open_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_open_reply implements XdrAble { + public int status; + public int envcl_id; + + public __env_open_reply() { + } + + public __env_open_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(envcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + envcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __env_open_reply.java diff --git a/db/rpc_server/java/gen/__env_remove_msg.java b/db/rpc_server/java/gen/__env_remove_msg.java new file mode 100644 index 000000000..b32d758f0 --- /dev/null +++ b/db/rpc_server/java/gen/__env_remove_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_remove_msg implements XdrAble { + public int dbenvcl_id; + public String home; + public int flags; + + public __env_remove_msg() { + } + + public __env_remove_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeString(home); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + home = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_remove_msg.java diff --git a/db/rpc_server/java/gen/__env_remove_reply.java b/db/rpc_server/java/gen/__env_remove_reply.java new file mode 100644 index 000000000..19e4d52f6 --- /dev/null +++ b/db/rpc_server/java/gen/__env_remove_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_remove_reply implements XdrAble { + public int status; + + public __env_remove_reply() { + } + + public __env_remove_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_remove_reply.java diff --git a/db/rpc_server/java/gen/__txn_abort_msg.java b/db/rpc_server/java/gen/__txn_abort_msg.java new file mode 100644 index 000000000..ff44c534e --- /dev/null +++ b/db/rpc_server/java/gen/__txn_abort_msg.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_abort_msg implements XdrAble { + public int txnpcl_id; + + public __txn_abort_msg() { + } + + public __txn_abort_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __txn_abort_msg.java diff --git a/db/rpc_server/java/gen/__txn_abort_reply.java b/db/rpc_server/java/gen/__txn_abort_reply.java new file mode 100644 index 000000000..58f275c1a --- /dev/null +++ b/db/rpc_server/java/gen/__txn_abort_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_abort_reply implements XdrAble { + public int status; + + public __txn_abort_reply() { + } + + public __txn_abort_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_abort_reply.java diff --git a/db/rpc_server/java/gen/__txn_begin_msg.java b/db/rpc_server/java/gen/__txn_begin_msg.java new file mode 100644 index 000000000..877031e8d --- /dev/null +++ b/db/rpc_server/java/gen/__txn_begin_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_begin_msg implements XdrAble { + public int dbenvcl_id; + public int parentcl_id; + public int flags; + + public __txn_begin_msg() { + } + + public __txn_begin_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(parentcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + parentcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_begin_msg.java diff --git a/db/rpc_server/java/gen/__txn_begin_reply.java b/db/rpc_server/java/gen/__txn_begin_reply.java new file mode 100644 index 000000000..65a0c4016 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_begin_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_begin_reply implements XdrAble { + public int status; + public int txnidcl_id; + + public __txn_begin_reply() { + } + + public __txn_begin_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(txnidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + txnidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __txn_begin_reply.java diff --git a/db/rpc_server/java/gen/__txn_commit_msg.java b/db/rpc_server/java/gen/__txn_commit_msg.java new file mode 100644 index 000000000..4b988d0c2 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_commit_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_commit_msg implements XdrAble { + public int txnpcl_id; + public int flags; + + public __txn_commit_msg() { + } + + public __txn_commit_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_commit_msg.java diff --git a/db/rpc_server/java/gen/__txn_commit_reply.java b/db/rpc_server/java/gen/__txn_commit_reply.java new file mode 100644 index 000000000..b26937b82 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_commit_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_commit_reply implements XdrAble { + public int status; + + public __txn_commit_reply() { + } + + public __txn_commit_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_commit_reply.java diff --git a/db/rpc_server/java/gen/__txn_discard_msg.java b/db/rpc_server/java/gen/__txn_discard_msg.java new file mode 100644 index 000000000..87f5d4f77 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_discard_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_discard_msg implements XdrAble { + public int txnpcl_id; + public int flags; + + public __txn_discard_msg() { + } + + public __txn_discard_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_discard_msg.java diff --git a/db/rpc_server/java/gen/__txn_discard_reply.java b/db/rpc_server/java/gen/__txn_discard_reply.java new file mode 100644 index 000000000..9792211af --- /dev/null +++ b/db/rpc_server/java/gen/__txn_discard_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_discard_reply implements XdrAble { + public int status; + + public __txn_discard_reply() { + } + + public __txn_discard_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_discard_reply.java diff --git a/db/rpc_server/java/gen/__txn_prepare_msg.java b/db/rpc_server/java/gen/__txn_prepare_msg.java new file mode 100644 index 000000000..6e09f2c77 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_prepare_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_prepare_msg implements XdrAble { + public int txnpcl_id; + public byte [] gid; + + public __txn_prepare_msg() { + } + + public __txn_prepare_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeOpaque(gid, 128); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + gid = xdr.xdrDecodeOpaque(128); + } + +} +// End of __txn_prepare_msg.java diff --git a/db/rpc_server/java/gen/__txn_prepare_reply.java b/db/rpc_server/java/gen/__txn_prepare_reply.java new file mode 100644 index 000000000..d75901179 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_prepare_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_prepare_reply implements XdrAble { + public int status; + + public __txn_prepare_reply() { + } + + public __txn_prepare_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_prepare_reply.java diff --git a/db/rpc_server/java/gen/__txn_recover_msg.java b/db/rpc_server/java/gen/__txn_recover_msg.java new file mode 100644 index 000000000..651533344 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_recover_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_recover_msg implements XdrAble { + public int dbenvcl_id; + public int count; + public int flags; + + public __txn_recover_msg() { + } + + public __txn_recover_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(count); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + count = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_recover_msg.java diff --git a/db/rpc_server/java/gen/__txn_recover_reply.java b/db/rpc_server/java/gen/__txn_recover_reply.java new file mode 100644 index 000000000..0161ec949 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_recover_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_recover_reply implements XdrAble { + public int status; + public int [] txn; + public byte [] gid; + public int retcount; + + public __txn_recover_reply() { + } + + public __txn_recover_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeIntVector(txn); + xdr.xdrEncodeDynamicOpaque(gid); + xdr.xdrEncodeInt(retcount); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + txn = xdr.xdrDecodeIntVector(); + gid = xdr.xdrDecodeDynamicOpaque(); + retcount = xdr.xdrDecodeInt(); + } + +} +// End of __txn_recover_reply.java diff --git a/db/rpc_server/java/gen/db_server.java b/db/rpc_server/java/gen/db_server.java new file mode 100644 index 000000000..a14a77028 --- /dev/null +++ b/db/rpc_server/java/gen/db_server.java @@ -0,0 +1,67 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +/** + * A collection of constants used by the "db_server" ONC/RPC program. + */ +public interface db_server { + public static final int __DB_db_close_4001 = 19; + public static final int __DB_db_flags_4001 = 24; + public static final int __DB_dbc_dup_4001 = 47; + public static final int __DB_db_encrypt_4001 = 22; + public static final int __DB_env_dbrename_4001 = 5; + public static final int __DB_env_remove_4001 = 9; + public static final int __DB_dbc_pget_4001 = 49; + public static final int __DB_env_cachesize_4001 = 1; + public static final int __DB_db_lorder_4001 = 29; + public static final int __DB_db_key_range_4001 = 28; + public static final int __DB_db_bt_minkey_4001 = 18; + public static final int __DB_db_sync_4001 = 40; + public static final int __DB_dbc_close_4001 = 44; + public static final int __DB_db_join_4001 = 43; + public static final int __DB_db_pagesize_4001 = 31; + public static final int DB_RPC_SERVERVERS = 4001; + public static final int __DB_db_open_4001 = 30; + public static final int __DB_dbc_get_4001 = 48; + public static final int __DB_db_cursor_4001 = 42; + public static final int __DB_txn_commit_4001 = 12; + public static final int __DB_dbc_del_4001 = 46; + public static final int __DB_env_create_4001 = 3; + public static final int __DB_env_open_4001 = 8; + public static final int __DB_txn_prepare_4001 = 14; + public static final int __DB_db_pget_4001 = 32; + public static final int __DB_db_stat_4001 = 39; + public static final int __DB_db_h_nelem_4001 = 27; + public static final int __DB_db_remove_4001 = 37; + public static final int __DB_db_re_delim_4001 = 34; + public static final int __DB_db_re_pad_4001 = 36; + public static final int __DB_txn_abort_4001 = 10; + public static final int __DB_txn_recover_4001 = 15; + public static final int __DB_db_get_4001 = 25; + public static final int __DB_db_extentsize_4001 = 23; + public static final int DB_RPC_SERVERPROG = 351457; + public static final int __DB_dbc_put_4001 = 50; + public static final int __DB_db_truncate_4001 = 41; + public static final int __DB_db_del_4001 = 21; + public static final int __DB_db_bt_maxkey_4001 = 17; + public static final int __DB_env_dbremove_4001 = 4; + public static final int __DB_txn_discard_4001 = 13; + public static final int __DB_db_re_len_4001 = 35; + public static final int __DB_env_close_4001 = 2; + public static final int __DB_env_flags_4001 = 7; + public static final int __DB_db_rename_4001 = 38; + public static final int __DB_db_associate_4001 = 16; + public static final int __DB_txn_begin_4001 = 11; + public static final int __DB_env_encrypt_4001 = 6; + public static final int __DB_db_h_ffactor_4001 = 26; + public static final int __DB_db_put_4001 = 33; + public static final int __DB_db_create_4001 = 20; + public static final int __DB_dbc_count_4001 = 45; +} +// End of db_server.java diff --git a/db/rpc_server/java/jrpcgen.jar b/db/rpc_server/java/jrpcgen.jar Binary files differnew file mode 100644 index 000000000..338825b84 --- /dev/null +++ b/db/rpc_server/java/jrpcgen.jar diff --git a/db/rpc_server/java/oncrpc.jar b/db/rpc_server/java/oncrpc.jar Binary files differnew file mode 100644 index 000000000..e0f5cfa69 --- /dev/null +++ b/db/rpc_server/java/oncrpc.jar diff --git a/db/rpc_server/java/s_jrpcgen b/db/rpc_server/java/s_jrpcgen new file mode 100644 index 000000000..fed8cbf56 --- /dev/null +++ b/db/rpc_server/java/s_jrpcgen @@ -0,0 +1,3 @@ +#!/bin/sh + +java -jar jrpcgen.jar -d gen -noclient -nobackup -p com.sleepycat.db.rpcserver -s DbServerStub ../db_server.x diff --git a/db/tcl/tcl_rep.c b/db/tcl/tcl_rep.c new file mode 100644 index 000000000..b1198fa05 --- /dev/null +++ b/db/tcl/tcl_rep.c @@ -0,0 +1,405 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: tcl_rep.c,v 11.85 2002/08/06 04:45:44 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#endif + +#include "db_int.h" +#include "dbinc/tcl_db.h" + +#if CONFIG_TEST +/* + * tcl_RepElect -- + * Call DB_ENV->rep_elect(). + * + * PUBLIC: int tcl_RepElect + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + */ +int +tcl_RepElect(interp, objc, objv, dbenv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *dbenv; /* Environment pointer */ +{ + int eid, nsites, pri, result, ret; + u_int32_t timeout; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 5, objv, "nsites pri timeout"); + return (TCL_ERROR); + } + + if ((result = Tcl_GetIntFromObj(interp, objv[2], &nsites)) != TCL_OK) + return (result); + if ((result = Tcl_GetIntFromObj(interp, objv[3], &pri)) != TCL_OK) + return (result); + if ((result = _GetUInt32(interp, objv[4], &timeout)) != TCL_OK) + return (result); + + _debug_check(); + if ((ret = dbenv->rep_elect(dbenv, nsites, pri, timeout, &eid)) != 0) + return (_ReturnSetup(interp, ret, DB_RETOK_STD(ret), + "env rep_elect")); + + Tcl_SetObjResult(interp, Tcl_NewIntObj(eid)); + + return (TCL_OK); +} +#endif + +#if CONFIG_TEST +/* + * tcl_RepFlush -- + * Call DB_ENV->rep_flush(). + * + * PUBLIC: int tcl_RepFlush + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + */ +int +tcl_RepFlush(interp, objc, objv, dbenv) + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; + DB_ENV *dbenv; +{ + int ret; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 2, objv, ""); + return TCL_ERROR; + } + + _debug_check(); + ret = dbenv->rep_flush(dbenv); + return (_ReturnSetup(interp, ret, DB_RETOK_STD(ret), "env rep_flush")); +} +#endif +#if CONFIG_TEST +/* + * tcl_RepLimit -- + * Call DB_ENV->set_rep_limit(). + * + * PUBLIC: int tcl_RepLimit + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + */ +int +tcl_RepLimit(interp, objc, objv, dbenv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *dbenv; /* Environment pointer */ +{ + int result, ret; + u_int32_t bytes, gbytes; + + if (objc != 4) { + Tcl_WrongNumArgs(interp, 4, objv, "gbytes bytes"); + return (TCL_ERROR); + } + + if ((result = _GetUInt32(interp, objv[2], &gbytes)) != TCL_OK) + return (result); + if ((result = _GetUInt32(interp, objv[3], &bytes)) != TCL_OK) + return (result); + + _debug_check(); + if ((ret = dbenv->set_rep_limit(dbenv, gbytes, bytes)) != 0) + return (_ReturnSetup(interp, ret, DB_RETOK_STD(ret), + "env set_rep_limit")); + + return (_ReturnSetup(interp, + ret, DB_RETOK_STD(ret), "env set_rep_limit")); +} +#endif + +#if CONFIG_TEST +/* + * tcl_RepRequest -- + * Call DB_ENV->set_rep_request(). + * + * PUBLIC: int tcl_RepRequest + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + */ +int +tcl_RepRequest(interp, objc, objv, dbenv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *dbenv; /* Environment pointer */ +{ + int result, ret; + u_int32_t min, max; + + if (objc != 4) { + Tcl_WrongNumArgs(interp, 4, objv, "min max"); + return (TCL_ERROR); + } + + if ((result = _GetUInt32(interp, objv[2], &min)) != TCL_OK) + return (result); + if ((result = _GetUInt32(interp, objv[3], &max)) != TCL_OK) + return (result); + + _debug_check(); + if ((ret = dbenv->set_rep_request(dbenv, min, max)) != 0) + return (_ReturnSetup(interp, ret, DB_RETOK_STD(ret), + "env set_rep_request")); + + return (_ReturnSetup(interp, + ret, DB_RETOK_STD(ret), "env set_rep_request")); +} +#endif + +#if CONFIG_TEST +/* + * tcl_RepStart -- + * Call DB_ENV->rep_start(). + * + * PUBLIC: int tcl_RepStart + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + * + * Note that this normally can/should be achieved as an argument to + * berkdb env, but we need to test forcible upgrading of clients, which + * involves calling this on an open environment handle. + */ +int +tcl_RepStart(interp, objc, objv, dbenv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *dbenv; +{ + static char *tclrpstrt[] = { + "-client", + "-master", + NULL + }; + enum tclrpstrt { + TCL_RPSTRT_CLIENT, + TCL_RPSTRT_MASTER + }; + char *arg; + int i, optindex, ret; + u_int32_t flag; + + flag = 0; + + if (objc != 3) { + Tcl_WrongNumArgs(interp, 3, objv, "[-master/-client]"); + return (TCL_ERROR); + } + + i = 2; + while (i < objc) { + if (Tcl_GetIndexFromObj(interp, objv[i], tclrpstrt, + "option", TCL_EXACT, &optindex) != TCL_OK) { + arg = Tcl_GetStringFromObj(objv[i], NULL); + if (arg[0] == '-') + return (IS_HELP(objv[i])); + else + Tcl_ResetResult(interp); + break; + } + i++; + switch ((enum tclrpstrt)optindex) { + case TCL_RPSTRT_CLIENT: + flag |= DB_REP_CLIENT; + break; + case TCL_RPSTRT_MASTER: + flag |= DB_REP_MASTER; + break; + } + } + + _debug_check(); + ret = dbenv->rep_start(dbenv, NULL, flag); + return (_ReturnSetup(interp, ret, DB_RETOK_STD(ret), "env rep_start")); +} +#endif + +#if CONFIG_TEST +/* + * tcl_RepProcessMessage -- + * Call DB_ENV->rep_process_message(). + * + * PUBLIC: int tcl_RepProcessMessage + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + */ +int +tcl_RepProcessMessage(interp, objc, objv, dbenv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *dbenv; /* Environment pointer */ +{ + DBT control, rec; + Tcl_Obj *res; + void *ctmp, *rtmp; + int eid; + int freectl, freerec, result, ret; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 5, objv, "id control rec"); + return (TCL_ERROR); + } + freectl = freerec = 0; + + memset(&control, 0, sizeof(control)); + memset(&rec, 0, sizeof(rec)); + + if ((result = Tcl_GetIntFromObj(interp, objv[2], &eid)) != TCL_OK) + return (result); + + ret = _CopyObjBytes(interp, objv[3], &ctmp, + &control.size, &freectl); + if (ret != 0) { + result = _ReturnSetup(interp, ret, + DB_RETOK_REPPMSG(ret), "rep_proc_msg"); + return (result); + } + control.data = ctmp; + ret = _CopyObjBytes(interp, objv[4], &rtmp, + &rec.size, &freerec); + if (ret != 0) { + result = _ReturnSetup(interp, ret, + DB_RETOK_REPPMSG(ret), "rep_proc_msg"); + goto out; + } + rec.data = rtmp; + _debug_check(); + ret = dbenv->rep_process_message(dbenv, &control, &rec, &eid); + result = _ReturnSetup(interp, ret, DB_RETOK_REPPMSG(ret), + "env rep_process_message"); + + /* + * If we have a new master, return its environment ID. + * + * XXX + * We should do something prettier to differentiate success + * from an env ID, and figure out how to represent HOLDELECTION. + */ + if (result == TCL_OK && ret == DB_REP_NEWMASTER) { + res = Tcl_NewIntObj(eid); + Tcl_SetObjResult(interp, res); + } +out: + if (freectl) + (void)__os_free(NULL, ctmp); + if (freerec) + (void)__os_free(NULL, rtmp); + + return (result); +} +#endif + +#if CONFIG_TEST +/* + * tcl_RepStat -- + * Call DB_ENV->rep_stat(). + * + * PUBLIC: int tcl_RepStat + * PUBLIC: __P((Tcl_Interp *, int, Tcl_Obj * CONST *, DB_ENV *)); + */ +int +tcl_RepStat(interp, objc, objv, dbenv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *dbenv; +{ + DB_REP_STAT *sp; + Tcl_Obj *myobjv[2], *res, *thislist, *lsnlist; + u_int32_t flag; + int myobjc, result, ret; + char *arg; + + result = TCL_OK; + flag = 0; + + if (objc > 3) { + Tcl_WrongNumArgs(interp, 2, objv, NULL); + return (TCL_ERROR); + } + if (objc == 3) { + arg = Tcl_GetStringFromObj(objv[2], NULL); + if (strcmp(arg, "-clear") == 0) + flag = DB_STAT_CLEAR; + else { + Tcl_SetResult(interp, + "db stat: unknown arg", TCL_STATIC); + return (TCL_ERROR); + } + } + + _debug_check(); + ret = dbenv->rep_stat(dbenv, &sp, flag); + result = _ReturnSetup(interp, ret, DB_RETOK_STD(ret), + "rep stat"); + if (result == TCL_ERROR) + return (result); + + /* + * Have our stats, now construct the name value + * list pairs and free up the memory. + */ + res = Tcl_NewObj(); + /* + * MAKE_STAT_* assumes 'res' and 'error' label. + */ + MAKE_STAT_LSN("Next LSN expected", &sp->st_next_lsn); + MAKE_STAT_LSN("First missed LSN", &sp->st_waiting_lsn); + MAKE_STAT_LIST("Duplicate master conditions", sp->st_dupmasters); + MAKE_STAT_LIST("Environment ID", sp->st_env_id); + MAKE_STAT_LIST("Environment priority", sp->st_env_priority); + MAKE_STAT_LIST("Generation number", sp->st_gen); + MAKE_STAT_LIST("Duplicate log records received", sp->st_log_duplicated); + MAKE_STAT_LIST("Current log records queued", sp->st_log_queued); + MAKE_STAT_LIST("Maximum log records queued", sp->st_log_queued_max); + MAKE_STAT_LIST("Total log records queued", sp->st_log_queued_total); + MAKE_STAT_LIST("Log records received", sp->st_log_records); + MAKE_STAT_LIST("Log records requested", sp->st_log_requested); + MAKE_STAT_LIST("Master environment ID", sp->st_master); + MAKE_STAT_LIST("Master changes", sp->st_master_changes); + MAKE_STAT_LIST("Messages with bad generation number", + sp->st_msgs_badgen); + MAKE_STAT_LIST("Messages processed", sp->st_msgs_processed); + MAKE_STAT_LIST("Messages ignored for recovery", sp->st_msgs_recover); + MAKE_STAT_LIST("Message send failures", sp->st_msgs_send_failures); + MAKE_STAT_LIST("Messages sent", sp->st_msgs_sent); + MAKE_STAT_LIST("New site messages", sp->st_newsites); + MAKE_STAT_LIST("Transmission limited", sp->st_nthrottles); + MAKE_STAT_LIST("Outdated conditions", sp->st_outdated); + MAKE_STAT_LIST("Transactions applied", sp->st_txns_applied); + MAKE_STAT_LIST("Elections held", sp->st_elections); + MAKE_STAT_LIST("Elections won", sp->st_elections_won); + MAKE_STAT_LIST("Election phase", sp->st_election_status); + MAKE_STAT_LIST("Election winner", sp->st_election_cur_winner); + MAKE_STAT_LIST("Election generation number", sp->st_election_gen); + MAKE_STAT_LSN("Election max LSN", &sp->st_election_lsn); + MAKE_STAT_LIST("Election sites", sp->st_election_nsites); + MAKE_STAT_LIST("Election priority", sp->st_election_priority); + MAKE_STAT_LIST("Election tiebreaker", sp->st_election_tiebreaker); + MAKE_STAT_LIST("Election votes", sp->st_election_votes); + + Tcl_SetObjResult(interp, res); +error: + free(sp); + return (result); +} +#endif diff --git a/db/tcl/tcl_util.c b/db/tcl/tcl_util.c new file mode 100644 index 000000000..b6d46b71f --- /dev/null +++ b/db/tcl/tcl_util.c @@ -0,0 +1,381 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2001 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: tcl_util.c,v 11.35 2002/08/06 06:21:42 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <fcntl.h> +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#endif + +#include "db_int.h" +#include "dbinc/tcl_db.h" + +/* + * Prototypes for procedures defined later in this file: + */ +static int mutex_Cmd __P((ClientData, Tcl_Interp *, int, Tcl_Obj * CONST*)); + +/* + * bdb_RandCommand -- + * Implements rand* functions. + * + * PUBLIC: int bdb_RandCommand __P((Tcl_Interp *, int, Tcl_Obj * CONST*)); + */ +int +bdb_RandCommand(interp, objc, objv) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ +{ + static char *rcmds[] = { + "rand", "random_int", "srand", + NULL + }; + enum rcmds { + RRAND, RRAND_INT, RSRAND + }; + long t; + int cmdindex, hi, lo, result, ret; + Tcl_Obj *res; + char msg[MSG_SIZE]; + + result = TCL_OK; + /* + * Get the command name index from the object based on the cmds + * defined above. This SHOULD NOT fail because we already checked + * in the 'berkdb' command. + */ + if (Tcl_GetIndexFromObj(interp, + objv[1], rcmds, "command", TCL_EXACT, &cmdindex) != TCL_OK) + return (IS_HELP(objv[1])); + + res = NULL; + switch ((enum rcmds)cmdindex) { + case RRAND: + /* + * Must be 0 args. Error if different. + */ + if (objc != 2) { + Tcl_WrongNumArgs(interp, 2, objv, NULL); + return (TCL_ERROR); + } + ret = rand(); + res = Tcl_NewIntObj(ret); + break; + case RRAND_INT: + /* + * Must be 4 args. Error if different. + */ + if (objc != 4) { + Tcl_WrongNumArgs(interp, 2, objv, "lo hi"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &lo); + if (result != TCL_OK) + break; + result = Tcl_GetIntFromObj(interp, objv[3], &hi); + if (result == TCL_OK) { +#ifndef RAND_MAX +#define RAND_MAX 0x7fffffff +#endif + t = rand(); + if (t > RAND_MAX) { + snprintf(msg, MSG_SIZE, + "Max random is higher than %ld\n", + (long)RAND_MAX); + Tcl_SetResult(interp, msg, TCL_VOLATILE); + result = TCL_ERROR; + break; + } + _debug_check(); + ret = (int)(((double)t / ((double)(RAND_MAX) + 1)) * + (hi - lo + 1)); + ret += lo; + res = Tcl_NewIntObj(ret); + } + break; + case RSRAND: + /* + * Must be 1 arg. Error if different. + */ + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "seed"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &lo); + if (result == TCL_OK) { + srand((u_int)lo); + res = Tcl_NewIntObj(0); + } + break; + } + /* + * Only set result if we have a res. Otherwise, lower + * functions have already done so. + */ + if (result == TCL_OK && res) + Tcl_SetObjResult(interp, res); + return (result); +} + +/* + * + * tcl_Mutex -- + * Opens an env mutex. + * + * PUBLIC: int tcl_Mutex __P((Tcl_Interp *, int, Tcl_Obj * CONST*, DB_ENV *, + * PUBLIC: DBTCL_INFO *)); + */ +int +tcl_Mutex(interp, objc, objv, envp, envip) + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ + DB_ENV *envp; /* Environment pointer */ + DBTCL_INFO *envip; /* Info pointer */ +{ + DBTCL_INFO *ip; + Tcl_Obj *res; + _MUTEX_DATA *md; + int i, mode, nitems, result, ret; + char newname[MSG_SIZE]; + + md = NULL; + result = TCL_OK; + mode = nitems = ret = 0; + memset(newname, 0, MSG_SIZE); + + if (objc != 4) { + Tcl_WrongNumArgs(interp, 2, objv, "mode nitems"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &mode); + if (result != TCL_OK) + return (TCL_ERROR); + result = Tcl_GetIntFromObj(interp, objv[3], &nitems); + if (result != TCL_OK) + return (TCL_ERROR); + + snprintf(newname, sizeof(newname), + "%s.mutex%d", envip->i_name, envip->i_envmutexid); + ip = _NewInfo(interp, NULL, newname, I_MUTEX); + if (ip == NULL) { + Tcl_SetResult(interp, "Could not set up info", + TCL_STATIC); + return (TCL_ERROR); + } + /* + * Set up mutex. + */ + /* + * Map in the region. + * + * XXX + * We don't bother doing this "right", i.e., using the shalloc + * functions, just grab some memory knowing that it's correctly + * aligned. + */ + _debug_check(); + if (__os_calloc(NULL, 1, sizeof(_MUTEX_DATA), &md) != 0) + goto posixout; + md->env = envp; + md->n_mutex = nitems; + md->size = sizeof(_MUTEX_ENTRY) * nitems; + + md->reginfo.type = REGION_TYPE_MUTEX; + md->reginfo.id = INVALID_REGION_TYPE; + md->reginfo.mode = mode; + md->reginfo.flags = REGION_CREATE_OK | REGION_JOIN_OK; + if ((ret = __db_r_attach(envp, &md->reginfo, md->size)) != 0) + goto posixout; + md->marray = md->reginfo.addr; + + /* Initialize a created region. */ + if (F_ISSET(&md->reginfo, REGION_CREATE)) + for (i = 0; i < nitems; i++) { + md->marray[i].val = 0; + if ((ret = __db_mutex_init_int(envp, + &md->marray[i].m, i, 0)) != 0) + goto posixout; + } + R_UNLOCK(envp, &md->reginfo); + + /* + * Success. Set up return. Set up new info + * and command widget for this mutex. + */ + envip->i_envmutexid++; + ip->i_parent = envip; + _SetInfoData(ip, md); + Tcl_CreateObjCommand(interp, newname, + (Tcl_ObjCmdProc *)mutex_Cmd, (ClientData)md, NULL); + res = Tcl_NewStringObj(newname, strlen(newname)); + Tcl_SetObjResult(interp, res); + + return (TCL_OK); + +posixout: + if (ret > 0) + Tcl_PosixError(interp); + result = _ReturnSetup(interp, ret, DB_RETOK_STD(ret), "mutex"); + _DeleteInfo(ip); + + if (md != NULL) { + if (md->reginfo.addr != NULL) + (void)__db_r_detach(md->env, + &md->reginfo, F_ISSET(&md->reginfo, REGION_CREATE)); + __os_free(md->env, md); + } + return (result); +} + +/* + * mutex_Cmd -- + * Implements the "mutex" widget. + */ +static int +mutex_Cmd(clientData, interp, objc, objv) + ClientData clientData; /* Mutex handle */ + Tcl_Interp *interp; /* Interpreter */ + int objc; /* How many arguments? */ + Tcl_Obj *CONST objv[]; /* The argument objects */ +{ + static char *mxcmds[] = { + "close", + "get", + "getval", + "release", + "setval", + NULL + }; + enum mxcmds { + MXCLOSE, + MXGET, + MXGETVAL, + MXRELE, + MXSETVAL + }; + DB_ENV *dbenv; + DBTCL_INFO *envip, *mpip; + _MUTEX_DATA *mp; + Tcl_Obj *res; + int cmdindex, id, result, newval; + + Tcl_ResetResult(interp); + mp = (_MUTEX_DATA *)clientData; + mpip = _PtrToInfo((void *)mp); + envip = mpip->i_parent; + dbenv = envip->i_envp; + result = TCL_OK; + + if (mp == NULL) { + Tcl_SetResult(interp, "NULL mp pointer", TCL_STATIC); + return (TCL_ERROR); + } + if (mpip == NULL) { + Tcl_SetResult(interp, "NULL mp info pointer", TCL_STATIC); + return (TCL_ERROR); + } + + /* + * Get the command name index from the object based on the dbcmds + * defined above. + */ + if (Tcl_GetIndexFromObj(interp, + objv[1], mxcmds, "command", TCL_EXACT, &cmdindex) != TCL_OK) + return (IS_HELP(objv[1])); + + res = NULL; + switch ((enum mxcmds)cmdindex) { + case MXCLOSE: + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return (TCL_ERROR); + } + _debug_check(); + (void)__db_r_detach(mp->env, &mp->reginfo, 0); + res = Tcl_NewIntObj(0); + (void)Tcl_DeleteCommand(interp, mpip->i_name); + _DeleteInfo(mpip); + __os_free(mp->env, mp); + break; + case MXRELE: + /* + * Check for 1 arg. Error if different. + */ + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "id"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &id); + if (result != TCL_OK) + break; + MUTEX_UNLOCK(dbenv, &mp->marray[id].m); + res = Tcl_NewIntObj(0); + break; + case MXGET: + /* + * Check for 1 arg. Error if different. + */ + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "id"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &id); + if (result != TCL_OK) + break; + MUTEX_LOCK(dbenv, &mp->marray[id].m); + res = Tcl_NewIntObj(0); + break; + case MXGETVAL: + /* + * Check for 1 arg. Error if different. + */ + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "id"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &id); + if (result != TCL_OK) + break; + res = Tcl_NewLongObj((long)mp->marray[id].val); + break; + case MXSETVAL: + /* + * Check for 2 args. Error if different. + */ + if (objc != 4) { + Tcl_WrongNumArgs(interp, 2, objv, "id val"); + return (TCL_ERROR); + } + result = Tcl_GetIntFromObj(interp, objv[2], &id); + if (result != TCL_OK) + break; + result = Tcl_GetIntFromObj(interp, objv[3], &newval); + if (result != TCL_OK) + break; + mp->marray[id].val = newval; + res = Tcl_NewIntObj(0); + break; + } + /* + * Only set result if we have a res. Otherwise, lower + * functions have already done so. + */ + if (result == TCL_OK && res) + Tcl_SetObjResult(interp, res); + return (result); +} diff --git a/db/test/env011.tcl b/db/test/env011.tcl new file mode 100644 index 000000000..56742a08e --- /dev/null +++ b/db/test/env011.tcl @@ -0,0 +1,39 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1999-2002 +# Sleepycat Software. All rights reserved. +# +# Id: env011.tcl,v 1.2 2002/02/20 17:08:21 sandstro Exp +# +# TEST env011 +# TEST Run with region overwrite flag. +proc env011 { } { + source ./include.tcl + + puts "Env011: Test of region overwriting." + env_cleanup $testdir + + puts "\tEnv011: Creating/closing env for open test." + set e [berkdb_env -create -overwrite -home $testdir -txn] + error_check_good dbenv [is_valid_env $e] TRUE + set db [eval \ + {berkdb_open -auto_commit -env $e -btree -create -mode 0644} ] + error_check_good dbopen [is_valid_db $db] TRUE + set ret [eval {$db put} -auto_commit "aaa" "data"] + error_check_good put $ret 0 + set ret [eval {$db put} -auto_commit "bbb" "data"] + error_check_good put $ret 0 + error_check_good db_close [$db close] 0 + error_check_good envclose [$e close] 0 + + puts "\tEnv011: Opening the environment with overwrite set." + set e [berkdb_env -create -overwrite -home $testdir -txn -recover] + error_check_good dbenv [is_valid_env $e] TRUE + error_check_good envclose [$e close] 0 + + puts "\tEnv011: Removing the environment with overwrite set." + error_check_good berkdb:envremove \ + [berkdb envremove -home $testdir -overwrite] 0 + + puts "\tEnv011 complete." +} diff --git a/db/test/log001.tcl b/db/test/log001.tcl new file mode 100644 index 000000000..732a539ff --- /dev/null +++ b/db/test/log001.tcl @@ -0,0 +1,120 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: log001.tcl,v 11.29 2002/04/30 20:27:56 sue Exp +# + +# TEST log001 +# TEST Read/write log records. +proc log001 { } { + global passwd + global rand_init + + berkdb srand $rand_init + set iter 1000 + set max [expr 1024 * 128] + log001_body $max $iter 1 + log001_body $max $iter 0 + log001_body $max $iter 1 "-encryptaes $passwd" + log001_body $max $iter 0 "-encryptaes $passwd" + log001_body $max [expr $iter * 15] 1 + log001_body $max [expr $iter * 15] 0 + log001_body $max [expr $iter * 15] 1 "-encryptaes $passwd" + log001_body $max [expr $iter * 15] 0 "-encryptaes $passwd" +} + +proc log001_body { max nrecs fixedlength {encargs ""} } { + source ./include.tcl + + puts -nonewline "Log001: Basic put/get log records " + if { $fixedlength == 1 } { + puts "(fixed-length $encargs)" + } else { + puts "(variable-length $encargs)" + } + + env_cleanup $testdir + + set env [eval {berkdb_env -log -create -home $testdir -mode 0644} \ + $encargs -log_max $max] + error_check_good envopen [is_valid_env $env] TRUE + + # We will write records to the log and make sure we can + # read them back correctly. We'll use a standard pattern + # repeated some number of times for each record. + set lsn_list {} + set rec_list {} + puts "\tLog001.a: Writing $nrecs log records" + for { set i 0 } { $i < $nrecs } { incr i } { + set rec "" + for { set j 0 } { $j < [expr $i % 10 + 1] } {incr j} { + set rec $rec$i:logrec:$i + } + if { $fixedlength != 1 } { + set rec $rec:[random_data 237 0 0] + } + set lsn [$env log_put $rec] + error_check_bad log_put [is_substr $lsn log_cmd] 1 + lappend lsn_list $lsn + lappend rec_list $rec + } + + # Open a log cursor. + set logc [$env log_cursor] + error_check_good logc [is_valid_logc $logc $env] TRUE + + puts "\tLog001.b: Retrieving log records sequentially (forward)" + set i 0 + for { set grec [$logc get -first] } { [llength $grec] != 0 } { + set grec [$logc get -next]} { + error_check_good log_get:seq [lindex $grec 1] \ + [lindex $rec_list $i] + incr i + } + + puts "\tLog001.c: Retrieving log records sequentially (backward)" + set i [llength $rec_list] + for { set grec [$logc get -last] } { [llength $grec] != 0 } { + set grec [$logc get -prev] } { + incr i -1 + error_check_good \ + log_get:seq [lindex $grec 1] [lindex $rec_list $i] + } + + puts "\tLog001.d: Retrieving log records sequentially by LSN" + set i 0 + foreach lsn $lsn_list { + set grec [$logc get -set $lsn] + error_check_good \ + log_get:seq [lindex $grec 1] [lindex $rec_list $i] + incr i + } + + puts "\tLog001.e: Retrieving log records randomly by LSN" + set m [expr [llength $lsn_list] - 1] + for { set i 0 } { $i < $nrecs } { incr i } { + set recno [berkdb random_int 0 $m ] + set lsn [lindex $lsn_list $recno] + set grec [$logc get -set $lsn] + error_check_good \ + log_get:seq [lindex $grec 1] [lindex $rec_list $recno] + } + + puts "\tLog001.f: Retrieving first/current, last/current log record" + set grec [$logc get -first] + error_check_good log_get:seq [lindex $grec 1] [lindex $rec_list 0] + set grec [$logc get -current] + error_check_good log_get:seq [lindex $grec 1] [lindex $rec_list 0] + set i [expr [llength $rec_list] - 1] + set grec [$logc get -last] + error_check_good log_get:seq [lindex $grec 1] [lindex $rec_list $i] + set grec [$logc get -current] + error_check_good log_get:seq [lindex $grec 1] [lindex $rec_list $i] + + # Close and unlink the file + error_check_good log_cursor:close:$logc [$logc close] 0 + error_check_good env:close [$env close] 0 + error_check_good envremove [berkdb envremove -home $testdir] 0 +} diff --git a/db/test/log002.tcl b/db/test/log002.tcl new file mode 100644 index 000000000..6b0604ea8 --- /dev/null +++ b/db/test/log002.tcl @@ -0,0 +1,85 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: log002.tcl,v 11.28 2002/04/29 20:07:54 sue Exp +# + +# TEST log002 +# TEST Tests multiple logs +# TEST Log truncation +# TEST LSN comparison and file functionality. +proc log002 { } { + source ./include.tcl + + puts "Log002: Multiple log test w/trunc, file, compare functionality" + + env_cleanup $testdir + + set max [expr 1024 * 128] + set env [berkdb_env -create -home $testdir -mode 0644 \ + -log -log_max $max] + error_check_good envopen [is_valid_env $env] TRUE + + # We'll record every hundred'th record for later use + set info_list {} + + puts "\tLog002.a: Writing log records" + set i 0 + for {set s 0} { $s < [expr 3 * $max] } { incr s $len } { + set rec [random_data 120 0 0] + set len [string length $rec] + set lsn [$env log_put $rec] + + if { [expr $i % 100 ] == 0 } { + lappend info_list [list $lsn $rec] + } + incr i + } + + puts "\tLog002.b: Checking log_compare" + set last {0 0} + foreach p $info_list { + set l [lindex $p 0] + if { [llength $last] != 0 } { + error_check_good \ + log_compare [$env log_compare $l $last] 1 + error_check_good \ + log_compare [$env log_compare $last $l] -1 + error_check_good \ + log_compare [$env log_compare $l $l] 0 + } + set last $l + } + + puts "\tLog002.c: Checking log_file" + set flist [glob $testdir/log*] + foreach p $info_list { + + set lsn [lindex $p 0] + set f [$env log_file $lsn] + + # Change all backslash separators on Windows to forward slash + # separators, which is what the rest of the test suite expects. + regsub -all {\\} $f {/} f + + error_check_bad log_file:$f [lsearch $flist $f] -1 + } + + puts "\tLog002.d: Verifying records" + + set logc [$env log_cursor] + error_check_good log_cursor [is_valid_logc $logc $env] TRUE + + for {set i [expr [llength $info_list] - 1] } { $i >= 0 } { incr i -1} { + set p [lindex $info_list $i] + set grec [$logc get -set [lindex $p 0]] + error_check_good log_get:$env [lindex $grec 1] [lindex $p 1] + } + + # Close and unlink the file + error_check_good log_cursor:close:$logc [$logc close] 0 + error_check_good env:close [$env close] 0 + error_check_good envremove [berkdb envremove -home $testdir] 0 +} diff --git a/db/test/log003.tcl b/db/test/log003.tcl new file mode 100644 index 000000000..6dec40702 --- /dev/null +++ b/db/test/log003.tcl @@ -0,0 +1,118 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: log003.tcl,v 11.28 2002/04/29 20:07:54 sue Exp +# + +# TEST log003 +# TEST Verify that log_flush is flushing records correctly. +proc log003 { } { + source ./include.tcl + + puts "Log003: Verify log_flush behavior" + + set max [expr 1024 * 128] + env_cleanup $testdir + set short_rec "abcdefghijklmnopqrstuvwxyz" + set long_rec [repeat $short_rec 200] + set very_long_rec [repeat $long_rec 4] + + foreach rec "$short_rec $long_rec $very_long_rec" { + puts "\tLog003.a: Verify flush on [string length $rec] byte rec" + + set env [berkdb_env -log -home $testdir \ + -create -mode 0644 -log_max $max] + error_check_good envopen [is_valid_env $env] TRUE + + set lsn [$env log_put $rec] + error_check_bad log_put [lindex $lsn 0] "ERROR:" + set ret [$env log_flush $lsn] + error_check_good log_flush $ret 0 + + # Now, we want to crash the region and recheck. Closing the + # log does not flush any records, so we'll use a close to + # do the "crash" + set ret [$env close] + error_check_good log_env:close $ret 0 + + # Now, remove the log region + #set ret [berkdb envremove -home $testdir] + #error_check_good env:remove $ret 0 + + # Re-open the log and try to read the record. + set env [berkdb_env -create -home $testdir \ + -log -mode 0644 -log_max $max] + error_check_good envopen [is_valid_env $env] TRUE + + set logc [$env log_cursor] + error_check_good log_cursor [is_valid_logc $logc $env] TRUE + + set gotrec [$logc get -first] + error_check_good lp_get [lindex $gotrec 1] $rec + + # Close and unlink the file + error_check_good log_cursor:close:$logc [$logc close] 0 + error_check_good env:close:$env [$env close] 0 + error_check_good envremove [berkdb envremove -home $testdir] 0 + log_cleanup $testdir + } + + foreach rec "$short_rec $long_rec $very_long_rec" { + puts "\tLog003.b: \ + Verify flush on non-last record [string length $rec]" + set env [berkdb_env \ + -create -log -home $testdir -mode 0644 -log_max $max] + error_check_good envopen [is_valid_env $env] TRUE + + # Put 10 random records + for { set i 0 } { $i < 10 } { incr i} { + set r [random_data 450 0 0] + set lsn [$env log_put $r] + error_check_bad log_put [lindex $lsn 0] "ERROR:" + } + + # Put the record we are interested in + set save_lsn [$env log_put $rec] + error_check_bad log_put [lindex $save_lsn 0] "ERROR:" + + # Put 10 more random records + for { set i 0 } { $i < 10 } { incr i} { + set r [random_data 450 0 0] + set lsn [$env log_put $r] + error_check_bad log_put [lindex $lsn 0] "ERROR:" + } + + # Now check the flush + set ret [$env log_flush $save_lsn] + error_check_good log_flush $ret 0 + + # Now, we want to crash the region and recheck. Closing the + # log does not flush any records, so we'll use a close to + # do the "crash" + + # + # Now, close and remove the log region + error_check_good env:close:$env [$env close] 0 + set ret [berkdb envremove -home $testdir] + error_check_good env:remove $ret 0 + + # Re-open the log and try to read the record. + set env [berkdb_env \ + -home $testdir -create -log -mode 0644 -log_max $max] + error_check_good envopen [is_valid_env $env] TRUE + + set logc [$env log_cursor] + error_check_good log_cursor [is_valid_logc $logc $env] TRUE + + set gotrec [$logc get -set $save_lsn] + error_check_good lp_get [lindex $gotrec 1] $rec + + # Close and unlink the file + error_check_good log_cursor:close:$logc [$logc close] 0 + error_check_good env:close:$env [$env close] 0 + error_check_good envremove [berkdb envremove -home $testdir] 0 + log_cleanup $testdir + } +} diff --git a/db/test/log004.tcl b/db/test/log004.tcl new file mode 100644 index 000000000..6524d8e59 --- /dev/null +++ b/db/test/log004.tcl @@ -0,0 +1,46 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: log004.tcl,v 11.28 2002/04/29 20:07:54 sue Exp +# + +# TEST log004 +# TEST Make sure that if we do PREVs on a log, but the beginning of the +# TEST log has been truncated, we do the right thing. +proc log004 { } { + source ./include.tcl + + puts "Log004: Prev on log when beginning of log has been truncated." + # Use archive test to populate log + env_cleanup $testdir + puts "\tLog004.a: Call archive to populate log." + archive + + # Delete all log files under 100 + puts "\tLog004.b: Delete all log files under 100." + set ret [catch { glob $testdir/log.00000000* } result] + if { $ret == 0 } { + eval fileremove -f $result + } + + # Now open the log and get the first record and try a prev + puts "\tLog004.c: Open truncated log, attempt to access missing portion." + set env [berkdb_env -create -log -home $testdir] + error_check_good envopen [is_valid_env $env] TRUE + + set logc [$env log_cursor] + error_check_good log_cursor [is_valid_logc $logc $env] TRUE + + set ret [$logc get -first] + error_check_bad log_get [llength $ret] 0 + + # This should give DB_NOTFOUND which is a ret of length 0 + catch {$logc get -prev} ret + error_check_good log_get_prev [string length $ret] 0 + + puts "\tLog004.d: Close log and environment." + error_check_good log_cursor_close [$logc close] 0 + error_check_good log_close [$env close] 0 +} diff --git a/db/test/log005.tcl b/db/test/log005.tcl new file mode 100644 index 000000000..d890295c3 --- /dev/null +++ b/db/test/log005.tcl @@ -0,0 +1,89 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: log005.tcl,v 11.1 2002/05/30 22:16:49 bostic Exp +# +# TEST log005 +# TEST Check that log file sizes can change on the fly. +proc log005 { } { + source ./include.tcl + + puts "Log005: Check that log file sizes can change." + env_cleanup $testdir + + # Open the environment, set and check the log file size. + puts "\tLog005.a: open, set and check the log file size." + set env [berkdb_env \ + -create -home $testdir -log_buffer 10000 -log_max 1000000 -txn] + error_check_good envopen [is_valid_env $env] TRUE + set db [berkdb_open \ + -env $env -create -mode 0644 -btree -auto_commit a.db] + error_check_good dbopen [is_valid_db $db] TRUE + + # Get the current log file maximum. + set max [log005_stat $env "Current log file size"] + error_check_good max_set $max 1000000 + + # Reset the log file size using a second open, and make sure + # it changes. + puts "\tLog005.b: reset during open, check the log file size." + set envtmp [berkdb_env -home $testdir -log_max 900000 -txn] + error_check_good envtmp_open [is_valid_env $envtmp] TRUE + error_check_good envtmp_close [$envtmp close] 0 + + set tmp [log005_stat $env "Current log file size"] + error_check_good max_changed 900000 $tmp + + puts "\tLog005.c: fill in the current log file size." + # Fill in the current log file. + set new_lsn 0 + set data [repeat "a" 1024] + for { set i 1 } \ + { [log005_stat $env "Current log file number"] != 2 } \ + { incr i } { + set t [$env txn] + error_check_good txn [is_valid_txn $t $env] TRUE + set ret [$db put -txn $t $i $data] + error_check_good put $ret 0 + error_check_good txn [$t commit] 0 + + set last_lsn $new_lsn + set new_lsn [log005_stat $env "Current log file offset"] + } + + # The last LSN in the first file should be more than our new + # file size. + error_check_good "lsn check < 900000" [expr 900000 < $last_lsn] 1 + + # Close down the environment. + error_check_good db_close [$db close] 0 + error_check_good env_close [$env close] 0 + + puts "\tLog005.d: check the log file size is unchanged after recovery." + # Open again, running recovery. Verify the log file size is as we + # left it. + set env [berkdb_env -create -home $testdir -recover -txn] + error_check_good env_open [is_valid_env $env] TRUE + + set tmp [log005_stat $env "Current log file size"] + error_check_good after_recovery 900000 $tmp + + error_check_good env_close [$env close] 0 +} + +# log005_stat -- +# Return the current log statistics. +proc log005_stat { env s } { + set stat [$env log_stat] + foreach statpair $stat { + set statmsg [lindex $statpair 0] + set statval [lindex $statpair 1] + if {[is_substr $statmsg $s] != 0} { + return $statval + } + } + puts "FAIL: log005: stat string $s not found" + return 0 +} diff --git a/db/test/memp001.tcl b/db/test/memp001.tcl new file mode 100644 index 000000000..3ac80a29d --- /dev/null +++ b/db/test/memp001.tcl @@ -0,0 +1,199 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: memp001.tcl,v 11.50 2002/08/07 16:46:28 bostic Exp +# + +# TEST memp001 +# TEST Randomly updates pages. +proc memp001 { } { + + memp001_body 1 "" + memp001_body 3 "" + memp001_body 1 -private + memp001_body 3 -private + memp001_body 1 "-system_mem -shm_key 1" + memp001_body 3 "-system_mem -shm_key 1" + +} + +proc memp001_body { ncache flags } { + source ./include.tcl + global rand_init + + set nfiles 5 + set iter 500 + set psize 512 + set cachearg "-cachesize {0 400000 $ncache}" + + puts \ +"Memp001: { $flags } random update $iter iterations on $nfiles files." + # + # Check if this platform supports this set of flags + # + if { [mem_chk $flags] == 1 } { + return + } + + env_cleanup $testdir + puts "\tMemp001.a: Create env with $ncache caches" + set env [eval {berkdb_env -create -mode 0644} \ + $cachearg {-home $testdir} $flags] + error_check_good env_open [is_valid_env $env] TRUE + + # + # Do a simple mpool_stat call to verify the number of caches + # just to exercise the stat code. + set stat [$env mpool_stat] + set str "Number of caches" + set checked 0 + foreach statpair $stat { + if { $checked == 1 } { + break + } + if { [is_substr [lindex $statpair 0] $str] != 0} { + set checked 1 + error_check_good ncache [lindex $statpair 1] $ncache + } + } + error_check_good checked $checked 1 + + # Open N memp files + puts "\tMemp001.b: Create $nfiles mpool files" + for {set i 1} {$i <= $nfiles} {incr i} { + set fname "data_file.$i" + file_create $testdir/$fname 50 $psize + + set mpools($i) \ + [$env mpool -create -pagesize $psize -mode 0644 $fname] + error_check_good mp_open [is_substr $mpools($i) $env.mp] 1 + } + + # Now, loop, picking files at random + berkdb srand $rand_init + puts "\tMemp001.c: Random page replacement loop" + for {set i 0} {$i < $iter} {incr i} { + set mpool $mpools([berkdb random_int 1 $nfiles]) + set p(1) [get_range $mpool 10] + set p(2) [get_range $mpool 10] + set p(3) [get_range $mpool 10] + set p(1) [replace $mpool $p(1)] + set p(3) [replace $mpool $p(3)] + set p(4) [get_range $mpool 20] + set p(4) [replace $mpool $p(4)] + set p(5) [get_range $mpool 10] + set p(6) [get_range $mpool 20] + set p(7) [get_range $mpool 10] + set p(8) [get_range $mpool 20] + set p(5) [replace $mpool $p(5)] + set p(6) [replace $mpool $p(6)] + set p(9) [get_range $mpool 40] + set p(9) [replace $mpool $p(9)] + set p(10) [get_range $mpool 40] + set p(7) [replace $mpool $p(7)] + set p(8) [replace $mpool $p(8)] + set p(9) [replace $mpool $p(9)] + set p(10) [replace $mpool $p(10)] + # + # We now need to put all the pages we have here or + # else they end up pinned. + # + for {set x 1} { $x <= 10} {incr x} { + error_check_good pgput [$p($x) put] 0 + } + } + + # Close N memp files, close the environment. + puts "\tMemp001.d: Close mpools" + for {set i 1} {$i <= $nfiles} {incr i} { + error_check_good memp_close:$mpools($i) [$mpools($i) close] 0 + } + error_check_good envclose [$env close] 0 + + for {set i 1} {$i <= $nfiles} {incr i} { + fileremove -f $testdir/data_file.$i + } +} + +proc file_create { fname nblocks blocksize } { + set fid [open $fname w] + for {set i 0} {$i < $nblocks} {incr i} { + seek $fid [expr $i * $blocksize] start + puts -nonewline $fid $i + } + seek $fid [expr $nblocks * $blocksize - 1] + + # We don't end the file with a newline, because some platforms (like + # Windows) emit CR/NL. There does not appear to be a BINARY open flag + # that prevents this. + puts -nonewline $fid "Z" + close $fid + + # Make sure it worked + if { [file size $fname] != $nblocks * $blocksize } { + error "FAIL: file_create could not create correct file size" + } +} + +proc get_range { mpool max } { + set pno [berkdb random_int 0 $max] + set p [$mpool get $pno] + error_check_good page [is_valid_page $p $mpool] TRUE + set got [$p pgnum] + if { $got != $pno } { + puts "Get_range: Page mismatch page |$pno| val |$got|" + } + set ret [$p init "Page is pinned by [pid]"] + error_check_good page_init $ret 0 + + return $p +} + +proc replace { mpool p } { + set pgno [$p pgnum] + + set ret [$p init "Page is unpinned by [pid]"] + error_check_good page_init $ret 0 + + set ret [$p put -dirty] + error_check_good page_put $ret 0 + + set p2 [$mpool get $pgno] + error_check_good page [is_valid_page $p2 $mpool] TRUE + + return $p2 +} + +proc mem_chk { flags } { + source ./include.tcl + global errorCode + + # Open the memp with region init specified + env_cleanup $testdir + + set cachearg " -cachesize {0 400000 3}" + set ret [catch {eval {berkdb_env -create -mode 0644}\ + $cachearg {-region_init -home $testdir} $flags} env] + if { $ret != 0 } { + # If the env open failed, it may be because we're on a platform + # such as HP-UX 10 that won't support mutexes in shmget memory. + # Or QNX, which doesn't support system memory at all. + # Verify that the return value was EINVAL or EOPNOTSUPP + # and bail gracefully. + error_check_good is_shm_test [is_substr $flags -system_mem] 1 + error_check_good returned_error [expr \ + [is_substr $errorCode EINVAL] || \ + [is_substr $errorCode EOPNOTSUPP]] 1 + puts "Warning:\ + platform does not support mutexes in shmget memory." + puts "Skipping shared memory mpool test." + return 1 + } + error_check_good env_open [is_valid_env $env] TRUE + error_check_good env_close [$env close] 0 + env_cleanup $testdir + + return 0 +} diff --git a/db/test/memp002.tcl b/db/test/memp002.tcl new file mode 100644 index 000000000..7c028a8a2 --- /dev/null +++ b/db/test/memp002.tcl @@ -0,0 +1,62 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: memp002.tcl,v 11.46 2002/04/30 17:26:06 sue Exp +# + +# TEST memp002 +# TEST Tests multiple processes accessing and modifying the same files. +proc memp002 { } { + # + # Multiple processes not supported by private memory so don't + # run memp002_body with -private. + # + memp002_body "" + memp002_body "-system_mem -shm_key 1" +} + +proc memp002_body { flags } { + source ./include.tcl + + puts "Memp002: {$flags} Multiprocess mpool tester" + + set procs 4 + set psizes "512 1024 2048 4096 8192" + set iterations 500 + set npages 100 + + # Check if this combination of flags is supported by this arch. + if { [mem_chk $flags] == 1 } { + return + } + + set iter [expr $iterations / $procs] + + # Clean up old stuff and create new. + env_cleanup $testdir + + for { set i 0 } { $i < [llength $psizes] } { incr i } { + fileremove -f $testdir/file$i + } + set e [eval {berkdb_env -create -lock -home $testdir} $flags] + error_check_good dbenv [is_valid_env $e] TRUE + + set pidlist {} + for { set i 0 } { $i < $procs } {incr i} { + + puts "$tclsh_path\ + $test_path/mpoolscript.tcl $testdir $i $procs \ + $iter $psizes $npages 3 $flags > \ + $testdir/memp002.$i.out &" + set p [exec $tclsh_path $test_path/wrap.tcl \ + mpoolscript.tcl $testdir/memp002.$i.out $testdir $i $procs \ + $iter $psizes $npages 3 $flags &] + lappend pidlist $p + } + puts "Memp002: $procs independent processes now running" + watch_procs + + reset_env $e +} diff --git a/db/test/memp003.tcl b/db/test/memp003.tcl new file mode 100644 index 000000000..d6fc765fc --- /dev/null +++ b/db/test/memp003.tcl @@ -0,0 +1,153 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: memp003.tcl,v 11.46 2002/04/30 17:26:06 sue Exp +# + +# TEST memp003 +# TEST Test reader-only/writer process combinations; we use the access methods +# TEST for testing. +proc memp003 { } { + # + # Multiple processes not supported by private memory so don't + # run memp003_body with -private. + # + memp003_body "" + memp003_body "-system_mem -shm_key 1" +} + +proc memp003_body { flags } { + global alphabet + source ./include.tcl + + puts "Memp003: {$flags} Reader/Writer tests" + + if { [mem_chk $flags] == 1 } { + return + } + + env_cleanup $testdir + set psize 1024 + set nentries 500 + set testfile mpool.db + set t1 $testdir/t1 + + # Create an environment that the two processes can share, with + # 20 pages per cache. + set c [list 0 [expr $psize * 20 * 3] 3] + set dbenv [eval {berkdb_env \ + -create -lock -home $testdir -cachesize $c} $flags] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + # First open and create the file. + set db [berkdb_open -env $dbenv -create -truncate \ + -mode 0644 -pagesize $psize -btree $testfile] + error_check_good dbopen/RW [is_valid_db $db] TRUE + + set did [open $dict] + set txn "" + set count 0 + + puts "\tMemp003.a: create database" + set keys "" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + lappend keys $str + + set ret [eval {$db put} $txn {$str $str}] + error_check_good put $ret 0 + + set ret [eval {$db get} $txn {$str}] + error_check_good get $ret [list [list $str $str]] + + incr count + } + close $did + error_check_good close [$db close] 0 + + # Now open the file for read-only + set db [berkdb_open -env $dbenv -rdonly $testfile] + error_check_good dbopen/RO [is_substr $db db] 1 + + puts "\tMemp003.b: verify a few keys" + # Read and verify a couple of keys; saving them to check later + set testset "" + for { set i 0 } { $i < 10 } { incr i } { + set ndx [berkdb random_int 0 [expr $nentries - 1]] + set key [lindex $keys $ndx] + if { [lsearch $testset $key] != -1 } { + incr i -1 + continue; + } + + # The remote process stuff is unhappy with + # zero-length keys; make sure we don't pick one. + if { [llength $key] == 0 } { + incr i -1 + continue + } + + lappend testset $key + + set ret [eval {$db get} $txn {$key}] + error_check_good get/RO $ret [list [list $key $key]] + } + + puts "\tMemp003.c: retrieve and modify keys in remote process" + # Now open remote process where we will open the file RW + set f1 [open |$tclsh_path r+] + puts $f1 "source $test_path/test.tcl" + puts $f1 "flush stdout" + flush $f1 + + set c [concat "{" [list 0 [expr $psize * 20 * 3] 3] "}" ] + set remote_env [send_cmd $f1 \ + "berkdb_env -create -lock -home $testdir -cachesize $c $flags"] + error_check_good remote_dbenv [is_valid_env $remote_env] TRUE + + set remote_db [send_cmd $f1 "berkdb_open -env $remote_env $testfile"] + error_check_good remote_dbopen [is_valid_db $remote_db] TRUE + + foreach k $testset { + # Get the key + set ret [send_cmd $f1 "$remote_db get $k"] + error_check_good remote_get $ret [list [list $k $k]] + + # Now replace the key + set ret [send_cmd $f1 "$remote_db put $k $k$k"] + error_check_good remote_put $ret 0 + } + + puts "\tMemp003.d: verify changes in local process" + foreach k $testset { + set ret [eval {$db get} $txn {$key}] + error_check_good get_verify/RO $ret [list [list $key $key$key]] + } + + puts "\tMemp003.e: Fill up the cache with dirty buffers" + foreach k $testset { + # Now rewrite the keys with BIG data + set data [replicate $alphabet 32] + set ret [send_cmd $f1 "$remote_db put $k $data"] + error_check_good remote_put $ret 0 + } + + puts "\tMemp003.f: Get more pages for the read-only file" + dump_file $db $txn $t1 nop + + puts "\tMemp003.g: Sync from the read-only file" + error_check_good db_sync [$db sync] 0 + error_check_good db_close [$db close] 0 + + set ret [send_cmd $f1 "$remote_db close"] + error_check_good remote_get $ret 0 + + # Close the environment both remotely and locally. + set ret [send_cmd $f1 "$remote_env close"] + error_check_good remote:env_close $ret 0 + close $f1 + + reset_env $dbenv +} diff --git a/db/test/mutex001.tcl b/db/test/mutex001.tcl new file mode 100644 index 000000000..f6a36c58b --- /dev/null +++ b/db/test/mutex001.tcl @@ -0,0 +1,51 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: mutex001.tcl,v 11.23 2002/04/30 19:37:36 sue Exp +# + +# TEST mutex001 +# TEST Test basic mutex functionality +proc mutex001 { } { + source ./include.tcl + + puts "Mutex001: Basic functionality" + env_cleanup $testdir + set nlocks 20 + + # Test open w/out create; should fail + error_check_bad \ + env_open [catch {berkdb_env -lock -home $testdir} env] 0 + + puts "\tMutex001.a: Create lock env" + # Now open for real + set env [berkdb_env -create -mode 0644 -lock -home $testdir] + error_check_good env_open [is_valid_env $env] TRUE + + puts "\tMutex001.b: Create $nlocks mutexes" + set m [$env mutex 0644 $nlocks] + error_check_good mutex_init [is_valid_mutex $m $env] TRUE + + # Get, set each mutex; sleep, then get Release + puts "\tMutex001.c: Get/set loop" + for { set i 0 } { $i < $nlocks } { incr i } { + set r [$m get $i ] + error_check_good mutex_get $r 0 + + set r [$m setval $i $i] + error_check_good mutex_setval $r 0 + } + tclsleep 5 + for { set i 0 } { $i < $nlocks } { incr i } { + set r [$m getval $i] + error_check_good mutex_getval $r $i + + set r [$m release $i ] + error_check_good mutex_get $r 0 + } + + error_check_good mutex_close [$m close] 0 + error_check_good env_close [$env close] 0 +} diff --git a/db/test/mutex002.tcl b/db/test/mutex002.tcl new file mode 100644 index 000000000..c8bf7d17e --- /dev/null +++ b/db/test/mutex002.tcl @@ -0,0 +1,94 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: mutex002.tcl,v 11.23 2002/04/30 19:37:36 sue Exp +# + +# TEST mutex002 +# TEST Test basic mutex synchronization +proc mutex002 { } { + source ./include.tcl + + puts "Mutex002: Basic synchronization" + env_cleanup $testdir + set nlocks 20 + + # Fork off child before we open any files. + set f1 [open |$tclsh_path r+] + puts $f1 "source $test_path/test.tcl" + flush $f1 + + # Open the environment and the mutex locally + puts "\tMutex002.a: Open local and remote env" + set local_env [berkdb_env -create -mode 0644 -lock -home $testdir] + error_check_good env_open [is_valid_env $local_env] TRUE + + set local_mutex [$local_env mutex 0644 $nlocks] + error_check_good \ + mutex_init [is_valid_mutex $local_mutex $local_env] TRUE + + # Open the environment and the mutex remotely + set remote_env [send_cmd $f1 "berkdb_env -lock -home $testdir"] + error_check_good remote:env_open [is_valid_env $remote_env] TRUE + + set remote_mutex [send_cmd $f1 "$remote_env mutex 0644 $nlocks"] + error_check_good \ + mutex_init [is_valid_mutex $remote_mutex $remote_env] TRUE + + # Do a get here, then set the value to be pid. + # On the remote side fire off a get and getval. + puts "\tMutex002.b: Local and remote get/set" + set r [$local_mutex get 1] + error_check_good lock_get $r 0 + + set r [$local_mutex setval 1 [pid]] + error_check_good lock_get $r 0 + + # Now have the remote side request the lock and check its + # value. Then wait 5 seconds, release the mutex and see + # what the remote side returned. + send_timed_cmd $f1 1 "$remote_mutex get 1" + send_timed_cmd $f1 1 "set ret \[$remote_mutex getval 1\]" + + # Now sleep before resetting and releasing lock + tclsleep 5 + set newv [expr [pid] - 1] + set r [$local_mutex setval 1 $newv] + error_check_good mutex_setval $r 0 + + set r [$local_mutex release 1] + error_check_good mutex_release $r 0 + + # Now get the result from the other script + # Timestamp + set result [rcv_result $f1] + error_check_good lock_get:remote_time [expr $result > 4] 1 + + # Timestamp + set result [rcv_result $f1] + + # Mutex value + set result [send_cmd $f1 "puts \$ret"] + error_check_good lock_get:remote_getval $result $newv + + # Close down the remote + puts "\tMutex002.c: Close remote" + set ret [send_cmd $f1 "$remote_mutex close" 5] + # Not sure why we need this, but we do... an extra blank line + # someone gets output somewhere + gets $f1 ret + error_check_good remote:mutex_close $ret 0 + + set ret [send_cmd $f1 "$remote_env close"] + error_check_good remote:env_close $ret 0 + + catch { close $f1 } result + + set ret [$local_mutex close] + error_check_good local:mutex_close $ret 0 + + set ret [$local_env close] + error_check_good local:env_close $ret 0 +} diff --git a/db/test/mutex003.tcl b/db/test/mutex003.tcl new file mode 100644 index 000000000..b6503ed1b --- /dev/null +++ b/db/test/mutex003.tcl @@ -0,0 +1,52 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: mutex003.tcl,v 11.23 2002/04/30 19:37:37 sue Exp +# + +# TEST mutex003 +# TEST Generate a bunch of parallel testers that try to randomly obtain locks. +proc mutex003 { } { + source ./include.tcl + + set nmutex 20 + set iter 500 + set procs 5 + set mdegree 3 + set wait 2 + puts "Mutex003: Multi-process random mutex test" + + env_cleanup $testdir + + puts "\tMutex003.a: Create environment" + # Now open the region we'll use for multiprocess testing. + set env [berkdb_env -create -mode 0644 -lock -home $testdir] + error_check_good env_open [is_valid_env $env] TRUE + + set mutex [$env mutex 0644 $nmutex] + error_check_good mutex_init [is_valid_mutex $mutex $env] TRUE + + error_check_good mutex_close [$mutex close] 0 + + # Now spawn off processes + puts "\tMutex003.b: Create $procs processes" + set proclist {} + for { set i 0 } {$i < $procs} {incr i} { + puts "$tclsh_path\ + $test_path/mutexscript.tcl $testdir\ + $iter $nmutex $wait $mdegree > $testdir/$i.mutexout &" + set p [exec $tclsh_path $test_path/wrap.tcl \ + mutexscript.tcl $testdir/$i.mutexout $testdir\ + $iter $nmutex $wait $mdegree &] + lappend proclist $p + } + puts "\tMutex003.c: $procs independent processes now running" + watch_procs + error_check_good env_close [$env close] 0 + # Remove output files + for { set i 0 } {$i < $procs} {incr i} { + fileremove -f $testdir/$i.mutexout + } +} diff --git a/db/test/recd017.tcl b/db/test/recd017.tcl new file mode 100644 index 000000000..ac0b5b4f0 --- /dev/null +++ b/db/test/recd017.tcl @@ -0,0 +1,150 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: recd017.tcl,v 11.3 2002/04/29 15:15:30 sandstro Exp +# +# TEST recd017 +# TEST Test recovery and security. This is basically a watered +# TEST down version of recd001 just to verify that encrypted environments +# TEST can be recovered. +proc recd017 { method {select 0} args} { + global fixed_len + global encrypt + global passwd + source ./include.tcl + + set orig_fixed_len $fixed_len + set opts [convert_args $method $args] + set omethod [convert_method $method] + + puts "Recd017: $method operation/transaction tests" + + # Create the database and environment. + env_cleanup $testdir + + # The recovery tests were originally written to + # do a command, abort, do it again, commit, and then + # repeat the sequence with another command. Each command + # tends to require that the previous command succeeded and + # left the database a certain way. To avoid cluttering up the + # op_recover interface as well as the test code, we create two + # databases; one does abort and then commit for each op, the + # other does prepare, prepare-abort, and prepare-commit for each + # op. If all goes well, this allows each command to depend + # exactly one successful iteration of the previous command. + set testfile recd017.db + set testfile2 recd017-2.db + + set flags "-create -encryptaes $passwd -txn -home $testdir" + + puts "\tRecd017.a.0: creating environment" + set env_cmd "berkdb_env $flags" + convert_encrypt $env_cmd + set dbenv [eval $env_cmd] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + # + # We need to create a database to get the pagesize (either + # the default or whatever might have been specified). + # Then remove it so we can compute fixed_len and create the + # real database. + set oflags "-create $omethod -mode 0644 \ + -env $dbenv -encrypt $opts $testfile" + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + set stat [$db stat] + # + # Compute the fixed_len based on the pagesize being used. + # We want the fixed_len to be 1/4 the pagesize. + # + set pg [get_pagesize $stat] + error_check_bad get_pagesize $pg -1 + set fixed_len [expr $pg / 4] + error_check_good db_close [$db close] 0 + error_check_good dbremove [berkdb dbremove -env $dbenv $testfile] 0 + + # Convert the args again because fixed_len is now real. + # Create the databases and close the environment. + # cannot specify db truncate in txn protected env!!! + set opts [convert_args $method ""] + set omethod [convert_method $method] + set oflags "-create $omethod -mode 0644 \ + -env $dbenv -encrypt $opts $testfile" + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + error_check_good db_close [$db close] 0 + + set oflags "-create $omethod -mode 0644 \ + -env $dbenv -encrypt $opts $testfile2" + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + error_check_good db_close [$db close] 0 + + error_check_good env_close [$dbenv close] 0 + + puts "\tRecd017.a.1: Verify db_printlog can read logfile" + set tmpfile $testdir/printlog.out + set stat [catch {exec $util_path/db_printlog -h $testdir -P $passwd \ + > $tmpfile} ret] + error_check_good db_printlog $stat 0 + fileremove $tmpfile + + # List of recovery tests: {CMD MSG} pairs. + set rlist { + { {DB put -txn TXNID $key $data} "Recd017.b: put"} + { {DB del -txn TXNID $key} "Recd017.c: delete"} + } + + # These are all the data values that we're going to need to read + # through the operation table and run the recovery tests. + + if { [is_record_based $method] == 1 } { + set key 1 + } else { + set key recd017_key + } + set data recd017_data + foreach pair $rlist { + set cmd [subst [lindex $pair 0]] + set msg [lindex $pair 1] + if { $select != 0 } { + set tag [lindex $msg 0] + set tail [expr [string length $tag] - 2] + set tag [string range $tag $tail $tail] + if { [lsearch $select $tag] == -1 } { + continue + } + } + + if { [is_queue $method] != 1 } { + if { [string first append $cmd] != -1 } { + continue + } + if { [string first consume $cmd] != -1 } { + continue + } + } + +# if { [is_fixed_length $method] == 1 } { +# if { [string first partial $cmd] != -1 } { +# continue +# } +# } + op_recover abort $testdir $env_cmd $testfile $cmd $msg + op_recover commit $testdir $env_cmd $testfile $cmd $msg + # + # Note that since prepare-discard ultimately aborts + # the txn, it must come before prepare-commit. + # + op_recover prepare-abort $testdir $env_cmd $testfile2 \ + $cmd $msg + op_recover prepare-discard $testdir $env_cmd $testfile2 \ + $cmd $msg + op_recover prepare-commit $testdir $env_cmd $testfile2 \ + $cmd $msg + } + set fixed_len $orig_fixed_len + return +} diff --git a/db/test/recd018.tcl b/db/test/recd018.tcl new file mode 100644 index 000000000..b36781ca2 --- /dev/null +++ b/db/test/recd018.tcl @@ -0,0 +1,110 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 2000-2002 +# Sleepycat Software. All rights reserved. +# +# Id: recd018.tcl,v 11.2 2002/03/13 21:04:20 sue Exp +# +# TEST recd018 +# TEST Test recover of closely interspersed checkpoints and commits. +# +# This test is from the error case from #4230. +# +proc recd018 { method {ndbs 10} args } { + source ./include.tcl + + set args [convert_args $method $args] + set omethod [convert_method $method] + set tnum 18 + + puts "Recd0$tnum ($args): $method recovery of checkpoints and commits." + + set tname recd0$tnum.db + env_cleanup $testdir + + set i 0 + if { [is_record_based $method] == 1 } { + set key 1 + set key2 2 + } else { + set key KEY + set key2 KEY2 + } + + puts "\tRecd0$tnum.a: Create environment and database." + set flags "-create -txn -home $testdir" + + set env_cmd "berkdb_env $flags" + set dbenv [eval $env_cmd] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + set oflags "-auto_commit -env $dbenv -create -mode 0644 $args $omethod" + for { set i 0 } { $i < $ndbs } { incr i } { + set testfile $tname.$i + set db($i) [eval {berkdb_open} $oflags $testfile] + error_check_good dbopen [is_valid_db $db($i)] TRUE + set file $testdir/$testfile.init + catch { file copy -force $testdir/$testfile $file} res + copy_extent_file $testdir $testfile init + } + + # Main loop: Write a record or two to each database. + # Do a commit immediately followed by a checkpoint after each one. + error_check_good "Initial Checkpoint" [$dbenv txn_checkpoint] 0 + + puts "\tRecd0$tnum.b Put/Commit/Checkpoint to $ndbs databases" + for { set i 0 } { $i < $ndbs } { incr i } { + set testfile $tname.$i + set data $i + + # Put, in a txn. + set txn [$dbenv txn] + error_check_good txn_begin [is_valid_txn $txn $dbenv] TRUE + error_check_good db_put \ + [$db($i) put -txn $txn $key [chop_data $method $data]] 0 + error_check_good txn_commit [$txn commit] 0 + error_check_good txn_checkpt [$dbenv txn_checkpoint] 0 + if { [expr $i % 2] == 0 } { + set txn [$dbenv txn] + error_check_good txn2 [is_valid_txn $txn $dbenv] TRUE + error_check_good db_put [$db($i) put \ + -txn $txn $key2 [chop_data $method $data]] 0 + error_check_good txn_commit [$txn commit] 0 + error_check_good txn_checkpt [$dbenv txn_checkpoint] 0 + } + error_check_good db_close [$db($i) close] 0 + set file $testdir/$testfile.afterop + catch { file copy -force $testdir/$testfile $file} res + copy_extent_file $testdir $testfile afterop + } + error_check_good env_close [$dbenv close] 0 + + # Now, loop through and recover to each timestamp, verifying the + # expected increment. + puts "\tRecd0$tnum.c: Run recovery (no-op)" + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 0 + + puts "\tRecd0$tnum.d: Run recovery (initial file)" + for { set i 0 } {$i < $ndbs } { incr i } { + set testfile $tname.$i + set file $testdir/$testfile.init + catch { file copy -force $file $testdir/$testfile } res + move_file_extent $testdir $testfile init copy + } + + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 0 + + puts "\tRecd0$tnum.e: Run recovery (after file)" + for { set i 0 } {$i < $ndbs } { incr i } { + set testfile $tname.$i + set file $testdir/$testfile.afterop + catch { file copy -force $file $testdir/$testfile } res + move_file_extent $testdir $testfile afterop copy + } + + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 0 + +} diff --git a/db/test/recd019.tcl b/db/test/recd019.tcl new file mode 100644 index 000000000..faff985d4 --- /dev/null +++ b/db/test/recd019.tcl @@ -0,0 +1,121 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: recd019.tcl,v 11.3 2002/08/08 15:38:07 bostic Exp +# +# TEST recd019 +# TEST Test txn id wrap-around and recovery. +proc recd019 { method {numid 50} args} { + global fixed_len + global txn_curid + global log_log_record_types + source ./include.tcl + + set orig_fixed_len $fixed_len + set opts [convert_args $method $args] + set omethod [convert_method $method] + + puts "Recd019: $method txn id wrap-around test" + + # Create the database and environment. + env_cleanup $testdir + + set testfile recd019.db + + set flags "-create -txn -home $testdir" + + puts "\tRecd019.a: creating environment" + set env_cmd "berkdb_env $flags" + set dbenv [eval $env_cmd] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + # Test txn wrapping. Force a txn_recycle msg. + # + set new_curid $txn_curid + set new_maxid [expr $new_curid + $numid] + error_check_good txn_id_set [$dbenv txn_id_set $new_curid $new_maxid] 0 + + # + # We need to create a database to get the pagesize (either + # the default or whatever might have been specified). + # Then remove it so we can compute fixed_len and create the + # real database. + set oflags "-create $omethod -mode 0644 \ + -env $dbenv $opts $testfile" + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + set stat [$db stat] + # + # Compute the fixed_len based on the pagesize being used. + # We want the fixed_len to be 1/4 the pagesize. + # + set pg [get_pagesize $stat] + error_check_bad get_pagesize $pg -1 + set fixed_len [expr $pg / 4] + error_check_good db_close [$db close] 0 + error_check_good dbremove [berkdb dbremove -env $dbenv $testfile] 0 + + # Convert the args again because fixed_len is now real. + # Create the databases and close the environment. + # cannot specify db truncate in txn protected env!!! + set opts [convert_args $method ""] + set omethod [convert_method $method] + set oflags "-create $omethod -mode 0644 \ + -env $dbenv -auto_commit $opts $testfile" + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + + # + # Force txn ids to wrap twice and then some. + # + set nument [expr $numid * 3 - 2] + puts "\tRecd019.b: Wrapping txn ids after $numid" + set file $testdir/$testfile.init + catch { file copy -force $testdir/$testfile $file} res + copy_extent_file $testdir $testfile init + for { set i 1 } { $i <= $nument } { incr i } { + # Use 'i' as key so method doesn't matter + set key $i + set data $i + + # Put, in a txn. + set txn [$dbenv txn] + error_check_good txn_begin [is_valid_txn $txn $dbenv] TRUE + error_check_good db_put \ + [$db put -txn $txn $key [chop_data $method $data]] 0 + error_check_good txn_commit [$txn commit] 0 + } + error_check_good db_close [$db close] 0 + set file $testdir/$testfile.afterop + catch { file copy -force $testdir/$testfile $file} res + copy_extent_file $testdir $testfile afterop + error_check_good env_close [$dbenv close] 0 + + # Keep track of the log types we've seen + if { $log_log_record_types == 1} { + logtrack_read $testdir + } + + # Now, loop through and recover. + puts "\tRecd019.c: Run recovery (no-op)" + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 0 + + puts "\tRecd019.d: Run recovery (initial file)" + set file $testdir/$testfile.init + catch { file copy -force $file $testdir/$testfile } res + move_file_extent $testdir $testfile init copy + + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 0 + + puts "\tRecd019.e: Run recovery (after file)" + set file $testdir/$testfile.afterop + catch { file copy -force $file $testdir/$testfile } res + move_file_extent $testdir $testfile afterop copy + + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 0 +} diff --git a/db/test/recd020.tcl b/db/test/recd020.tcl new file mode 100644 index 000000000..5fd0e1e55 --- /dev/null +++ b/db/test/recd020.tcl @@ -0,0 +1,180 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: recd020.tcl,v 11.8 2002/08/08 15:38:08 bostic Exp +# +# TEST recd020 +# TEST Test recovery after checksum error. +proc recd020 { method args} { + global fixed_len + global log_log_record_types + global datastr + source ./include.tcl + + set pgindex [lsearch -exact $args "-pagesize"] + if { $pgindex != -1 } { + puts "Recd020: skipping for specific pagesizes" + return + } + if { [is_queueext $method] == 1 } { + puts "Recd020: skipping for method $method" + return + } + + puts "Recd020: $method recovery after checksum error" + + # Create the database and environment. + env_cleanup $testdir + + set testfile recd020.db + set flags "-create -txn -home $testdir" + + puts "\tRecd020.a: creating environment" + set env_cmd "berkdb_env $flags" + set dbenv [eval $env_cmd] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + set pgsize 512 + set orig_fixed_len $fixed_len + set fixed_len [expr $pgsize / 4] + set opts [convert_args $method $args] + set omethod [convert_method $method] + set oflags "-create $omethod -mode 0644 \ + -auto_commit -chksum -pagesize $pgsize $opts $testfile" + set db [eval {berkdb_open} -env $dbenv $oflags] + + # + # Put some data. + # + set nument 50 + puts "\tRecd020.b: Put some data" + for { set i 1 } { $i <= $nument } { incr i } { + # Use 'i' as key so method doesn't matter + set key $i + set data $i$datastr + + # Put, in a txn. + set txn [$dbenv txn] + error_check_good txn_begin [is_valid_txn $txn $dbenv] TRUE + error_check_good db_put \ + [$db put -txn $txn $key [chop_data $method $data]] 0 + error_check_good txn_commit [$txn commit] 0 + } + error_check_good db_close [$db close] 0 + error_check_good env_close [$dbenv close] 0 + # + # We need to remove the env so that we don't get cached + # pages. + # + error_check_good env_remove [berkdb envremove -home $testdir] 0 + + puts "\tRecd020.c: Overwrite part of database" + # + # First just touch some bits in the file. We want to go + # through the paging system, so touch some data pages, + # like the middle of page 2. + # We should get a checksum error for the checksummed file. + # + set pg 2 + set fid [open $testdir/$testfile r+] + fconfigure $fid -translation binary + set seeklen [expr $pgsize * $pg + 200] + seek $fid $seeklen start + set byte [read $fid 1] + binary scan $byte c val + set newval [expr ~$val] + set newbyte [binary format c $newval] + seek $fid $seeklen start + puts -nonewline $fid $newbyte + close $fid + + # + # Verify we get the checksum error. When we get it, it should + # log the error as well, so when we run recovery we'll need to + # do catastrophic recovery. We do this in a sub-process so that + # the files are closed after the panic. + # + set f1 [open |$tclsh_path r+] + puts $f1 "source $test_path/test.tcl" + + set env_cmd "berkdb_env_noerr $flags" + set dbenv [send_cmd $f1 $env_cmd] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + set db [send_cmd $f1 "{berkdb_open_noerr} -env $dbenv $oflags"] + error_check_good db [is_valid_db $db] TRUE + + # We need to set non-blocking mode so that after each command + # we can read all the remaining output from that command and + # we can know what the output from one command is. + fconfigure $f1 -blocking 0 + set ret [read $f1] + set got_err 0 + for { set i 1 } { $i <= $nument } { incr i } { + set stat [send_cmd $f1 "catch {$db get $i} r"] + set getret [send_cmd $f1 "puts \$r"] + set ret [read $f1] + if { $stat == 1 } { + error_check_good dbget:fail [is_substr $getret \ + "checksum error: catastrophic recovery required"] 1 + set got_err 1 + # Now verify that it was an error on the page we set. + error_check_good dbget:pg$pg [is_substr $ret \ + "failed for page $pg"] 1 + break + } else { + set key [lindex [lindex $getret 0] 0] + set data [lindex [lindex $getret 0] 1] + error_check_good keychk $key $i + error_check_good datachk $data \ + [pad_data $method $i$datastr] + } + } + error_check_good got_chksum $got_err 1 + set ret [send_cmd $f1 "$db close"] + set extra [read $f1] + error_check_good db:fail [is_substr $ret "run recovery"] 1 + + set ret [send_cmd $f1 "$dbenv close"] + error_check_good env_close:fail [is_substr $ret "run recovery"] 1 + close $f1 + + # Keep track of the log types we've seen + if { $log_log_record_types == 1} { + logtrack_read $testdir + } + + puts "\tRecd020.d: Run normal recovery" + set ret [catch {exec $util_path/db_recover -h $testdir} r] + error_check_good db_recover $ret 1 + error_check_good dbrec:fail \ + [is_substr $r "checksum error: catastrophic recovery required"] 1 + + catch {fileremove $testdir/$testfile} ret + puts "\tRecd020.e: Run catastrophic recovery" + set ret [catch {exec $util_path/db_recover -c -h $testdir} r] + error_check_good db_recover $ret 0 + + # + # Now verify the data was reconstructed correctly. + # + set env_cmd "berkdb_env_noerr $flags" + set dbenv [eval $env_cmd] + error_check_good dbenv [is_valid_env $dbenv] TRUE + + set db [eval {berkdb_open} -env $dbenv $oflags] + error_check_good db [is_valid_db $db] TRUE + + for { set i 1 } { $i <= $nument } { incr i } { + set stat [catch {$db get $i} ret] + error_check_good stat $stat 0 + set key [lindex [lindex $ret 0] 0] + set data [lindex [lindex $ret 0] 1] + error_check_good keychk $key $i + error_check_good datachk $data [pad_data $method $i$datastr] + } + error_check_good db_close [$db close] 0 + error_check_good env_close [$dbenv close] 0 +} diff --git a/db/test/rep002.tcl b/db/test/rep002.tcl new file mode 100644 index 000000000..a10862073 --- /dev/null +++ b/db/test/rep002.tcl @@ -0,0 +1,278 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 2002 +# Sleepycat Software. All rights reserved. +# +# Id: rep002.tcl,v 11.11 2002/08/08 18:13:12 sue Exp +# +# TEST rep002 +# TEST Basic replication election test. +# TEST +# TEST Run a modified version of test001 in a replicated master environment; +# TEST hold an election among a group of clients to make sure they select +# TEST a proper master from amongst themselves, in various scenarios. + +proc rep002 { method { niter 10 } { nclients 3 } { tnum "02" } args } { + source ./include.tcl + global elect_timeout + + set elect_timeout 1000000 + + if { [is_record_based $method] == 1 } { + puts "Rep002: Skipping for method $method." + return + } + + env_cleanup $testdir + + set qdir $testdir/MSGQUEUEDIR + replsetup $qdir + + set masterdir $testdir/MASTERDIR + file mkdir $masterdir + + for { set i 0 } { $i < $nclients } { incr i } { + set clientdir($i) $testdir/CLIENTDIR.$i + file mkdir $clientdir($i) + } + + puts "Rep0$tnum: Replication election test with $nclients clients." + + # Open a master. + repladd 1 + set env_cmd(M) "berkdb_env -create -log_max 1000000 -home \ + $masterdir -txn -rep_master -rep_transport \[list 1 replsend\]" + set masterenv [eval $env_cmd(M)] + error_check_good master_env [is_valid_env $masterenv] TRUE + + # Open the clients. + for { set i 0 } { $i < $nclients } { incr i } { + set envid [expr $i + 2] + repladd $envid + set env_cmd($i) "berkdb_env -create -home $clientdir($i) \ + -txn -rep_client -rep_transport \[list $envid replsend\]" + set clientenv($i) [eval $env_cmd($i)] + error_check_good \ + client_env($i) [is_valid_env $clientenv($i)] TRUE + } + + # Run a modified test001 in the master. + puts "\tRep0$tnum.a: Running test001 in replicated env." + eval test001 $method $niter 0 $tnum 0 -env $masterenv $args + + # Loop, processing first the master's messages, then the client's, + # until both queues are empty. + while { 1 } { + set nproced 0 + + incr nproced [replprocessqueue $masterenv 1] + + for { set i 0 } { $i < $nclients } { incr i } { + set envid [expr $i + 2] + incr nproced [replprocessqueue $clientenv($i) $envid] + } + + if { $nproced == 0 } { + break + } + } + + # Verify the database in the client dir. + for { set i 0 } { $i < $nclients } { incr i } { + puts "\tRep0$tnum.b: Verifying contents of client database $i." + set testdir [get_home $masterenv] + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + open_and_dump_file test0$tnum.db $clientenv($i) $testdir/t1 \ + test001.check dump_file_direction "-first" "-next" + + if { [string compare [convert_method $method] -recno] != 0 } { + filesort $t1 $t3 + } + error_check_good diff_files($t2,$t3) [filecmp $t2 $t3] 0 + + verify_dir $clientdir($i) "\tRep0$tnum.c: " 0 0 1 + } + + # Start an election in the first client. + puts "\tRep0$tnum.d: Starting election without dead master." + + set elect_pipe(0) [start_election \ + $qdir $env_cmd(0) [expr $nclients + 1] 20 $elect_timeout] + + tclsleep 1 + + # We want to verify all the clients but the one that declared an + # election get the election message. + # We also want to verify that the master declares the election + # over by fiat, even if everyone uses a lower priority than 20. + # Loop and process all messages, keeping track of which + # sites got a HOLDELECTION and checking that the returned newmaster, + # if any, is 1 (the master's replication ID). + set got_hold_elect(M) 0 + for { set i 0 } { $i < $nclients } { incr i } { + set got_hold_elect($i) 0 + } + while { 1 } { + set nproced 0 + set he 0 + set nm 0 + + + incr nproced [replprocessqueue $masterenv 1 0 he nm] + + if { $he == 1 } { + set elect_pipe(M) [start_election $qdir \ + $env_cmd(M) [expr $nclients + 1] 0 $elect_timeout] + set got_hold_elect(M) 1 + } + if { $nm != 0 } { + error_check_good newmaster_is_master $nm 1 + } + + for { set i 0 } { $i < $nclients } { incr i } { + set he 0 + set envid [expr $i + 2] + incr nproced \ + [replprocessqueue $clientenv($i) $envid 0 he nm] + if { $he == 1 } { + # error_check_bad client(0)_in_elect $i 0 + set elect_pipe(M) [start_election $qdir \ + $env_cmd($i) [expr $nclients + 1] 0 \ + $elect_timeout] + set got_hold_elect($i) 1 + } + if { $nm != 0 } { + error_check_good newmaster_is_master $nm 1 + } + } + + if { $nproced == 0 } { + break + } + } + + error_check_good got_hold_elect(master) $got_hold_elect(M) 0 + unset got_hold_elect(M) + # error_check_good got_hold_elect(0) $got_hold_elect(0) 0 + unset got_hold_elect(0) + for { set i 1 } { $i < $nclients } { incr i } { + error_check_good got_hold_elect($i) $got_hold_elect($i) 1 + unset got_hold_elect($i) + } + + cleanup_elections + + # We need multiple clients to proceed from here. + if { $nclients < 2 } { + puts "\tRep0$tnum: Skipping for less than two clients." + error_check_good masterenv_close [$masterenv close] 0 + for { set i 0 } { $i < $nclients } { incr i } { + error_check_good clientenv_close($i) \ + [$clientenv($i) close] 0 + } + return + } + + # Make sure all the clients are synced up and ready to be good + # voting citizens. + error_check_good master_flush [$masterenv rep_flush] 0 + while { 1 } { + set nproced 0 + incr nproced [replprocessqueue $masterenv 1 0] + for { set i 0 } { $i < $nclients } { incr i } { + incr nproced [replprocessqueue $clientenv($i) \ + [expr $i + 2] 0] + } + + if { $nproced == 0 } { + break + } + } + + # Now hold another election in the first client, this time with + # a dead master. + puts "\tRep0$tnum.e: Starting election with dead master." + error_check_good masterenv_close [$masterenv close] 0 + + for { set i 0 } { $i < $nclients } { incr i } { + replclear [expr $i + 2] + } + + set elect_pipe(0) [start_election \ + $qdir $env_cmd(0) [expr $nclients + 1] 20 $elect_timeout] + + tclsleep 1 + + # Process messages, and verify that the client with the highest + # priority--client #1--wins. + set got_newmaster 0 + set tries 10 + while { 1 } { + set nproced 0 + set he 0 + set nm 0 + + for { set i 0 } { $i < $nclients } { incr i } { + set he 0 + set envid [expr $i + 2] + incr nproced \ + [replprocessqueue $clientenv($i) $envid 0 he nm] + if { $he == 1 } { + + # Client #1 has priority 100; everyone else + # has priority 10. + if { $i == 1 } { + set pri 100 + } else { + set pri 10 + } + # error_check_bad client(0)_in_elect $i 0 + set elect_pipe(M) [start_election $qdir \ + $env_cmd($i) [expr $nclients + 1] $pri \ + $elect_timeout] + set got_hold_elect($i) 1 + } + if { $nm != 0 } { + error_check_good newmaster_is_master $nm \ + [expr 1 + 2] + set got_newmaster $nm + + # If this env is the new master, it needs to + # configure itself as such--this is a different + # env handle from the one that performed the + # election. + if { $nm == $envid } { + error_check_good make_master($i) \ + [$clientenv($i) rep_start -master] \ + 0 + } + } + } + + # We need to wait around to make doubly sure that the + # election has finished... + if { $nproced == 0 } { + incr tries -1 + if { $tries == 0 } { + break + } else { + tclsleep 1 + } + } + } + + # Verify that client #1 is actually the winner. + error_check_good "client 1 wins" $got_newmaster [expr 1 + 2] + + cleanup_elections + + for { set i 0 } { $i < $nclients } { incr i } { + error_check_good clientenv_close($i) [$clientenv($i) close] 0 + } + + replclose $testdir/MSGQUEUEDIR +} + +proc reptwo { args } { eval rep002 $args } diff --git a/db/test/rep003.tcl b/db/test/rep003.tcl new file mode 100644 index 000000000..26d868b3e --- /dev/null +++ b/db/test/rep003.tcl @@ -0,0 +1,221 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 2002 +# Sleepycat Software. All rights reserved. +# +# Id: rep003.tcl,v 11.9 2002/08/09 02:23:50 margo Exp +# +# TEST rep003 +# TEST Repeated shutdown/restart replication test +# TEST +# TEST Run a quick put test in a replicated master environment; start up, +# TEST shut down, and restart client processes, with and without recovery. +# TEST To ensure that environment state is transient, use DB_PRIVATE. + +proc rep003 { method { tnum "03" } args } { + source ./include.tcl + global testdir rep003_dbname rep003_omethod rep003_oargs + + env_cleanup $testdir + set niter 10 + set rep003_dbname rep003.db + + if { [is_record_based $method] } { + puts "Rep0$tnum: Skipping for method $method" + return + } + + set rep003_omethod [convert_method $method] + set rep003_oargs [convert_args $method $args] + + replsetup $testdir/MSGQUEUEDIR + + set masterdir $testdir/MASTERDIR + file mkdir $masterdir + + set clientdir $testdir/CLIENTDIR + file mkdir $clientdir + + puts "Rep0$tnum: Replication repeated-startup test" + + # Open a master. + repladd 1 + set masterenv [berkdb_env_noerr -create -log_max 1000000 \ + -home $masterdir -txn -rep_master -rep_transport [list 1 replsend]] + error_check_good master_env [is_valid_env $masterenv] TRUE + + puts "\tRep0$tnum.a: Simple client startup test." + + # Put item one. + rep003_put $masterenv A1 a-one + + # Open a client. + repladd 2 + set clientenv [berkdb_env_noerr -create -private -home $clientdir -txn \ + -rep_client -rep_transport [list 2 replsend]] + error_check_good client_env [is_valid_env $clientenv] TRUE + + # Put another quick item. + rep003_put $masterenv A2 a-two + + # Loop, processing first the master's messages, then the client's, + # until both queues are empty. + while { 1 } { + set nproced 0 + + incr nproced [replprocessqueue $masterenv 1] + incr nproced [replprocessqueue $clientenv 2] + + if { $nproced == 0 } { + break + } + } + + rep003_check $clientenv A1 a-one + rep003_check $clientenv A2 a-two + + error_check_good clientenv_close [$clientenv close] 0 + replclear 2 + + # Now reopen the client after doing another put. + puts "\tRep0$tnum.b: Client restart." + rep003_put $masterenv B1 b-one + + unset clientenv + set clientenv [berkdb_env_noerr -create -private -home $clientdir -txn \ + -rep_client -rep_transport [list 2 replsend]] + error_check_good client_env [is_valid_env $clientenv] TRUE + + rep003_put $masterenv B2 b-two + + # Loop, processing first the master's messages, then the client's, + # until both queues are empty. + while { 1 } { + set nproced 0 + + # The items from part A should be present at all times-- + # if we roll them back, we've screwed up. [#5709] + rep003_check $clientenv A1 a-one + rep003_check $clientenv A2 a-two + + incr nproced [replprocessqueue $masterenv 1] + incr nproced [replprocessqueue $clientenv 2] + + if { $nproced == 0 } { + break + } + } + + rep003_check $clientenv B1 b-one + rep003_check $clientenv B2 b-two + + error_check_good clientenv_close [$clientenv close] 0 + + replclear 2 + + # Now reopen the client after a recovery. + puts "\tRep0$tnum.c: Client restart after recovery." + rep003_put $masterenv C1 c-one + + unset clientenv + set clientenv [berkdb_env_noerr -create -private -home $clientdir -txn \ + -recover -rep_client -rep_transport [list 2 replsend]] + error_check_good client_env [is_valid_env $clientenv] TRUE + + rep003_put $masterenv C2 c-two + + # Loop, processing first the master's messages, then the client's, + # until both queues are empty. + while { 1 } { + set nproced 0 + + # The items from part A should be present at all times-- + # if we roll them back, we've screwed up. [#5709] + rep003_check $clientenv A1 a-one + rep003_check $clientenv A2 a-two + rep003_check $clientenv B1 b-one + rep003_check $clientenv B2 b-two + + incr nproced [replprocessqueue $masterenv 1] + incr nproced [replprocessqueue $clientenv 2] + + if { $nproced == 0 } { + break + } + } + + rep003_check $clientenv C1 c-one + rep003_check $clientenv C2 c-two + + error_check_good clientenv_close [$clientenv close] 0 + + replclear 2 + + # Now reopen the client after a catastrophic recovery. + puts "\tRep0$tnum.d: Client restart after catastrophic recovery." + rep003_put $masterenv D1 d-one + + unset clientenv + set clientenv [berkdb_env_noerr -create -private -home $clientdir -txn \ + -recover_fatal -rep_client -rep_transport [list 2 replsend]] + error_check_good client_env [is_valid_env $clientenv] TRUE + + rep003_put $masterenv D2 d-two + + # Loop, processing first the master's messages, then the client's, + # until both queues are empty. + while { 1 } { + set nproced 0 + + # The items from part A should be present at all times-- + # if we roll them back, we've screwed up. [#5709] + rep003_check $clientenv A1 a-one + rep003_check $clientenv A2 a-two + rep003_check $clientenv B1 b-one + rep003_check $clientenv B2 b-two + rep003_check $clientenv C1 c-one + rep003_check $clientenv C2 c-two + + incr nproced [replprocessqueue $masterenv 1] + incr nproced [replprocessqueue $clientenv 2] + + if { $nproced == 0 } { + break + } + } + + rep003_check $clientenv D1 d-one + rep003_check $clientenv D2 d-two + + error_check_good clientenv_close [$clientenv close] 0 + + error_check_good masterenv_close [$masterenv close] 0 + replclose $testdir/MSGQUEUEDIR +} + +proc rep003_put { masterenv key data } { + global rep003_dbname rep003_omethod rep003_oargs + + set db [eval {berkdb_open_noerr -create -env $masterenv -auto_commit} \ + $rep003_omethod $rep003_oargs $rep003_dbname] + error_check_good rep3_put_open($key,$data) [is_valid_db $db] TRUE + + set txn [$masterenv txn] + error_check_good rep3_put($key,$data) [$db put -txn $txn $key $data] 0 + error_check_good rep3_put_txn_commit($key,$data) [$txn commit] 0 + + error_check_good rep3_put_close($key,$data) [$db close] 0 +} + +proc rep003_check { env key data } { + global rep003_dbname + + set db [berkdb_open_noerr -rdonly -env $env $rep003_dbname] + error_check_good rep3_check_open($key,$data) [is_valid_db $db] TRUE + + set dbt [$db get $key] + error_check_good rep3_check($key,$data) \ + [lindex [lindex $dbt 0] 1] $data + + error_check_good rep3_put_close($key,$data) [$db close] 0 +} diff --git a/db/test/rep004.tcl b/db/test/rep004.tcl new file mode 100644 index 000000000..a5433dd21 --- /dev/null +++ b/db/test/rep004.tcl @@ -0,0 +1,198 @@ +# +# Copyright (c) 2002 +# Sleepycat Software. All rights reserved. +# +# Id: rep004.tcl,v 1.5 2002/08/08 18:13:12 sue Exp +# +# TEST rep004 +# TEST Test of DB_REP_LOGSONLY. +# TEST +# TEST Run a quick put test in a master environment that has one logs-only +# TEST client. Shut down, then run catastrophic recovery in the logs-only +# TEST client and check that the database is present and populated. + +proc rep004 { method { nitems 10 } { tnum "04" } args } { + source ./include.tcl + global testdir + + env_cleanup $testdir + set dbname rep0$tnum.db + + set omethod [convert_method $method] + set oargs [convert_args $method $args] + + puts "Rep0$tnum: Test of logs-only replication clients" + + replsetup $testdir/MSGQUEUEDIR + set masterdir $testdir/MASTERDIR + file mkdir $masterdir + set clientdir $testdir/CLIENTDIR + file mkdir $clientdir + set logsonlydir $testdir/LOGSONLYDIR + file mkdir $logsonlydir + + # Open a master, a logsonly replica, and a normal client. + repladd 1 + set masterenv [berkdb_env -create -home $masterdir -txn -rep_master \ + -rep_transport [list 1 replsend]] + error_check_good master_env [is_valid_env $masterenv] TRUE + + repladd 2 + set loenv [berkdb_env -create -home $logsonlydir -txn -rep_logsonly \ + -rep_transport [list 2 replsend]] + error_check_good logsonly_env [is_valid_env $loenv] TRUE + + repladd 3 + set clientenv [berkdb_env -create -home $clientdir -txn -rep_client \ + -rep_transport [list 3 replsend]] + error_check_good client_env [is_valid_env $clientenv] TRUE + + + puts "\tRep0$tnum.a: Populate database." + + set db [eval {berkdb open -create -mode 0644 -auto_commit} \ + -env $masterenv $oargs $omethod $dbname] + error_check_good dbopen [is_valid_db $db] TRUE + + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $nitems } { + if { [is_record_based $method] == 1 } { + set key [expr $count + 1] + set data $str + } else { + set key $str + set data [reverse $str] + } + set kvals($count) $key + set dvals($count) [pad_data $method $data] + + set txn [$masterenv txn] + error_check_good txn($count) [is_valid_txn $txn $masterenv] TRUE + + set ret [eval \ + {$db put} -txn $txn {$key [chop_data $method $data]}] + error_check_good put($count) $ret 0 + + error_check_good commit($count) [$txn commit] 0 + + incr count + } + + puts "\tRep0$tnum.b: Sync up clients." + set donenow 0 + while { 1 } { + set nproced 0 + + incr nproced [replprocessqueue $masterenv 1] + incr nproced [replprocessqueue $loenv 2] + incr nproced [replprocessqueue $clientenv 3] + + if { $nproced == 0 } { + break + } + } + + + puts "\tRep0$tnum.c: Get master and logs-only client ahead." + set newcount 0 + while { [gets $did str] != -1 && $newcount < $nitems } { + if { [is_record_based $method] == 1 } { + set key [expr $count + 1] + set data $str + } else { + set key $str + set data [reverse $str] + } + set kvals($count) $key + set dvals($count) [pad_data $method $data] + + set txn [$masterenv txn] + error_check_good txn($count) [is_valid_txn $txn $masterenv] TRUE + + set ret [eval \ + {$db put} -txn $txn {$key [chop_data $method $data]}] + error_check_good put($count) $ret 0 + + error_check_good commit($count) [$txn commit] 0 + + incr count + incr newcount + } + + error_check_good db_close [$db close] 0 + + puts "\tRep0$tnum.d: Sync up logs-only client only, then fail over." + set donenow 0 + while { 1 } { + set nproced 0 + + incr nproced [replprocessqueue $masterenv 1] + incr nproced [replprocessqueue $loenv 2] + + if { $nproced == 0 } { + break + } + } + + + # "Crash" the master, and fail over to the upgradeable client. + error_check_good masterenv_close [$masterenv close] 0 + replclear 3 + + error_check_good upgrade_client [$clientenv rep_start -master] 0 + set donenow 0 + while { 1 } { + set nproced 0 + + incr nproced [replprocessqueue $clientenv 3] + incr nproced [replprocessqueue $loenv 2] + + if { $nproced == 0 } { + break + } + } + + error_check_good loenv_close [$loenv close] 0 + + puts "\tRep0$tnum.e: Run catastrophic recovery on logs-only client." + set loenv [berkdb_env -create -home $logsonlydir -txn -recover_fatal] + + puts "\tRep0$tnum.f: Verify logs-only client contents." + set lodb [eval {berkdb open} -env $loenv $oargs $omethod $dbname] + set loc [$lodb cursor] + + set cdb [eval {berkdb open} -env $clientenv $oargs $omethod $dbname] + set cc [$cdb cursor] + + # Make sure new master and recovered logs-only replica match. + for { set cdbt [$cc get -first] } \ + { [llength $cdbt] > 0 } { set cdbt [$cc get -next] } { + set lodbt [$loc get -next] + + error_check_good newmaster_replica_match $cdbt $lodbt + } + + # Reset new master cursor. + error_check_good cc_close [$cc close] 0 + set cc [$cdb cursor] + + for { set lodbt [$loc get -first] } \ + { [llength $lodbt] > 0 } { set lodbt [$loc get -next] } { + set cdbt [$cc get -next] + + error_check_good replica_newmaster_match $lodbt $cdbt + } + + error_check_good loc_close [$loc close] 0 + error_check_good lodb_close [$lodb close] 0 + error_check_good loenv_close [$loenv close] 0 + + error_check_good cc_close [$cc close] 0 + error_check_good cdb_close [$cdb close] 0 + error_check_good clientenv_close [$clientenv close] 0 + + close $did + + replclose $testdir/MSGQUEUEDIR +} diff --git a/db/test/rep005.tcl b/db/test/rep005.tcl new file mode 100644 index 000000000..2c3911dab --- /dev/null +++ b/db/test/rep005.tcl @@ -0,0 +1,225 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 2002 +# Sleepycat Software. All rights reserved. +# +# Id: rep005.tcl,v 11.3 2002/08/08 18:13:13 sue Exp +# +# TEST rep005 +# TEST Replication election test with error handling. +# TEST +# TEST Run a modified version of test001 in a replicated master environment; +# TEST hold an election among a group of clients to make sure they select +# TEST a proper master from amongst themselves, forcing errors at various +# TEST locations in the election path. + +proc rep005 { method { niter 10 } { tnum "05" } args } { + source ./include.tcl + + if { [is_record_based $method] == 1 } { + puts "Rep005: Skipping for method $method." + return + } + + set nclients 3 + env_cleanup $testdir + + set qdir $testdir/MSGQUEUEDIR + replsetup $qdir + + set masterdir $testdir/MASTERDIR + file mkdir $masterdir + + for { set i 0 } { $i < $nclients } { incr i } { + set clientdir($i) $testdir/CLIENTDIR.$i + file mkdir $clientdir($i) + } + + puts "Rep0$tnum: Replication election test with $nclients clients." + + # Open a master. + repladd 1 + set env_cmd(M) "berkdb_env -create -log_max 1000000 -home \ + $masterdir -txn -rep_master -rep_transport \[list 1 replsend\]" + set masterenv [eval $env_cmd(M)] + error_check_good master_env [is_valid_env $masterenv] TRUE + + # Open the clients. + for { set i 0 } { $i < $nclients } { incr i } { + set envid [expr $i + 2] + repladd $envid + set env_cmd($i) "berkdb_env -create -home $clientdir($i) \ + -txn -rep_client -rep_transport \[list $envid replsend\]" + set clientenv($i) [eval $env_cmd($i)] + error_check_good \ + client_env($i) [is_valid_env $clientenv($i)] TRUE + } + + # Run a modified test001 in the master. + puts "\tRep0$tnum.a: Running test001 in replicated env." + eval test001 $method $niter 0 $tnum 0 -env $masterenv $args + + # Loop, processing first the master's messages, then the client's, + # until both queues are empty. + while { 1 } { + set nproced 0 + + incr nproced [replprocessqueue $masterenv 1] + + for { set i 0 } { $i < $nclients } { incr i } { + set envid [expr $i + 2] + incr nproced [replprocessqueue $clientenv($i) $envid] + } + + if { $nproced == 0 } { + break + } + } + + # Verify the database in the client dir. + for { set i 0 } { $i < $nclients } { incr i } { + puts "\tRep0$tnum.b: Verifying contents of client database $i." + set testdir [get_home $masterenv] + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + open_and_dump_file test0$tnum.db $clientenv($i) $testdir/t1 \ + test001.check dump_file_direction "-first" "-next" + + if { [string compare [convert_method $method] -recno] != 0 } { + filesort $t1 $t3 + } + error_check_good diff_files($t2,$t3) [filecmp $t2 $t3] 0 + + verify_dir $clientdir($i) "\tRep0$tnum.c: " 0 0 1 + } + + # Make sure all the clients are synced up and ready to be good + # voting citizens. + error_check_good master_flush [$masterenv rep_flush] 0 + while { 1 } { + set nproced 0 + incr nproced [replprocessqueue $masterenv 1 0] + for { set i 0 } { $i < $nclients } { incr i } { + incr nproced [replprocessqueue $clientenv($i) \ + [expr $i + 2] 0] + } + + if { $nproced == 0 } { + break + } + } + + error_check_good masterenv_close [$masterenv close] 0 + + for { set i 0 } { $i < $nclients } { incr i } { + replclear [expr $i + 2] + } + # + # We set up the error list for each client. We know that the + # first client is the one calling the election, therefore, add + # the error location on sending the message (electsend) for that one. + set m "Rep0$tnum" + set count 0 + foreach c0 { electinit electsend electvote1 electwait1 electvote2 \ + electwait2 } { + foreach c1 { electinit electvote1 electwait1 electvote2 \ + electwait2 } { + foreach c2 { electinit electvote1 electwait1 \ + electvote2 electwait2 } { + set elist [list $c0 $c1 $c2] + rep005_elect env_cmd clientenv $qdir $m \ + $count $elist + incr count + } + } + } + + for { set i 0 } { $i < $nclients } { incr i } { + error_check_good clientenv_close($i) [$clientenv($i) close] 0 + } + + replclose $testdir/MSGQUEUEDIR +} + +proc rep005_elect { ecmd cenv qdir msg count elist } { + global elect_timeout + upvar $ecmd env_cmd + upvar $cenv clientenv + + set elect_timeout 1000000 + set nclients [llength $elist] + + for { set i 0 } { $i < $nclients } { incr i } { + set err_cmd($i) [lindex $elist $i] + } + puts "\t$msg.d.$count: Starting election with errors $elist" + set elect_pipe(0) [start_election $qdir $env_cmd(0) \ + [expr $nclients + 1] 20 $elect_timeout $err_cmd(0)] + + tclsleep 1 + + # Process messages, and verify that the client with the highest + # priority--client #1--wins. + set got_newmaster 0 + set tries 10 + while { 1 } { + set nproced 0 + set he 0 + set nm 0 + + for { set i 0 } { $i < $nclients } { incr i } { + set he 0 + set envid [expr $i + 2] +# puts "Processing queue for client $i" + incr nproced \ + [replprocessqueue $clientenv($i) $envid 0 he nm] + if { $he == 1 } { + # Client #1 has priority 100; everyone else + if { $i == 1 } { + set pri 100 + } else { + set pri 10 + } + # error_check_bad client(0)_in_elect $i 0 +# puts "Starting election on client $i" + set elect_pipe($i) [start_election $qdir \ + $env_cmd($i) [expr $nclients + 1] $pri \ + $elect_timeout $err_cmd($i)] + set got_hold_elect($i) 1 + } + if { $nm != 0 } { + error_check_good newmaster_is_master $nm \ + [expr 1 + 2] + set got_newmaster $nm + + # If this env is the new master, it needs to + # configure itself as such--this is a different + # env handle from the one that performed the + # election. + if { $nm == $envid } { + error_check_good make_master($i) \ + [$clientenv($i) rep_start -master] \ + 0 + } + } + } + + # We need to wait around to make doubly sure that the + # election has finished... + if { $nproced == 0 } { + incr tries -1 + if { $tries == 0 } { + break + } else { + tclsleep 1 + } + } + } + + # Verify that client #1 is actually the winner. + error_check_good "client 1 wins" $got_newmaster [expr 1 + 2] + + cleanup_elections + +} diff --git a/db/test/rpc004.tcl b/db/test/rpc004.tcl new file mode 100644 index 000000000..563b61e98 --- /dev/null +++ b/db/test/rpc004.tcl @@ -0,0 +1,76 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: rpc004.tcl,v 11.6 2002/07/16 20:53:03 bostic Exp +# +# TEST rpc004 +# TEST Test RPC server and security +proc rpc004 { } { + global __debug_on + global __debug_print + global errorInfo + global passwd + global rpc_svc + source ./include.tcl + + puts "Rpc004: RPC server + security" + cleanup $testdir NULL + if { [string compare $rpc_server "localhost"] == 0 } { + set dpid [exec $util_path/$rpc_svc \ + -h $rpc_testdir -P $passwd &] + } else { + set dpid [exec rsh $rpc_server $rpc_path/$rpc_svc \ + -h $rpc_testdir -P $passwd &] + } + puts "\tRpc004.a: Started server, pid $dpid" + + tclsleep 2 + remote_cleanup $rpc_server $rpc_testdir $testdir + puts "\tRpc004.b: Creating environment" + + set testfile "rpc004.db" + set testfile1 "rpc004a.db" + set home [file tail $rpc_testdir] + + set env [eval {berkdb_env -create -mode 0644 -home $home \ + -server $rpc_server -encryptaes $passwd -txn}] + error_check_good lock_env:open [is_valid_env $env] TRUE + + puts "\tRpc004.c: Opening a non-encrypted database" + # + # NOTE: the type of database doesn't matter, just use btree. + set db [eval {berkdb_open -auto_commit -create -btree -mode 0644} \ + -env $env $testfile] + error_check_good dbopen [is_valid_db $db] TRUE + + puts "\tRpc004.d: Opening an encrypted database" + set db1 [eval {berkdb_open -auto_commit -create -btree -mode 0644} \ + -env $env -encrypt $testfile1] + error_check_good dbopen [is_valid_db $db1] TRUE + + set txn [$env txn] + error_check_good txn [is_valid_txn $txn $env] TRUE + puts "\tRpc004.e: Put/get on both databases" + set key "key" + set data "data" + + set ret [$db put -txn $txn $key $data] + error_check_good db_put $ret 0 + set ret [$db get -txn $txn $key] + error_check_good db_get $ret [list [list $key $data]] + set ret [$db1 put -txn $txn $key $data] + error_check_good db1_put $ret 0 + set ret [$db1 get -txn $txn $key] + error_check_good db1_get $ret [list [list $key $data]] + + error_check_good txn_commit [$txn commit] 0 + error_check_good db_close [$db close] 0 + error_check_good db1_close [$db1 close] 0 + error_check_good env_close [$env close] 0 + + # Cleanup our environment because it's encrypted + remote_cleanup $rpc_server $rpc_testdir $testdir + tclkill $dpid +} diff --git a/db/test/rpc005.tcl b/db/test/rpc005.tcl new file mode 100644 index 000000000..da6226e16 --- /dev/null +++ b/db/test/rpc005.tcl @@ -0,0 +1,137 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: rpc005.tcl,v 11.4 2002/07/16 20:53:03 bostic Exp +# +# TEST rpc005 +# TEST Test RPC server handle ID sharing +proc rpc005 { } { + global __debug_on + global __debug_print + global errorInfo + global rpc_svc + source ./include.tcl + + puts "Rpc005: RPC server handle sharing" + if { [string compare $rpc_server "localhost"] == 0 } { + set dpid [exec $util_path/$rpc_svc \ + -h $rpc_testdir &] + } else { + set dpid [exec rsh $rpc_server $rpc_path/$rpc_svc \ + -h $rpc_testdir &] + } + puts "\tRpc005.a: Started server, pid $dpid" + + tclsleep 2 + remote_cleanup $rpc_server $rpc_testdir $testdir + puts "\tRpc005.b: Creating environment" + + set testfile "rpc005.db" + set testfile1 "rpc005a.db" + set subdb1 "subdb1" + set subdb2 "subdb2" + set home [file tail $rpc_testdir] + + set env [eval {berkdb_env -create -mode 0644 -home $home \ + -server $rpc_server -txn}] + error_check_good lock_env:open [is_valid_env $env] TRUE + + puts "\tRpc005.c: Compare identical and different configured envs" + set env_ident [eval {berkdb_env -home $home \ + -server $rpc_server -txn}] + error_check_good lock_env:open [is_valid_env $env_ident] TRUE + + set env_diff [eval {berkdb_env -home $home \ + -server $rpc_server -txn nosync}] + error_check_good lock_env:open [is_valid_env $env_diff] TRUE + + error_check_good ident:id [$env rpcid] [$env_ident rpcid] + error_check_bad diff:id [$env rpcid] [$env_diff rpcid] + + error_check_good envclose [$env_diff close] 0 + error_check_good envclose [$env_ident close] 0 + + puts "\tRpc005.d: Opening a database" + set db [eval {berkdb_open -auto_commit -create -btree -mode 0644} \ + -env $env $testfile] + error_check_good dbopen [is_valid_db $db] TRUE + + puts "\tRpc005.e: Compare identical and different configured dbs" + set db_ident [eval {berkdb_open -btree} -env $env $testfile] + error_check_good dbopen [is_valid_db $db_ident] TRUE + + set db_diff [eval {berkdb_open -btree} -env $env -rdonly $testfile] + error_check_good dbopen [is_valid_db $db_diff] TRUE + + set db_diff2 [eval {berkdb_open -btree} -env $env -rdonly $testfile] + error_check_good dbopen [is_valid_db $db_diff2] TRUE + + error_check_good ident:id [$db rpcid] [$db_ident rpcid] + error_check_bad diff:id [$db rpcid] [$db_diff rpcid] + error_check_good ident2:id [$db_diff rpcid] [$db_diff2 rpcid] + + error_check_good db_close [$db_ident close] 0 + error_check_good db_close [$db_diff close] 0 + error_check_good db_close [$db_diff2 close] 0 + error_check_good db_close [$db close] 0 + + puts "\tRpc005.f: Compare with a database and subdatabases" + set db [eval {berkdb_open -auto_commit -create -btree -mode 0644} \ + -env $env $testfile1 $subdb1] + error_check_good dbopen [is_valid_db $db] TRUE + set dbid [$db rpcid] + + set db2 [eval {berkdb_open -auto_commit -create -btree -mode 0644} \ + -env $env $testfile1 $subdb2] + error_check_good dbopen [is_valid_db $db2] TRUE + set db2id [$db2 rpcid] + error_check_bad 2subdb:id $dbid $db2id + + set db_ident [eval {berkdb_open -btree} -env $env $testfile1 $subdb1] + error_check_good dbopen [is_valid_db $db_ident] TRUE + set identid [$db_ident rpcid] + + set db_ident2 [eval {berkdb_open -btree} -env $env $testfile1 $subdb2] + error_check_good dbopen [is_valid_db $db_ident2] TRUE + set ident2id [$db_ident2 rpcid] + + set db_diff1 [eval {berkdb_open -btree} -env $env -rdonly \ + $testfile1 $subdb1] + error_check_good dbopen [is_valid_db $db_diff1] TRUE + set diff1id [$db_diff1 rpcid] + + set db_diff2 [eval {berkdb_open -btree} -env $env -rdonly \ + $testfile1 $subdb2] + error_check_good dbopen [is_valid_db $db_diff2] TRUE + set diff2id [$db_diff2 rpcid] + + set db_diff [eval {berkdb_open -unknown} -env $env -rdonly $testfile1] + error_check_good dbopen [is_valid_db $db_diff] TRUE + set diffid [$db_diff rpcid] + + set db_diff2a [eval {berkdb_open -btree} -env $env -rdonly \ + $testfile1 $subdb2] + error_check_good dbopen [is_valid_db $db_diff2a] TRUE + set diff2aid [$db_diff2a rpcid] + + error_check_good ident:id $dbid $identid + error_check_good ident2:id $db2id $ident2id + error_check_bad diff:id $dbid $diffid + error_check_bad diff2:id $db2id $diffid + error_check_bad diff3:id $diff2id $diffid + error_check_bad diff4:id $diff1id $diffid + error_check_good diff2a:id $diff2id $diff2aid + + error_check_good db_close [$db_ident close] 0 + error_check_good db_close [$db_ident2 close] 0 + error_check_good db_close [$db_diff close] 0 + error_check_good db_close [$db_diff1 close] 0 + error_check_good db_close [$db_diff2 close] 0 + error_check_good db_close [$db_diff2a close] 0 + error_check_good db_close [$db2 close] 0 + error_check_good db_close [$db close] 0 + error_check_good env_close [$env close] 0 + tclkill $dpid +} diff --git a/db/test/scr016/TestXAServlet.java b/db/test/scr016/TestXAServlet.java new file mode 100644 index 000000000..505fc84f0 --- /dev/null +++ b/db/test/scr016/TestXAServlet.java @@ -0,0 +1,313 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998, 1999, 2000 + * Sleepycat Software. All rights reserved. + * + * Id: TestXAServlet.java,v 1.1 2002/04/24 03:26:33 dda Exp + */ + +/* + * Simple test of XA, using WebLogic. + */ + +package com.sleepycat.test; + +import com.sleepycat.db.*; +import com.sleepycat.db.xa.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Hashtable; +import javax.servlet.*; +import javax.servlet.http.*; +import javax.transaction.*; +import javax.transaction.xa.*; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import weblogic.transaction.TxHelper; +import weblogic.transaction.TransactionManager; + +public class TestXAServlet extends HttpServlet +{ + public static final String ENV_HOME = "TESTXADIR"; + public static final String DEFAULT_URL = "t3://localhost:7001"; + public static String filesep = System.getProperty("file.separator"); + + private static TransactionManager tm; + private static DbXAResource xaresource; + private static boolean initialized = false; + + /** + * Utility to remove files recursively. + */ + public static void removeRecursive(File f) + { + if (f.isDirectory()) { + String[] sub = f.list(); + for (int i=0; i<sub.length; i++) + removeRecursive(new File(f.getName() + filesep + sub[i])); + } + f.delete(); + } + + /** + * Typically done only once, unless shutdown is invoked. This + * sets up directories, and removes any work files from previous + * runs. Also establishes a transaction manager that we'll use + * for various transactions. Each call opens/creates a new DB + * environment in our work directory. + */ + public static synchronized void startup() + { + if (initialized) + return; + + try { + File dir = new File(ENV_HOME); + removeRecursive(dir); + dir.mkdirs(); + + System.out.println("Getting context"); + InitialContext ic = getInitialContext(DEFAULT_URL); + System.out.println("Creating XAResource"); + xaresource = new DbXAResource(ENV_HOME, 77, 0); + System.out.println("Registering with transaction manager"); + tm = TxHelper.getTransactionManager(); + tm.registerStaticResource("DbXA", xaresource); + initialized = true; + } + catch (Exception e) { + System.err.println("Exception: " + e); + e.printStackTrace(); + } + initialized = true; + } + + /** + * Closes the XA resource manager. + */ + public static synchronized void shutdown(PrintWriter out) + throws XAException + { + if (!initialized) + return; + + out.println("Closing the resource."); + xaresource.close(0); + out.println("Shutdown complete."); + initialized = false; + } + + + /** + * Should be called once per chunk of major activity. + */ + public void initialize() + { + startup(); + } + + private static int count = 1; + private static boolean debugInited = false; + private Xid bogusXid; + + public static synchronized int incrCount() + { + return count++; + } + + public void debugSetup(PrintWriter out) + throws ServletException, IOException + { + try { + Db.load_db(); + } + catch (Exception e) { + out.println("got exception during load: " + e); + System.out.println("got exception during load: " + e); + } + out.println("The servlet has been restarted, and Berkeley DB is loaded"); + out.println("<p>If you're debugging, you should now start the debugger and set breakpoints."); + } + + public void doXATransaction(PrintWriter out, String key, String value, + String operation) + throws ServletException, IOException + { + try { + int counter = incrCount(); + if (key == null || key.equals("")) + key = "key" + counter; + if (value == null || value.equals("")) + value = "value" + counter; + + out.println("Adding (\"" + key + "\", \"" + value + "\")"); + + System.out.println("XA transaction begin"); + tm.begin(); + System.out.println("getting XA transaction"); + DbXAResource.DbAttach attach = DbXAResource.xa_attach(null, null); + DbTxn txn = attach.get_txn(); + DbEnv env = attach.get_env(); + Db db = new Db(env, 0); + db.open(txn, "my.db", null, Db.DB_BTREE, Db.DB_CREATE, 0644); + System.out.println("DB put " + key); + db.put(txn, + new Dbt(key.getBytes()), + new Dbt(value.getBytes()), + 0); + + if (operation.equals("rollback")) { + out.println("<p>ROLLBACK"); + System.out.println("XA transaction rollback"); + tm.rollback(); + System.out.println("XA rollback returned"); + + // The old db is no good after the rollback + // since the open was part of the transaction. + // Get another db for the cursor dump + // + db = new Db(env, 0); + db.open(null, "my.db", null, Db.DB_BTREE, Db.DB_CREATE, 0644); + } + else { + out.println("<p>COMMITTED"); + System.out.println("XA transaction commit"); + tm.commit(); + } + + // Show the current state of the database. + Dbc dbc = db.cursor(null, 0); + Dbt gotkey = new Dbt(); + Dbt gotdata = new Dbt(); + + out.println("<p>Current database values:"); + while (dbc.get(gotkey, gotdata, Db.DB_NEXT) == 0) { + out.println("<br> " + getDbtString(gotkey) + " : " + + getDbtString(gotdata)); + } + dbc.close(); + db.close(0); + } + catch (DbException dbe) { + System.err.println("Db Exception: " + dbe); + out.println(" *** Exception received: " + dbe); + dbe.printStackTrace(); + } + catch (FileNotFoundException fnfe) { + System.err.println("FileNotFoundException: " + fnfe); + out.println(" *** Exception received: " + fnfe); + fnfe.printStackTrace(); + } + // Includes SystemException, NotSupportedException, RollbackException + catch (Exception e) { + System.err.println("Exception: " + e); + out.println(" *** Exception received: " + e); + e.printStackTrace(); + } + } + + private static Xid getBogusXid() + throws XAException + { + return new DbXid(1, "BOGUS_gtrid".getBytes(), + "BOGUS_bqual".getBytes()); + } + + private static String getDbtString(Dbt dbt) + { + return new String(dbt.get_data(), 0, dbt.get_size()); + } + + /** + * doGet is called as a result of invoking the servlet. + */ + public void doGet(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException + { + try { + resp.setContentType("text/html"); + PrintWriter out = resp.getWriter(); + + String key = req.getParameter("key"); + String value = req.getParameter("value"); + String operation = req.getParameter("operation"); + + out.println("<HTML>"); + out.println("<HEAD>"); + out.println("<TITLE>Berkeley DB with XA</TITLE>"); + out.println("</HEAD><BODY>"); + out.println("<a href=\"TestXAServlet" + + "\">Database put and commit</a><br>"); + out.println("<a href=\"TestXAServlet?operation=rollback" + + "\">Database put and rollback</a><br>"); + out.println("<a href=\"TestXAServlet?operation=close" + + "\">Close the XA resource manager</a><br>"); + out.println("<a href=\"TestXAServlet?operation=forget" + + "\">Forget an operation (bypasses TM)</a><br>"); + out.println("<a href=\"TestXAServlet?operation=prepare" + + "\">Prepare an operation (bypasses TM)</a><br>"); + out.println("<br>"); + + if (!debugInited) { + // Don't initialize XA yet, give the user + // a chance to attach a debugger if necessary. + debugSetup(out); + debugInited = true; + } + else { + initialize(); + if (operation == null) + operation = "commit"; + + if (operation.equals("close")) { + shutdown(out); + } + else if (operation.equals("forget")) { + // A bogus test, we just make sure the API is callable. + out.println("<p>FORGET"); + System.out.println("XA forget bogus XID (bypass TM)"); + xaresource.forget(getBogusXid()); + } + else if (operation.equals("prepare")) { + // A bogus test, we just make sure the API is callable. + out.println("<p>PREPARE"); + System.out.println("XA prepare bogus XID (bypass TM)"); + xaresource.prepare(getBogusXid()); + } + else { + // commit, rollback, prepare, forget + doXATransaction(out, key, value, operation); + } + } + out.println("</BODY></HTML>"); + + System.out.println("Finished."); + } + // Includes SystemException, NotSupportedException, RollbackException + catch (Exception e) { + System.err.println("Exception: " + e); + e.printStackTrace(); + } + + } + + + /** + * From weblogic's sample code: + * samples/examples/jta/jmsjdbc/Client.java + */ + private static InitialContext getInitialContext(String url) + throws NamingException + { + Hashtable env = new Hashtable(); + env.put(Context.INITIAL_CONTEXT_FACTORY, + "weblogic.jndi.WLInitialContextFactory"); + env.put(Context.PROVIDER_URL, url); + return new InitialContext(env); + } + +} diff --git a/db/test/scr019/chk.include b/db/test/scr019/chk.include new file mode 100644 index 000000000..1f469677b --- /dev/null +++ b/db/test/scr019/chk.include @@ -0,0 +1,40 @@ +#!/bin/sh - +# +# Id: chk.include,v 1.3 2002/03/27 04:33:09 bostic Exp +# +# Check for inclusion of files already included in db_int.h. + +d=../.. + +# Test must be run from the top-level directory, not from a test directory. +[ -f $d/LICENSE ] || { + echo 'FAIL: cannot find source distribution directory.' + exit 1 +} + +t1=__1 +t2=__2 + +egrep -- '#include[ ]' $d/dbinc/db_int.in | +sed -e '/[ ]db\.h'/d \ + -e 's/^#include.//' \ + -e 's/[<>"]//g' \ + -e 's/[ ].*//' > $t1 + +for i in `cat $t1`; do + (cd $d && egrep "^#include[ ].*[<\"]$i[>\"]" */*.[ch]) +done | +sed -e '/^build/d' \ + -e '/^db_dump185/d' \ + -e '/^examples_c/d' \ + -e '/^libdb_java.*errno.h/d' \ + -e '/^libdb_java.*java_util.h/d' \ + -e '/^test_/d' \ + -e '/^mutex\/tm.c/d' > $t2 + +[ -s $t2 ] && { + echo 'FAIL: found extraneous includes in the source' + cat $t2 + exit 1 +} +exit 0 diff --git a/db/test/scr020/chk.inc b/db/test/scr020/chk.inc new file mode 100644 index 000000000..258bf3c4d --- /dev/null +++ b/db/test/scr020/chk.inc @@ -0,0 +1,43 @@ +#!/bin/sh - +# +# Id: chk.inc,v 1.1 2002/02/10 17:14:33 bostic Exp +# +# Check for inclusion of db_config.h after "const" or other includes. + +d=../.. + +# Test must be run from the top-level directory, not from a test directory. +[ -f $d/LICENSE ] || { + echo 'FAIL: cannot find source distribution directory.' + exit 1 +} + +t1=__1 +t2=__2 + +(cd $d && find . -name '*.[chys]' -o -name '*.cpp' | + xargs egrep -l '#include.*db_config.h') > $t1 + +:> $t2 +for i in `cat $t1`; do + egrep -w 'db_config.h|const' /dev/null $d/$i | head -1 >> $t2 +done + +if egrep const $t2 > /dev/null; then + echo 'FAIL: found const before include of db_config.h' + egrep const $t2 + exit 1 +fi + +:> $t2 +for i in `cat $t1`; do + egrep -w '#include' /dev/null $d/$i | head -1 >> $t2 +done + +if egrep -v db_config.h $t2 > /dev/null; then + echo 'FAIL: found includes before include of db_config.h' + egrep -v db_config.h $t2 + exit 1 +fi + +exit 0 diff --git a/db/test/scr021/chk.flags b/db/test/scr021/chk.flags new file mode 100644 index 000000000..a108b7b8e --- /dev/null +++ b/db/test/scr021/chk.flags @@ -0,0 +1,95 @@ +#!/bin/sh - +# +# Id: chk.flags,v 1.6 2002/08/08 15:29:11 bostic Exp +# +# Check flag name-spaces. + +d=../.. + +t1=__1 + +# Check for DB_ENV flags. +(grep 'F_ISSET([^ ]*dbenv,' $d/*/*.[chys]; + grep 'F_SET([^ ]*dbenv,' $d/*/*.[chys]; + grep 'F_CLR([^ ]*dbenv,' $d/*/*.[chys]) | + sed -e '/DB_ENV_/d' -e '/F_SET([^ ]*dbenv, db_env_reset)/d' > $t1 +[ -s $t1 ] && { + cat $t1 + exit 1 +} + +grep 'DB_ENV_' $d/*/*.c | +sed -e '/F_.*dbenv,/d' \ + -e '/DB_ENV_TEST_RECOVERY(.*DB_TEST_/d' \ + -e '/\/libdb_java\//d' > $t1 +[ -s $t1 ] && { + cat $t1 + exit 1 +} + +# Check for DB flags. +(grep 'F_ISSET([^ ]*dbp,' $d/*/*.[chys]; + grep 'F_SET([^ ]*dbp,' $d/*/*.[chys]; + grep 'F_CLR([^ ]*dbp,' $d/*/*.[chys]) | + sed -e '/DB_AM_/d' \ + -e '/db.c:.*F_SET.*F_ISSET(subdbp,/d' > $t1 +[ -s $t1 ] && { + cat $t1 + exit 1 +} + +grep 'DB_AM_' $d/*/*.c | +sed -e '/F_.*dbp/d' \ + -e '/"DB->open", dbp->flags, DB_AM_DUP,/d' \ + -e '/"DB_NODUPDATA" behavior for databases with/d' \ + -e '/If DB_AM_OPEN_CALLED is not set, then we/d' \ + -e '/This was checked in set_flags when DB_AM_ENCRYPT/d' \ + -e '/XA_ABORT, we can safely set DB_AM_RECOVER/d' \ + -e '/isdup = dbp->flags & DB_AM_DUP/d' \ + -e '/otherwise we simply do/d' \ + -e '/pginfo/d' \ + -e '/rep_record.c:.*F_SET(rep_db, DB_AM_CL_WRITER)/d' \ + -e '/setting DB_AM_RECOVER, we guarantee that we don/d' \ + -e '/:[ {]*DB_AM_/d' > $t1 +[ -s $t1 ] && { + cat $t1 + exit 1 +} + +# Check for DBC flags. +(grep 'F_ISSET([^ ]*dbc,' $d/*/*.[chys]; + grep 'F_SET([^ ]*dbc,' $d/*/*.[chys]; + grep 'F_CLR([^ ]*dbc,' $d/*/*.[chys]) | + sed -e '/DBC_/d' > $t1 +[ -s $t1 ] && { + cat $t1 + exit 1 +} + +grep 'DBC_' $d/*/*.c | +sed -e '/F_.*dbc/d' \ + -e '/DBC_INTERNAL/d' \ + -e '/Do the actual get. Set DBC_TRANSIENT/d' \ + -e '/If DBC_WRITEDUP is set, the cursor is an in/d' \ + -e '/The DBC_TRANSIENT flag indicates that we/d' \ + -e '/This function replaces the DBC_CONTINUE and DBC_KEYSET/d' \ + -e '/db_cam.c:.*F_CLR(opd, DBC_ACTIVE);/d' \ + -e '/{ DBC_/d' > $t1 +[ -s $t1 ] && { + cat $t1 + exit 1 +} + +# Check for bad use of macros. +egrep 'case .*F_SET\(|case .*F_CLR\(' $d/*/*.c > $t1 +egrep 'for .*F_SET\(|for .*F_CLR\(' $d/*/*.c >> $t1 +egrep 'if .*F_SET\(|if .*F_CLR\(' $d/*/*.c >> $t1 +egrep 'switch .*F_SET\(|switch .*F_CLR\(' $d/*/*.c >> $t1 +egrep 'while .*F_SET\(|while .*F_CLR\(' $d/*/*.c >> $t1 +[ -s $t1 ] && { + echo 'if statement followed by non-test macro' + cat $t1 + exit 1 +} + +exit 0 diff --git a/db/test/scr022/chk.rr b/db/test/scr022/chk.rr new file mode 100644 index 000000000..f73500afc --- /dev/null +++ b/db/test/scr022/chk.rr @@ -0,0 +1,22 @@ +#!/bin/sh - +# +# Id: chk.rr,v 1.1 2002/04/19 15:13:05 bostic Exp + +d=../.. + +t1=__1 + +# Check for DB_RUNRECOVERY being specified instead of a call to db_panic. +egrep DB_RUNRECOVERY $d/*/*.c | + sed -e '/common\/db_err.c:/d' \ + -e '/libdb_java\/java_util.c:/d' \ + -e '/db_dispatch.c:.*if (ret == DB_RUNRECOVERY/d' \ + -e '/txn.c:.* \* DB_RUNRECOVERY and we need to/d' \ + -e '/__db_panic(.*, DB_RUNRECOVERY)/d' > $t1 +[ -s $t1 ] && { + echo "DB_RUNRECOVERY used; should be a call to db_panic." + cat $t1 + exit 1 +} + +exit 0 diff --git a/db/test/sdb012.tcl b/db/test/sdb012.tcl new file mode 100644 index 000000000..ff60c1fae --- /dev/null +++ b/db/test/sdb012.tcl @@ -0,0 +1,428 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1999-2002 +# Sleepycat Software. All rights reserved. +# +# Id: sdb012.tcl,v 1.3 2002/08/08 15:38:10 bostic Exp +# +# TEST subdb012 +# TEST Test subdbs with locking and transactions +# TEST Tests creating and removing subdbs while handles +# TEST are open works correctly, and in the face of txns. +# +proc subdb012 { method args } { + source ./include.tcl + + set args [convert_args $method $args] + set omethod [convert_method $method] + + if { [is_queue $method] == 1 } { + puts "Subdb012: skipping for method $method" + return + } + + # If we are using an env, then skip this test. It needs its own. + set eindex [lsearch -exact $args "-env"] + if { $eindex != -1 } { + incr eindex + set env [lindex $args $eindex] + puts "Subdb012 skipping for env $env" + return + } + set encargs "" + set largs [split_encargs $args encargs] + + puts "Subdb012: $method ($largs $encargs) subdb txn/locking tests" + + # + # sdb012_body takes a txn list containing 4 elements. + # {txn command for first subdb + # txn command for second subdb + # txn command for first subdb removal + # txn command for second subdb removal} + # + # The allowed commands are 'none' 'one', 'auto', 'abort', 'commit'. + # 'none' is a special case meaning run without a txn. In the + # case where all 4 items are 'none', we run in a lock-only env. + # 'one' is a special case meaning we create the subdbs together + # in one single transaction. It is indicated as the value for t1, + # and the value in t2 indicates if that single txn should be + # aborted or committed. It is not used and has no meaning + # in the removal case. 'auto' means use the -auto_commit flag + # to the operation, and 'abort' and 'commit' do the obvious. + # + # First test locking w/o txns. If any in tlist are 'none', + # all must be none. + # + # Now run through the txn-based operations + set count 0 + set sdb "Subdb012." + set teststr "abcdefghijklmnopqrstuvwxyz" + set testlet [split $teststr {}] + foreach t1 { none one abort auto commit } { + foreach t2 { none abort auto commit } { + if { $t1 == "one" } { + if { $t2 == "none" || $t2 == "auto"} { + continue + } + } + set tlet [lindex $testlet $count] + foreach r1 { none abort auto commit } { + foreach r2 { none abort auto commit } { + set tlist [list $t1 $t2 $r1 $r2] + sdb012_body $testdir $omethod $largs \ + $encargs $sdb$tlet $tlist + } + } + incr count + } + } + +} + +proc s012 { method args } { + source ./include.tcl + + set omethod [convert_method $method] + + set encargs "" + set largs "" + + puts "Subdb012: $method ($largs $encargs) subdb txn/locking tests" + + set sdb "Subdb012." + set tlet X + set tlist $args + error_check_good tlist [llength $tlist] 4 + sdb012_body $testdir $omethod $largs $encargs $sdb$tlet $tlist +} + +# +# This proc checks the tlist values and returns the flags +# that should be used when opening the env. If we are running +# with no txns, then just -lock, otherwise -txn. +# +proc sdb012_subsys { tlist } { + set t1 [lindex $tlist 0] + # + # If we have no txns, all elements of the list should be none. + # In that case we only run with locking turned on. + # Otherwise, we use the full txn subsystems. + # + set allnone {none none none none} + if { $allnone == $tlist } { + set subsys "-lock" + } else { + set subsys "-txn" + } + return $subsys +} + +# +# This proc parses the tlist and returns a list of 4 items that +# should be used in operations. I.e. it will begin the txns as +# needed, or return a -auto_commit flag, etc. +# +proc sdb012_tflags { env tlist } { + set ret "" + set t1 "" + foreach t $tlist { + switch $t { + one { + set t1 [$env txn] + error_check_good txnbegin [is_valid_txn $t1 $env] TRUE + lappend ret "-txn $t1" + lappend ret "-txn $t1" + } + auto { + lappend ret "-auto_commit" + } + abort - + commit { + # + # If the previous command was a "one", skip over + # this commit/abort. Otherwise start a new txn + # for the removal case. + # + if { $t1 == "" } { + set txn [$env txn] + error_check_good txnbegin [is_valid_txn $txn \ + $env] TRUE + lappend ret "-txn $txn" + } else { + set t1 "" + } + } + none { + lappend ret "" + } + default { + error "Txn command $t not implemented" + } + } + } + return $ret +} + +# +# This proc parses the tlist and returns a list of 4 items that +# should be used in the txn conclusion operations. I.e. it will +# give "" if using auto_commit (i.e. no final txn op), or a single +# abort/commit if both subdb's are in one txn. +# +proc sdb012_top { tflags tlist } { + set ret "" + set t1 "" + # + # We know both lists have 4 items. Iterate over them + # using multiple value lists so we know which txn goes + # with each op. + # + # The tflags list is needed to extract the txn command + # out for the operation. The tlist list is needed to + # determine what operation we are doing. + # + foreach t $tlist tf $tflags { + switch $t { + one { + set t1 [lindex $tf 1] + } + auto { + lappend ret "sdb012_nop" + } + abort - + commit { + # + # If the previous command was a "one" (i.e. t1 + # is set), append a correct command and then + # an empty one. + # + if { $t1 == "" } { + set txn [lindex $tf 1] + set top "$txn $t" + lappend ret $top + } else { + set top "$t1 $t" + lappend ret "sdb012_nop" + lappend ret $top + set t1 "" + } + } + none { + lappend ret "sdb012_nop" + } + } + } + return $ret +} + +proc sdb012_nop { } { + return 0 +} + +proc sdb012_isabort { tlist item } { + set i [lindex $tlist $item] + if { $i == "one" } { + set i [lindex $tlist [expr $item + 1]] + } + if { $i == "abort" } { + return 1 + } else { + return 0 + } +} + +proc sdb012_body { testdir omethod largs encargs msg tlist } { + + puts "\t$msg: $tlist" + set testfile subdb012.db + set subdb1 sub1 + set subdb2 sub2 + + set subsys [sdb012_subsys $tlist] + env_cleanup $testdir + set env [eval {berkdb_env -create -home} $testdir $subsys $encargs] + error_check_good dbenv [is_valid_env $env] TRUE + error_check_good test_lock [$env test abort subdb_lock] 0 + + # + # Convert from our tlist txn commands into real flags we + # will pass to commands. Use the multiple values feature + # of foreach to do this efficiently. + # + set tflags [sdb012_tflags $env $tlist] + foreach {txn1 txn2 rem1 rem2} $tflags {break} + foreach {top1 top2 rop1 rop2} [sdb012_top $tflags $tlist] {break} + +# puts "txn1 $txn1, txn2 $txn2, rem1 $rem1, rem2 $rem2" +# puts "top1 $top1, top2 $top2, rop1 $rop1, rop2 $rop2" + puts "\t$msg.0: Create sub databases in env with $subsys" + set s1 [eval {berkdb_open -env $env -create -mode 0644} \ + $largs $txn1 {$omethod $testfile $subdb1}] + error_check_good dbopen [is_valid_db $s1] TRUE + + set ret [eval $top1] + error_check_good t1_end $ret 0 + + set s2 [eval {berkdb_open -env $env -create -mode 0644} \ + $largs $txn2 {$omethod $testfile $subdb2}] + error_check_good dbopen [is_valid_db $s2] TRUE + + puts "\t$msg.1: Subdbs are open; resolve txns if necessary" + set ret [eval $top2] + error_check_good t2_end $ret 0 + + set t1_isabort [sdb012_isabort $tlist 0] + set t2_isabort [sdb012_isabort $tlist 1] + set r1_isabort [sdb012_isabort $tlist 2] + set r2_isabort [sdb012_isabort $tlist 3] + +# puts "t1_isabort $t1_isabort, t2_isabort $t2_isabort, r1_isabort $r1_isabort, r2_isabort $r2_isabort" + + puts "\t$msg.2: Subdbs are open; verify removal failures" + # Verify removes of subdbs with open subdb's fail + # + # We should fail no matter what. If we aborted, then the + # subdb should not exist. If we didn't abort, we should fail + # with DB_LOCK_NOTGRANTED. + # + # XXX - Do we need -auto_commit for all these failing ones? + set r [ catch {berkdb dbremove -env $env $testfile $subdb1} result ] + error_check_bad dbremove1_open $r 0 + if { $t1_isabort } { + error_check_good dbremove1_open_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbremove1_open [is_substr \ + $result DB_LOCK_NOTGRANTED] 1 + } + + set r [ catch {berkdb dbremove -env $env $testfile $subdb2} result ] + error_check_bad dbremove2_open $r 0 + if { $t2_isabort } { + error_check_good dbremove2_open_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbremove2_open [is_substr \ + $result DB_LOCK_NOTGRANTED] 1 + } + + # Verify file remove fails + set r [catch {berkdb dbremove -env $env $testfile} result] + error_check_bad dbremovef_open $r 0 + + # + # If both aborted, there should be no file?? + # + if { $t1_isabort && $t2_isabort } { + error_check_good dbremovef_open_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbremovef_open [is_substr \ + $result DB_LOCK_NOTGRANTED] 1 + } + + puts "\t$msg.3: Close subdb2; verify removals" + error_check_good close_s2 [$s2 close] 0 + set r [ catch {eval {berkdb dbremove -env} \ + $env $rem2 $testfile $subdb2} result ] + if { $t2_isabort } { + error_check_bad dbrem2_ab $r 0 + error_check_good dbrem2_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbrem2 $result 0 + } + # Resolve subdb2 removal txn + set r [eval $rop2] + error_check_good rop2 $r 0 + + set r [ catch {berkdb dbremove -env $env $testfile $subdb1} result ] + error_check_bad dbremove1.2_open $r 0 + if { $t1_isabort } { + error_check_good dbremove1.2_open_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbremove1.2_open [is_substr \ + $result DB_LOCK_NOTGRANTED] 1 + } + + # There are three cases here: + # 1. if both t1 and t2 aborted, the file shouldn't exist + # 2. if only t1 aborted, the file still exists and nothing is open + # 3. if neither aborted a remove should fail because the first + # subdb is still open + # In case 2, don't try the remove, because it should succeed + # and we won't be able to test anything else. + if { !$t1_isabort || $t2_isabort } { + set r [catch {berkdb dbremove -env $env $testfile} result] + if { $t1_isabort && $t2_isabort } { + error_check_bad dbremovef.2_open $r 0 + error_check_good dbremove.2_open_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_bad dbremovef.2_open $r 0 + error_check_good dbremove.2_open [is_substr \ + $result DB_LOCK_NOTGRANTED] 1 + } + } + + puts "\t$msg.4: Close subdb1; verify removals" + error_check_good close_s1 [$s1 close] 0 + set r [ catch {eval {berkdb dbremove -env} \ + $env $rem1 $testfile $subdb1} result ] + if { $t1_isabort } { + error_check_bad dbremove1_ab $r 0 + error_check_good dbremove1_ab [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbremove1 $result 0 + } + # Resolve subdb1 removal txn + set r [eval $rop1] + error_check_good rop1 $r 0 + + + # Verify removal of subdb2. All DB handles are closed now. + # So we have two scenarios: + # 1. The removal of subdb2 above was successful and subdb2 + # doesn't exist and we should fail that way. + # 2. The removal of subdb2 above was aborted, and this + # removal should succeed. + # + set r [ catch {berkdb dbremove -env $env $testfile $subdb2} result ] + if { $r2_isabort && !$t2_isabort } { + error_check_good dbremove2.1_ab $result 0 + } else { + error_check_bad dbremove2.1 $r 0 + error_check_good dbremove2.1 [is_substr \ + $result "no such file"] 1 + } + + # Verify removal of subdb1. All DB handles are closed now. + # So we have two scenarios: + # 1. The removal of subdb1 above was successful and subdb1 + # doesn't exist and we should fail that way. + # 2. The removal of subdb1 above was aborted, and this + # removal should succeed. + # + set r [ catch {berkdb dbremove -env $env $testfile $subdb1} result ] + if { $r1_isabort && !$t1_isabort } { + error_check_good dbremove1.1 $result 0 + } else { + error_check_bad dbremove_open $r 0 + error_check_good dbremove.1 [is_substr \ + $result "no such file"] 1 + } + + puts "\t$msg.5: All closed; remove file" + set r [catch {berkdb dbremove -env $env $testfile} result] + if { $t1_isabort && $t2_isabort } { + error_check_bad dbremove_final_ab $r 0 + error_check_good dbremove_file_abstr [is_substr \ + $result "no such file"] 1 + } else { + error_check_good dbremove_final $r 0 + } + error_check_good envclose [$env close] 0 +} diff --git a/db/test/sec001.tcl b/db/test/sec001.tcl new file mode 100644 index 000000000..f6f0ddf33 --- /dev/null +++ b/db/test/sec001.tcl @@ -0,0 +1,205 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1999-2001 +# Sleepycat Software. All rights reserved. +# +# Id: sec001.tcl,v 11.7 2002/05/31 16:19:30 sue Exp +# +# TEST sec001 +# TEST Test of security interface +proc sec001 { } { + global errorInfo + global errorCode + + source ./include.tcl + + set testfile1 env1.db + set testfile2 $testdir/env2.db + set subdb1 sub1 + set subdb2 sub2 + + puts "Sec001: Test of basic encryption interface." + env_cleanup $testdir + + set passwd1 "passwd1" + set passwd1_bad "passwd1_bad" + set passwd2 "passwd2" + set key "key" + set data "data" + + # + # This first group tests bad create scenarios and also + # tests attempting to use encryption after creating a + # non-encrypted env/db to begin with. + # + set nopass "" + puts "\tSec001.a.1: Create db with encryption." + set db [berkdb_open -create -encryptaes $passwd1 -btree $testfile2] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + puts "\tSec001.a.2: Open db without encryption." + set stat [catch {berkdb_open_noerr $testfile2} ret] + error_check_good db:nocrypto $stat 1 + error_check_good db:fail [is_substr $ret "no encryption key"] 1 + + set ret [berkdb dbremove -encryptaes $passwd1 $testfile2] + + puts "\tSec001.b.1: Create db without encryption or checksum." + set db [berkdb_open -create -btree $testfile2] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + puts "\tSec001.b.2: Open db with encryption." + set stat [catch {berkdb_open_noerr -encryptaes $passwd1 $testfile2} ret] + error_check_good db:nocrypto $stat 1 + error_check_good db:fail [is_substr $ret "supplied encryption key"] 1 + + set ret [berkdb dbremove $testfile2] + + puts "\tSec001.c.1: Create db with checksum." + set db [berkdb_open -create -chksum -btree $testfile2] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + puts "\tSec001.c.2: Open db with encryption." + set stat [catch {berkdb_open_noerr -encryptaes $passwd1 $testfile2} ret] + error_check_good db:nocrypto $stat 1 + error_check_good db:fail [is_substr $ret "supplied encryption key"] 1 + + set ret [berkdb dbremove $testfile2] + + puts "\tSec001.d.1: Create subdb with encryption." + set db [berkdb_open -create -encryptaes $passwd1 -btree \ + $testfile2 $subdb1] + error_check_good subdb [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + puts "\tSec001.d.2: Create 2nd subdb without encryption." + set stat [catch {berkdb_open_noerr -create -btree \ + $testfile2 $subdb2} ret] + error_check_good subdb:nocrypto $stat 1 + error_check_good subdb:fail [is_substr $ret "no encryption key"] 1 + + set ret [berkdb dbremove -encryptaes $passwd1 $testfile2] + + puts "\tSec001.e.1: Create subdb without encryption or checksum." + set db [berkdb_open -create -btree $testfile2 $subdb1] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + puts "\tSec001.e.2: Create 2nd subdb with encryption." + set stat [catch {berkdb_open_noerr -create -btree -encryptaes $passwd1 \ + $testfile2 $subdb2} ret] + error_check_good subdb:nocrypto $stat 1 + error_check_good subdb:fail [is_substr $ret "supplied encryption key"] 1 + + env_cleanup $testdir + + puts "\tSec001.f.1: Open env with encryption, empty passwd." + set stat [catch {berkdb_env_noerr -create -home $testdir \ + -encryptaes $nopass} ret] + error_check_good env:nopass $stat 1 + error_check_good env:fail [is_substr $ret "Empty password"] 1 + + puts "\tSec001.f.2: Create without encryption algorithm (DB_ENCRYPT_ANY)." + set stat [catch {berkdb_env_noerr -create -home $testdir \ + -encryptany $passwd1} ret] + error_check_good env:any $stat 1 + error_check_good env:fail [is_substr $ret "algorithm not supplied"] 1 + + puts "\tSec001.f.3: Create without encryption." + set env [berkdb_env -create -home $testdir] + error_check_good env [is_valid_env $env] TRUE + + puts "\tSec001.f.4: Open again with encryption." + set stat [catch {berkdb_env_noerr -home $testdir \ + -encryptaes $passwd1} ret] + error_check_good env:unencrypted $stat 1 + error_check_good env:fail [is_substr $ret \ + "Joining non-encrypted environment"] 1 + + error_check_good envclose [$env close] 0 + + env_cleanup $testdir + + # + # This second group tests creating and opening a secure env. + # We test that others can join successfully, and that other's with + # bad/no passwords cannot. Also test that we cannot use the + # db->set_encrypt method when we've already got a secure dbenv. + # + puts "\tSec001.g.1: Open with encryption." + set env [berkdb_env_noerr -create -home $testdir -encryptaes $passwd1] + error_check_good env [is_valid_env $env] TRUE + + puts "\tSec001.g.2: Open again with encryption - same passwd." + set env1 [berkdb_env -home $testdir -encryptaes $passwd1] + error_check_good env [is_valid_env $env1] TRUE + error_check_good envclose [$env1 close] 0 + + puts "\tSec001.g.3: Open again with any encryption (DB_ENCRYPT_ANY)." + set env1 [berkdb_env -home $testdir -encryptany $passwd1] + error_check_good env [is_valid_env $env1] TRUE + error_check_good envclose [$env1 close] 0 + + puts "\tSec001.g.4: Open with encryption - different length passwd." + set stat [catch {berkdb_env_noerr -home $testdir \ + -encryptaes $passwd1_bad} ret] + error_check_good env:$passwd1_bad $stat 1 + error_check_good env:fail [is_substr $ret "Invalid password"] 1 + + puts "\tSec001.g.5: Open with encryption - different passwd." + set stat [catch {berkdb_env_noerr -home $testdir \ + -encryptaes $passwd2} ret] + error_check_good env:$passwd2 $stat 1 + error_check_good env:fail [is_substr $ret "Invalid password"] 1 + + puts "\tSec001.g.6: Open env without encryption." + set stat [catch {berkdb_env_noerr -home $testdir} ret] + error_check_good env:$passwd2 $stat 1 + error_check_good env:fail [is_substr $ret "Encrypted environment"] 1 + + puts "\tSec001.g.7: Open database with encryption in env" + set stat [catch {berkdb_open_noerr -env $env -btree -create \ + -encryptaes $passwd2 $testfile1} ret] + error_check_good db:$passwd2 $stat 1 + error_check_good env:fail [is_substr $ret "method not permitted"] 1 + + puts "\tSec001.g.8: Close creating env" + error_check_good envclose [$env close] 0 + + # + # This third group tests opening the env after the original env + # handle is closed. Just to make sure we can reopen it in + # the right fashion even if no handles are currently open. + # + puts "\tSec001.h.1: Reopen without encryption." + set stat [catch {berkdb_env_noerr -home $testdir} ret] + error_check_good env:noencrypt $stat 1 + error_check_good env:fail [is_substr $ret "Encrypted environment"] 1 + + puts "\tSec001.h.2: Reopen with bad passwd." + set stat [catch {berkdb_env_noerr -home $testdir -encryptaes \ + $passwd1_bad} ret] + error_check_good env:$passwd1_bad $stat 1 + error_check_good env:fail [is_substr $ret "Invalid password"] 1 + + puts "\tSec001.h.3: Reopen with encryption." + set env [berkdb_env -create -home $testdir -encryptaes $passwd1] + error_check_good env [is_valid_env $env] TRUE + + puts "\tSec001.h.4: 2nd Reopen with encryption." + set env1 [berkdb_env -home $testdir -encryptaes $passwd1] + error_check_good env [is_valid_env $env1] TRUE + + error_check_good envclose [$env1 close] 0 + error_check_good envclose [$env close] 0 + + puts "\tSec001 complete." +} diff --git a/db/test/sec002.tcl b/db/test/sec002.tcl new file mode 100644 index 000000000..0b0e882d2 --- /dev/null +++ b/db/test/sec002.tcl @@ -0,0 +1,143 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1999-2001 +# Sleepycat Software. All rights reserved. +# +# Id: sec002.tcl,v 11.3 2002/04/24 19:04:59 bostic Exp +# +# TEST sec002 +# TEST Test of security interface and catching errors in the +# TEST face of attackers overwriting parts of existing files. +proc sec002 { } { + global errorInfo + global errorCode + + source ./include.tcl + + set testfile1 $testdir/sec002-1.db + set testfile2 $testdir/sec002-2.db + set testfile3 $testdir/sec002-3.db + set testfile4 $testdir/sec002-4.db + + puts "Sec002: Test of basic encryption interface." + env_cleanup $testdir + + set passwd1 "passwd1" + set passwd2 "passwd2" + set key "key" + set data "data" + set pagesize 1024 + + # + # Set up 4 databases, two encrypted, but with different passwords + # and one unencrypt, but with checksumming turned on and one + # unencrypted and no checksumming. Place the exact same data + # in each one. + # + puts "\tSec002.a: Setup databases" + set db_cmd "-create -pagesize $pagesize -btree " + set db [eval {berkdb_open} -encryptaes $passwd1 $db_cmd $testfile1] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + set db [eval {berkdb_open} -encryptaes $passwd2 $db_cmd $testfile2] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + set db [eval {berkdb_open} -chksum $db_cmd $testfile3] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + set db [eval {berkdb_open} $db_cmd $testfile4] + error_check_good db [is_valid_db $db] TRUE + error_check_good dbput [$db put $key $data] 0 + error_check_good dbclose [$db close] 0 + + # + # First just touch some bits in the file. We know that in btree + # meta pages, bytes 92-459 are unused. Scribble on them in both + # an encrypted, and both unencrypted files. We should get + # a checksum error for the encrypted, and checksummed files. + # We should get no error for the normal file. + # + set fidlist {} + set fid [open $testfile1 r+] + lappend fidlist $fid + set fid [open $testfile3 r+] + lappend fidlist $fid + set fid [open $testfile4 r+] + lappend fidlist $fid + + puts "\tSec002.b: Overwrite unused space in meta-page" + foreach f $fidlist { + fconfigure $f -translation binary + seek $f 100 start + set byte [read $f 1] + binary scan $byte c val + set newval [expr ~$val] + set newbyte [binary format c $newval] + seek $f 100 start + puts -nonewline $f $newbyte + close $f + } + puts "\tSec002.c: Reopen modified databases" + set stat [catch {berkdb_open_noerr -encryptaes $passwd1 $testfile1} ret] + error_check_good db:$testfile1 $stat 1 + error_check_good db:$testfile1:fail \ + [is_substr $ret "metadata page checksum error"] 1 + + set stat [catch {berkdb_open_noerr -chksum $testfile3} ret] + error_check_good db:$testfile3 $stat 1 + error_check_good db:$testfile3:fail \ + [is_substr $ret "metadata page checksum error"] 1 + + set stat [catch {berkdb_open_noerr $testfile4} db] + error_check_good db:$testfile4 $stat 0 + error_check_good dbclose [$db close] 0 + + puts "\tSec002.d: Replace root page in encrypted w/ encrypted" + set fid1 [open $testfile1 r+] + set fid2 [open $testfile2 r+] + seek $fid1 $pagesize start + seek $fid2 $pagesize start + set root1 [read $fid1 $pagesize] + close $fid1 + puts -nonewline $fid2 $root1 + close $fid2 + + set db [berkdb_open_noerr -encryptaes $passwd2 $testfile2] + error_check_good db [is_valid_db $db] TRUE + set stat [catch {$db get $key} ret] + error_check_good dbget $stat 1 + error_check_good db:$testfile2:fail \ + [is_substr $ret "checksum error: catastrophic recovery required"] 1 + set stat [catch {$db close} ret] + error_check_good dbclose $stat 1 + error_check_good db:$testfile2:fail [is_substr $ret "DB_RUNRECOVERY"] 1 + + puts "\tSec002.e: Replace root page in encrypted w/ unencrypted" + set fid2 [open $testfile2 r+] + set fid4 [open $testfile4 r+] + seek $fid2 $pagesize start + seek $fid4 $pagesize start + set root4 [read $fid4 $pagesize] + close $fid4 + puts -nonewline $fid2 $root4 + close $fid2 + + set db [berkdb_open_noerr -encryptaes $passwd2 $testfile2] + error_check_good db [is_valid_db $db] TRUE + set stat [catch {$db get $key} ret] + error_check_good dbget $stat 1 + error_check_good db:$testfile2:fail \ + [is_substr $ret "checksum error: catastrophic recovery required"] 1 + set stat [catch {$db close} ret] + error_check_good dbclose $stat 1 + error_check_good db:$testfile2:fail [is_substr $ret "DB_RUNRECOVERY"] 1 + + cleanup $testdir NULL 1 + puts "\tSec002 complete." +} diff --git a/db/test/si006.tcl b/db/test/si006.tcl new file mode 100644 index 000000000..276d31f24 --- /dev/null +++ b/db/test/si006.tcl @@ -0,0 +1,129 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 2001-2002 +# Sleepycat Software. All rights reserved. +# +# Id: si006.tcl,v 1.2 2002/05/15 17:18:03 sandstro Exp +# +# TEST sindex006 +# TEST Basic secondary index put/delete test with transactions +proc sindex006 { methods {nentries 200} {tnum 6} args } { + source ./include.tcl + global dict nsecondaries + + # Primary method/args. + set pmethod [lindex $methods 0] + set pargs [convert_args $pmethod $args] + set pomethod [convert_method $pmethod] + + # Method/args for all the secondaries. If only one method + # was specified, assume the same method and a standard N + # secondaries. + set methods [lrange $methods 1 end] + if { [llength $methods] == 0 } { + for { set i 0 } { $i < $nsecondaries } { incr i } { + lappend methods $pmethod + } + } + + set argses [convert_argses $methods $args] + set omethods [convert_methods $methods] + + puts "Sindex00$tnum ($pmethod/$methods) $nentries equal key/data pairs" + puts " with transactions" + env_cleanup $testdir + + set pname "primary00$tnum.db" + set snamebase "secondary00$tnum" + + # Open an environment + # XXX if one is not supplied! + set env [berkdb_env -create -home $testdir -txn] + error_check_good env_open [is_valid_env $env] TRUE + + # Open the primary. + set pdb [eval {berkdb_open -create -auto_commit -env} $env $pomethod \ + $pargs $pname] + error_check_good primary_open [is_valid_db $pdb] TRUE + + # Open and associate the secondaries + set sdbs {} + for { set i 0 } { $i < [llength $omethods] } { incr i } { + set sdb [eval {berkdb_open -create -auto_commit -env} $env \ + [lindex $omethods $i] [lindex $argses $i] $snamebase.$i.db] + error_check_good second_open($i) [is_valid_db $sdb] TRUE + + error_check_good db_associate($i) \ + [$pdb associate -auto_commit [callback_n $i] $sdb] 0 + lappend sdbs $sdb + } + + puts "\tSindex00$tnum.a: Put loop" + set did [open $dict] + for { set n 0 } { [gets $did str] != -1 && $n < $nentries } { incr n } { + if { [is_record_based $pmethod] == 1 } { + set key [expr $n + 1] + set datum $str + } else { + set key $str + gets $did datum + } + set keys($n) $key + set data($n) [pad_data $pmethod $datum] + + set txn [$env txn] + set ret [eval {$pdb put} -txn $txn \ + {$key [chop_data $pmethod $datum]}] + error_check_good put($n) $ret 0 + error_check_good txn_commit($n) [$txn commit] 0 + } + close $did + check_secondaries $pdb $sdbs $nentries keys data "Sindex00$tnum.a" + + puts "\tSindex00$tnum.b: Put/overwrite loop" + for { set n 0 } { $n < $nentries } { incr n } { + set newd $data($n).$keys($n) + + set txn [$env txn] + set ret [eval {$pdb put} -txn $txn \ + {$keys($n) [chop_data $pmethod $newd]}] + error_check_good put_overwrite($n) $ret 0 + set data($n) [pad_data $pmethod $newd] + error_check_good txn_commit($n) [$txn commit] 0 + } + check_secondaries $pdb $sdbs $nentries keys data "Sindex00$tnum.b" + + # Delete the second half of the entries through the primary. + # We do the second half so we can just pass keys(0 ... n/2) + # to check_secondaries. + set half [expr $nentries / 2] + puts "\tSindex00$tnum.c: Primary delete loop: deleting $half entries" + for { set n $half } { $n < $nentries } { incr n } { + set txn [$env txn] + set ret [$pdb del -txn $txn $keys($n)] + error_check_good pdel($n) $ret 0 + error_check_good txn_commit($n) [$txn commit] 0 + } + check_secondaries $pdb $sdbs $half keys data "Sindex00$tnum.c" + + # Delete half of what's left, through the first secondary. + set quar [expr $half / 2] + puts "\tSindex00$tnum.d: Secondary delete loop: deleting $quar entries" + set sdb [lindex $sdbs 0] + set callback [callback_n 0] + for { set n $quar } { $n < $half } { incr n } { + set skey [$callback $keys($n) [pad_data $pmethod $data($n)]] + set txn [$env txn] + set ret [$sdb del -txn $txn $skey] + error_check_good sdel($n) $ret 0 + error_check_good txn_commit($n) [$txn commit] 0 + } + check_secondaries $pdb $sdbs $quar keys data "Sindex00$tnum.d" + + puts "\tSindex00$tnum.e: Closing/disassociating primary first" + error_check_good primary_close [$pdb close] 0 + foreach sdb $sdbs { + error_check_good secondary_close [$sdb close] 0 + } + error_check_good env_close [$env close] 0 +} diff --git a/db/test/test089.tcl b/db/test/test089.tcl new file mode 100644 index 000000000..776772050 --- /dev/null +++ b/db/test/test089.tcl @@ -0,0 +1,180 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: test089.tcl,v 11.2 2002/08/08 15:38:12 bostic Exp +# +# TEST test089 +# TEST Concurrent Data Store test (CDB) +# TEST +# TEST Enhanced CDB testing to test off-page dups, cursor dups and +# TEST cursor operations like c_del then c_get. +proc test089 { method {nentries 1000} args } { + global datastr + global encrypt + source ./include.tcl + + # + # If we are using an env, then skip this test. It needs its own. + set eindex [lsearch -exact $args "-env"] + if { $eindex != -1 } { + incr eindex + set env [lindex $args $eindex] + puts "Test089 skipping for env $env" + return + } + set encargs "" + set args [convert_args $method $args] + set oargs [split_encargs $args encargs] + set omethod [convert_method $method] + + puts "Test089: ($oargs) $method CDB Test cursor/dup operations" + + # Process arguments + # Create the database and open the dictionary + set testfile test089.db + set testfile1 test089a.db + + env_cleanup $testdir + + set env [eval {berkdb_env -create -cdb} $encargs -home $testdir] + error_check_good dbenv [is_valid_env $env] TRUE + + set db [eval {berkdb_open -env $env -create \ + -mode 0644 $omethod} $oargs {$testfile}] + error_check_good dbopen [is_valid_db $db] TRUE + + set db1 [eval {berkdb_open -env $env -create \ + -mode 0644 $omethod} $oargs {$testfile1}] + error_check_good dbopen [is_valid_db $db1] TRUE + + set pflags "" + set gflags "" + set txn "" + set count 0 + + # Here is the loop where we put each key/data pair + puts "\tTest089.a: put loop" + set did [open $dict] + while { [gets $did str] != -1 && $count < $nentries } { + if { [is_record_based $method] == 1 } { + set key [expr $count + 1] + } else { + set key $str + } + set ret [eval {$db put} \ + $txn $pflags {$key [chop_data $method $datastr]}] + error_check_good put:$db $ret 0 + set ret [eval {$db1 put} \ + $txn $pflags {$key [chop_data $method $datastr]}] + error_check_good put:$db1 $ret 0 + incr count + } + close $did + error_check_good close:$db [$db close] 0 + error_check_good close:$db1 [$db1 close] 0 + + # Database is created, now set up environment + + # Remove old mpools and Open/create the lock and mpool regions + error_check_good env:close:$env [$env close] 0 + set ret [eval {berkdb envremove} $encargs -home $testdir] + error_check_good env_remove $ret 0 + + set env [eval {berkdb_env_noerr -create -cdb} $encargs -home $testdir] + error_check_good dbenv [is_valid_widget $env env] TRUE + + # This tests the failure found in #1923 + puts "\tTest089.b: test delete then get" + + set db1 [eval {berkdb_open_noerr -env $env -create \ + -mode 0644 $omethod} $oargs {$testfile1}] + error_check_good dbopen [is_valid_db $db1] TRUE + + set dbc [$db1 cursor -update] + error_check_good dbcursor [is_valid_cursor $dbc $db1] TRUE + + for {set kd [$dbc get -first] } { [llength $kd] != 0 } \ + {set kd [$dbc get -next] } { + error_check_good dbcdel [$dbc del] 0 + } + error_check_good dbc_close [$dbc close] 0 + + puts "\tTest089.c: CDB cursor dups" + set dbc [$db1 cursor -update] + error_check_good dbcursor [is_valid_cursor $dbc $db1] TRUE + set stat [catch {$dbc dup} ret] + error_check_bad wr_cdup_stat $stat 0 + error_check_good wr_cdup [is_substr $ret \ + "Cannot duplicate writeable cursor"] 1 + + set dbc_ro [$db1 cursor] + error_check_good dbcursor [is_valid_cursor $dbc_ro $db1] TRUE + set dup_dbc [$dbc_ro dup] + error_check_good rd_cdup [is_valid_cursor $dup_dbc $db1] TRUE + + error_check_good dbc_close [$dbc close] 0 + error_check_good dbc_close [$dbc_ro close] 0 + error_check_good dbc_close [$dup_dbc close] 0 + error_check_good db_close [$db1 close] 0 + error_check_good env_close [$env close] 0 + + if { [is_btree $method] != 1 } { + puts "Skipping rest of test089 for $method method." + return + } + set pgindex [lsearch -exact $args "-pagesize"] + if { $pgindex != -1 } { + puts "Skipping rest of test089 for specific pagesizes" + return + } + append oargs " -dup " + test089_dup $testdir $encargs $oargs $omethod $nentries + append oargs " -dupsort " + test089_dup $testdir $encargs $oargs $omethod $nentries +} + +proc test089_dup { testdir encargs oargs method nentries } { + + env_cleanup $testdir + set env [eval {berkdb_env -create -cdb} $encargs -home $testdir] + error_check_good dbenv [is_valid_env $env] TRUE + + # + # Set pagesize small to generate lots of off-page dups + # + set page 512 + set nkeys 5 + set data "data" + set key "test089_key" + set testfile test089.db + puts "\tTest089.d: CDB ($oargs) off-page dups" + set oflags "-env $env -create -mode 0644 $oargs $method" + set db [eval {berkdb_open} -pagesize $page $oflags $testfile] + error_check_good dbopen [is_valid_db $db] TRUE + + puts "\tTest089.e: Fill page with $nkeys keys, with $nentries dups" + for { set k 0 } { $k < $nkeys } { incr k } { + for { set i 0 } { $i < $nentries } { incr i } { + set ret [$db put $key $i$data$k] + error_check_good dbput $ret 0 + } + } + + # Verify we have off-page duplicates + set stat [$db stat] + error_check_bad stat:offpage [is_substr $stat "{{Internal pages} 0}"] 1 + + set dbc [$db cursor -update] + error_check_good dbcursor [is_valid_cursor $dbc $db] TRUE + + puts "\tTest089.f: test delete then get of off-page dups" + for {set kd [$dbc get -first] } { [llength $kd] != 0 } \ + {set kd [$dbc get -next] } { + error_check_good dbcdel [$dbc del] 0 + } + error_check_good dbc_close [$dbc close] 0 + error_check_good db_close [$db close] 0 + error_check_good env_close [$env close] 0 +} diff --git a/db/test/test097.tcl b/db/test/test097.tcl new file mode 100644 index 000000000..ae4a24b88 --- /dev/null +++ b/db/test/test097.tcl @@ -0,0 +1,173 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: test097.tcl,v 11.7 2002/08/08 15:38:13 bostic Exp +# +# TEST test097 +# TEST Open up a large set of database files simultaneously. +# TEST Adjust for local file descriptor resource limits. +# TEST Then use the first 1000 entries from the dictionary. +# TEST Insert each with self as key and a fixed, medium length data string; +# TEST retrieve each. After all are entered, retrieve all; compare output +# TEST to original. + +proc test097 { method {ndbs 500} {nentries 400} args } { + global pad_datastr + source ./include.tcl + + set args [convert_args $method $args] + set encargs "" + set args [split_encargs $args encargs] + + puts -nonewline "Test097: $method ($args) " + puts "$nentries entries in at most $ndbs simultaneous databases" + + # Open an environment, with a 1MB cache. + set eindex [lsearch -exact $args "-env"] + if { $eindex != -1 } { + incr eindex + set env [lindex $args $eindex] + puts "Test097: $method: skipping for env $env" + return + } + env_cleanup $testdir + set env [eval {berkdb_env -create \ + -cachesize { 0 1048576 1 } -txn} -home $testdir $encargs] + error_check_good dbenv [is_valid_env $env] TRUE + + # Create the database and open the dictionary + set testfile test097.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + puts "\tTest097.a: Simultaneous open" + set numdb [test097_open tdb $ndbs $method $env $testfile $args] + if { $numdb == 0 } { + puts "\tTest097: Insufficient resources available -- skipping." + error_check_good envclose [$env close] 0 + return + } + + set did [open $dict] + + set pflags "" + set gflags "" + set txn "" + set count 0 + + # Here is the loop where we put and get each key/data pair + if { [is_record_based $method] == 1 } { + append gflags "-recno" + } + puts "\tTest097.b: put/get on $numdb databases" + set datastr "abcdefghij" + set pad_datastr [pad_data $method $datastr] + while { [gets $did str] != -1 && $count < $nentries } { + if { [is_record_based $method] == 1 } { + set key [expr $count + 1] + } else { + set key $str + } + for { set i 1 } { $i <= $numdb } { incr i } { + set ret [eval {$tdb($i) put} $txn $pflags \ + {$key [chop_data $method $datastr]}] + error_check_good put $ret 0 + set ret [eval {$tdb($i) get} $gflags {$key}] + error_check_good get $ret [list [list $key \ + [pad_data $method $datastr]]] + } + incr count + } + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest097.c: dump and check files" + for { set j 1 } { $j <= $numdb } { incr j } { + dump_file $tdb($j) $txn $t1 test097.check + error_check_good db_close [$tdb($j) close] 0 + + # Now compare the keys to see if they match the dictionary + if { [is_record_based $method] == 1 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + filesort $t2 $t3 + file rename -force $t3 $t2 + } else { + set q q + filehead $nentries $dict $t3 + filesort $t3 $t2 + } + filesort $t1 $t3 + + error_check_good Test097:diff($t3,$t2) [filecmp $t3 $t2] 0 + } + error_check_good envclose [$env close] 0 +} + +# Check function for test097; data should be fixed are identical +proc test097.check { key data } { + global pad_datastr + error_check_good "data mismatch for key $key" $data $pad_datastr +} + +proc test097_open { tdb ndbs method env testfile largs } { + global errorCode + upvar $tdb db + + set j 0 + set numdb $ndbs + if { [is_queueext $method] } { + set numdb [expr $ndbs / 4] + } + set omethod [convert_method $method] + for { set i 1 } {$i <= $numdb } { incr i } { + set stat [catch {eval {berkdb_open -env $env \ + -pagesize 512 -create -mode 0644} \ + $largs {$omethod $testfile.$i}} db($i)] + # + # Check if we've reached our limit + # + if { $stat == 1 } { + set min 20 + set em [is_substr $errorCode EMFILE] + set en [is_substr $errorCode ENFILE] + error_check_good open_ret [expr $em || $en] 1 + puts \ + "\tTest097.a.1 Encountered resource limits opening $i files, adjusting" + if { [is_queueext $method] } { + set end [expr $j / 4] + set min 10 + } else { + set end [expr $j - 10] + } + # + # If we cannot open even $min files, then this test is + # not very useful. Close up shop and go back. + # + if { $end < $min } { + test097_close db 1 $j + return 0 + } + test097_close db [expr $end + 1] $j + return $end + } else { + error_check_good dbopen [is_valid_db $db($i)] TRUE + set j $i + } + } + return $j +} + +proc test097_close { tdb start end } { + upvar $tdb db + + for { set i $start } { $i <= $end } { incr i } { + error_check_good db($i)close [$db($i) close] 0 + } +} diff --git a/db/test/test098.tcl b/db/test/test098.tcl new file mode 100644 index 000000000..9bc249958 --- /dev/null +++ b/db/test/test098.tcl @@ -0,0 +1,91 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 2002 +# Sleepycat Software. All rights reserved. +# +# Id: test098.tcl,v 1.5 2002/07/11 20:38:36 sandstro Exp +# +# TEST test098 +# TEST Test of DB_GET_RECNO and secondary indices. Open a primary and +# TEST a secondary, and do a normal cursor get followed by a get_recno. +# TEST (This is a smoke test for "Bug #1" in [#5811].) + +proc test098 { method args } { + source ./include.tcl + + set omethod [convert_method $method] + set args [convert_args $method $args] + + puts "Test098: $omethod ($args): DB_GET_RECNO and secondary indices." + + if { [is_rbtree $method] != 1 } { + puts "\tTest098: Skipping for method $method." + return + } + + set txnenv 0 + set eindex [lsearch -exact $args "-env"] + set txn "" + set auto "" + # + # If we are using an env, then testfile should just be the db name. + # Otherwise it is the test directory and the name. + if { $eindex == -1 } { + set base $testdir/test098 + set env NULL + } else { + set base test098 + incr eindex + set env [lindex $args $eindex] + set rpcenv [is_rpcenv $env] + if { $rpcenv == 1 } { + puts "Test098: Skipping for RPC" + return + } + set txnenv [is_txnenv $env] + if { $txnenv == 1 } { + set auto " -auto_commit " + } + set testdir [get_home $env] + } + cleanup $testdir $env + + puts "\tTest098.a: Set up databases." + + set adb [eval {berkdb_open} $omethod $args $auto \ + {-create} $base-primary.db] + error_check_good adb_create [is_valid_db $adb] TRUE + + set bdb [eval {berkdb_open} $omethod $args $auto \ + {-create} $base-secondary.db] + error_check_good bdb_create [is_valid_db $bdb] TRUE + + set ret [eval $adb associate $auto [callback_n 0] $bdb] + error_check_good associate $ret 0 + + if { $txnenv == 1 } { + set t [$env txn] + error_check_good txn [is_valid_txn $t $env] TRUE + set txn "-txn $t" + } + set ret [eval {$adb put} $txn aaa data1] + error_check_good put $ret 0 + if { $txnenv == 1 } { + error_check_good txn [$t commit] 0 + } + + set bc [$bdb cursor] + error_check_good cursor [is_valid_cursor $bc $bdb] TRUE + + puts "\tTest098.b: c_get(DB_FIRST) on the secondary." + error_check_good get_first [$bc get -first] \ + [list [list [[callback_n 0] aaa data1] data1]] + + puts "\tTest098.c: c_get(DB_GET_RECNO) on the secondary." + error_check_good get_recno [$bc get -get_recno] 1 + + error_check_good c_close [$bc close] 0 + + error_check_good bdb_close [$bdb close] 0 + error_check_good adb_close [$adb close] 0 +} diff --git a/db/test/test099.tcl b/db/test/test099.tcl new file mode 100644 index 000000000..fb5dd9c91 --- /dev/null +++ b/db/test/test099.tcl @@ -0,0 +1,177 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: test099.tcl,v 1.2 2002/08/08 15:38:13 bostic Exp +# +# TEST test099 +# TEST +# TEST Test of DB->get and DBC->c_get with set_recno and get_recno. +# TEST +# TEST Populate a small btree -recnum database. +# TEST After all are entered, retrieve each using -recno with DB->get. +# TEST Open a cursor and do the same for DBC->c_get with set_recno. +# TEST Verify that set_recno sets the record number position properly. +# TEST Verify that get_recno returns the correct record numbers. +proc test099 { method {nentries 10000} args } { + source ./include.tcl + + set args [convert_args $method $args] + set omethod [convert_method $method] + + puts "Test099: Test of set_recno and get_recno in DBC->c_get." + if { [is_rbtree $method] != 1 } { + puts "Test099: skipping for method $method." + return + } + + set txnenv 0 + set eindex [lsearch -exact $args "-env"] + # + # If we are using an env, then testfile should just be the db name. + # Otherwise it is the test directory and the name. + if { $eindex == -1 } { + set testfile $testdir/test099.db + set env NULL + } else { + set testfile test099.db + incr eindex + set env [lindex $args $eindex] + set txnenv [is_txnenv $env] + if { $txnenv == 1 } { + append args " -auto_commit " + # + # If we are using txns and running with the + # default, set the default down a bit. + # + if { $nentries == 10000 } { + set nentries 100 + } + } + set testdir [get_home $env] + } + set t1 $testdir/t1 + cleanup $testdir $env + + # Create the database and open the dictionary + set db [eval {berkdb_open \ + -create -mode 0644} $args {$omethod $testfile}] + error_check_good dbopen [is_valid_db $db] TRUE + + set did [open $dict] + + set pflags "" + set gflags "" + set txn "" + set count 1 + + append gflags " -recno" + + puts "\tTest099.a: put loop" + # Here is the loop where we put each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { +# global kvals +# set key [expr $count] +# set kvals($key) [pad_data $method $str] + set key $str + if { $txnenv == 1 } { + set t [$env txn] + error_check_good txn [is_valid_txn $t $env] TRUE + set txn "-txn $t" + } + set r [eval {$db put} \ + $txn $pflags {$key [chop_data $method $str]}] + error_check_good db_put $r 0 + if { $txnenv == 1 } { + error_check_good txn [$t commit] 0 + } + incr count + } + close $did + + puts "\tTest099.b: dump file" + if { $txnenv == 1 } { + set t [$env txn] + error_check_good txn [is_valid_txn $t $env] TRUE + set txn "-txn $t" + } + dump_file $db $txn $t1 test099.check + if { $txnenv == 1 } { + error_check_good txn [$t commit] 0 + } + error_check_good db_close [$db close] 0 + + puts "\tTest099.c: Test set_recno then get_recno" + set db [eval {berkdb_open -rdonly} $args $omethod $testfile ] + error_check_good dbopen [is_valid_db $db] TRUE + + # Open a cursor + if { $txnenv == 1 } { + set t [$env txn] + error_check_good txn [is_valid_txn $t $env] TRUE + set txn "-txn $t" + } + set dbc [eval {$db cursor} $txn] + error_check_good db_cursor [is_substr $dbc $db] 1 + + set did [open $t1] + set recno 1 + + # Create key(recno) array to use for later comparison + while { [gets $did str] != -1 } { + set kvals($recno) $str + incr recno + } + + set recno 1 + set ret [$dbc get -first] + error_check_bad dbc_get_first [llength $ret] 0 + + # First walk forward through the database .... + while { $recno < $count } { + # Test set_recno: verify it sets the record number properly. + set current [$dbc get -current] + set r [$dbc get -set_recno $recno] + error_check_good set_recno $current $r + # Test set_recno: verify that we find the expected key + # at the current record number position. + set k [lindex [lindex $r 0] 0] + error_check_good set_recno $kvals($recno) $k + + # Test get_recno: verify that the return from + # get_recno matches the record number just set. + set g [$dbc get -get_recno] + error_check_good get_recno $recno $g + set ret [$dbc get -next] + incr recno + } + + # ... and then backward. + set recno [expr $count - 1] + while { $recno > 0 } { + # Test set_recno: verify that we find the expected key + # at the current record number position. + set r [$dbc get -set_recno $recno] + set k [lindex [lindex $r 0] 0] + error_check_good set_recno $kvals($recno) $k + + # Test get_recno: verify that the return from + # get_recno matches the record number just set. + set g [$dbc get -get_recno] + error_check_good get_recno $recno $g + set recno [expr $recno - 1] + } + + error_check_good cursor_close [$dbc close] 0 + if { $txnenv == 1 } { + error_check_good txn [$t commit] 0 + } + error_check_good db_close [$db close] 0 + close $did +} + +# Check function for dumped file; data should be fixed are identical +proc test099.check { key data } { + error_check_good "data mismatch for key $key" $key $data +} diff --git a/db/test/txn001.tcl b/db/test/txn001.tcl new file mode 100644 index 000000000..ad2c6360a --- /dev/null +++ b/db/test/txn001.tcl @@ -0,0 +1,116 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn001.tcl,v 11.35 2002/05/10 17:44:28 sue Exp +# + +# TEST txn001 +# TEST Begin, commit, abort testing. +proc txn001 { {tnum "01"} { max 1024 } { ntxns 50 } } { + source ./include.tcl + global txn_curid + global txn_maxid + + puts -nonewline "Txn0$tnum: Basic begin, commit, abort" + + if { $tnum != "01"} { + puts " (with ID wrap)" + } else { + puts "" + } + + # Open environment + env_cleanup $testdir + + set env [eval {berkdb_env -create -mode 0644 -txn \ + -txn_max $max -home $testdir}] + error_check_good evn_open [is_valid_env $env] TRUE + error_check_good txn_id_set \ + [ $env txn_id_set $txn_curid $txn_maxid ] 0 + txn001_suba $ntxns $env $tnum + txn001_subb $ntxns $env $tnum + txn001_subc $ntxns $env $tnum + # Close and unlink the file + error_check_good env_close:$env [$env close] 0 +} + +proc txn001_suba { ntxns env tnum } { + source ./include.tcl + + # We will create a bunch of transactions and commit them. + set txn_list {} + set tid_list {} + puts "\tTxn0$tnum.a: Beginning/Committing $ntxns Transactions in $env" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$env txn] + error_check_good txn_begin [is_valid_txn $txn $env] TRUE + + lappend txn_list $txn + + set tid [$txn id] + error_check_good tid_check [lsearch $tid_list $tid] -1 + + lappend tid_list $tid + } + + # Now commit them all + foreach t $txn_list { + error_check_good txn_commit:$t [$t commit] 0 + } +} + +proc txn001_subb { ntxns env tnum } { + # We will create a bunch of transactions and abort them. + set txn_list {} + set tid_list {} + puts "\tTxn0$tnum.b: Beginning/Aborting Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$env txn] + error_check_good txn_begin [is_valid_txn $txn $env] TRUE + + lappend txn_list $txn + + set tid [$txn id] + error_check_good tid_check [lsearch $tid_list $tid] -1 + + lappend tid_list $tid + } + + # Now abort them all + foreach t $txn_list { + error_check_good txn_abort:$t [$t abort] 0 + } +} + +proc txn001_subc { ntxns env tnum } { + # We will create a bunch of transactions and commit them. + set txn_list {} + set tid_list {} + puts "\tTxn0$tnum.c: Beginning/Prepare/Committing Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$env txn] + error_check_good txn_begin [is_valid_txn $txn $env] TRUE + + lappend txn_list $txn + + set tid [$txn id] + error_check_good tid_check [lsearch $tid_list $tid] -1 + + lappend tid_list $tid + } + + # Now prepare them all + foreach t $txn_list { + error_check_good txn_prepare:$t \ + [$t prepare [make_gid global:$t]] 0 + } + + # Now commit them all + foreach t $txn_list { + error_check_good txn_commit:$t [$t commit] 0 + } + +} + diff --git a/db/test/txn002.tcl b/db/test/txn002.tcl new file mode 100644 index 000000000..40f4ac426 --- /dev/null +++ b/db/test/txn002.tcl @@ -0,0 +1,91 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn002.tcl,v 11.38 2002/05/10 17:44:29 sue Exp +# + +# TEST txn002 +# TEST Verify that read-only transactions do not write log records. +proc txn002 { {tnum "02" } { max 1024 } { ntxns 50 } } { + source ./include.tcl + global txn_curid + global txn_maxid + + puts -nonewline "Txn0$tnum: Read-only transaction test ($max) ($ntxns)" + + if { $tnum != "02" } { + puts " (with ID wrap)" + } else { + puts "" + } + + env_cleanup $testdir + set env [berkdb \ + env -create -mode 0644 -txn -txn_max $max -home $testdir] + error_check_good dbenv [is_valid_env $env] TRUE + error_check_good txn_id_set \ + [$env txn_id_set $txn_curid $txn_maxid ] 0 + + # Save the current bytes in the log. + set off_start [txn002_logoff $env] + + # We will create a bunch of transactions and commit them. + set txn_list {} + set tid_list {} + puts "\tTxn0$tnum.a: Beginning/Committing Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$env txn] + error_check_good txn_begin [is_valid_txn $txn $env] TRUE + + lappend txn_list $txn + + set tid [$txn id] + error_check_good tid_check [lsearch $tid_list $tid] -1 + + lappend tid_list $tid + } + foreach t $txn_list { + error_check_good txn_commit:$t [$t commit] 0 + } + + # Make sure we haven't written any new log records except + # potentially some recycle records if we were wrapping txnids. + set off_stop [txn002_logoff $env] + if { $off_stop != $off_start } { + txn002_recycle_only $testdir + } + + error_check_good env_close [$env close] 0 +} + +proc txn002_logoff { env } { + set stat [$env log_stat] + foreach i $stat { + foreach {txt val} $i {break} + if { [string compare \ + $txt {Current log file offset}] == 0 } { + return $val + } + } +} + +# Make sure that the only log records found are txn_recycle records +proc txn002_recycle_only { dir } { + global util_path + + set tmpfile $dir/printlog.out + set stat [catch {exec $util_path/db_printlog -h $dir > $tmpfile} ret] + error_check_good db_printlog $stat 0 + + set f [open $tmpfile r] + while { [gets $f record] >= 0 } { + set r [regexp {\[[^\]]*\]\[[^\]]*\]([^\:]*)\:} $record whl name] + if { $r == 1 } { + error_check_good record_type __txn_recycle $name + } + } + close $f + fileremove $tmpfile +} diff --git a/db/test/txn003.tcl b/db/test/txn003.tcl new file mode 100644 index 000000000..bc71891f6 --- /dev/null +++ b/db/test/txn003.tcl @@ -0,0 +1,238 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn003.tcl,v 11.39 2002/08/08 15:38:14 bostic Exp +# + +# TEST txn003 +# TEST Test abort/commit/prepare of txns with outstanding child txns. +proc txn003 { {tnum "03"} } { + source ./include.tcl + global txn_curid + global txn_maxid + + puts -nonewline "Txn0$tnum: Outstanding child transaction test" + + if { $tnum != "03" } { + puts " (with ID wrap)" + } else { + puts "" + } + env_cleanup $testdir + set testfile txn003.db + + set env_cmd "berkdb_env_noerr -create -txn -home $testdir" + set env [eval $env_cmd] + error_check_good dbenv [is_valid_env $env] TRUE + error_check_good txn_id_set \ + [$env txn_id_set $txn_curid $txn_maxid] 0 + + set oflags {-auto_commit -create -btree -mode 0644 -env $env $testfile} + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + + # + # Put some data so that we can check commit or abort of child + # + set key 1 + set origdata some_data + set newdata this_is_new_data + set newdata2 some_other_new_data + + error_check_good db_put [$db put -auto_commit $key $origdata] 0 + error_check_good dbclose [$db close] 0 + + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + + txn003_check $db $key "Origdata" $origdata + + puts "\tTxn0$tnum.a: Parent abort" + set parent [$env txn] + error_check_good txn_begin [is_valid_txn $parent $env] TRUE + set child [$env txn -parent $parent] + error_check_good txn_begin [is_valid_txn $child $env] TRUE + error_check_good db_put [$db put -txn $child $key $newdata] 0 + error_check_good parent_abort [$parent abort] 0 + txn003_check $db $key "parent_abort" $origdata + # Check child handle is invalid + set stat [catch {$child abort} ret] + error_check_good child_handle $stat 1 + error_check_good child_h2 [is_substr $ret "invalid command name"] 1 + + puts "\tTxn0$tnum.b: Parent commit" + set parent [$env txn] + error_check_good txn_begin [is_valid_txn $parent $env] TRUE + set child [$env txn -parent $parent] + error_check_good txn_begin [is_valid_txn $child $env] TRUE + error_check_good db_put [$db put -txn $child $key $newdata] 0 + error_check_good parent_commit [$parent commit] 0 + txn003_check $db $key "parent_commit" $newdata + # Check child handle is invalid + set stat [catch {$child abort} ret] + error_check_good child_handle $stat 1 + error_check_good child_h2 [is_substr $ret "invalid command name"] 1 + error_check_good dbclose [$db close] 0 + error_check_good env_close [$env close] 0 + + # + # Since the data check assumes what has come before, the 'commit' + # operation must be last. + # + set hdr "\tTxn0$tnum" + set rlist { + {begin ".c"} + {prepare ".d"} + {abort ".e"} + {commit ".f"} + } + set count 0 + foreach pair $rlist { + incr count + set op [lindex $pair 0] + set msg [lindex $pair 1] + set msg $hdr$msg + txn003_body $env_cmd $testfile $testdir $key $newdata2 $msg $op + set env [eval $env_cmd] + error_check_good dbenv [is_valid_env $env] TRUE + + berkdb debug_check + set db [eval {berkdb_open} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + # + # For prepare we'll then just + # end up aborting after we test what we need to. + # So set gooddata to the same as abort. + switch $op { + abort { + set gooddata $newdata + } + begin { + set gooddata $newdata + } + commit { + set gooddata $newdata2 + } + prepare { + set gooddata $newdata + } + } + txn003_check $db $key "parent_$op" $gooddata + error_check_good dbclose [$db close] 0 + error_check_good env_close [$env close] 0 + } + + # We can't do the attempted child discard on Windows + # because it will leave open files that can't be removed. + # Skip the remainder of the test for Windows. + if { $is_windows_test == 1 } { + puts "Skipping remainder of test for Windows" + return + } + puts "\tTxn0$tnum.g: Attempt child prepare" + set env [eval $env_cmd] + error_check_good dbenv [is_valid_env $env] TRUE + berkdb debug_check + set db [eval {berkdb_open_noerr} $oflags] + error_check_good db_open [is_valid_db $db] TRUE + + set parent [$env txn] + error_check_good txn_begin [is_valid_txn $parent $env] TRUE + set child [$env txn -parent $parent] + error_check_good txn_begin [is_valid_txn $child $env] TRUE + error_check_good db_put [$db put -txn $child $key $newdata] 0 + set gid [make_gid child_prepare:$child] + set stat [catch {$child prepare $gid} ret] + error_check_good child_prepare $stat 1 + error_check_good child_prep_err [is_substr $ret "txn prepare"] 1 + + puts "\tTxn0$tnum.h: Attempt child discard" + set stat [catch {$child discard} ret] + error_check_good child_discard $stat 1 + + # We just panic'd the region, so the next operations will fail. + # No matter, we still have to clean up all the handles. + + set stat [catch {$parent commit} ret] + error_check_good parent_commit $stat 1 + error_check_good parent_commit:fail [is_substr $ret "DB_RUNRECOVERY"] 1 + + set stat [catch {$db close} ret] + error_check_good db_close $stat 1 + error_check_good db_close:fail [is_substr $ret "DB_RUNRECOVERY"] 1 + + set stat [catch {$env close} ret] + error_check_good env_close $stat 1 + error_check_good env_close:fail [is_substr $ret "DB_RUNRECOVERY"] 1 +} + +proc txn003_body { env_cmd testfile dir key newdata2 msg op } { + source ./include.tcl + + berkdb debug_check + sentinel_init + set gidf $dir/gidfile + fileremove -f $gidf + set proclist {} + puts "$msg.0: Executing child script to prepare txns" + berkdb debug_check + set p [exec $tclsh_path $test_path/wrap.tcl txnscript.tcl \ + $testdir/txnout $env_cmd $testfile $gidf $key $newdata2 &] + lappend proclist $p + watch_procs 5 + set f1 [open $testdir/txnout r] + set r [read $f1] + puts $r + close $f1 + fileremove -f $testdir/txnout + + berkdb debug_check + puts -nonewline "$msg.1: Running recovery ... " + flush stdout + berkdb debug_check + set env [eval $env_cmd "-recover"] + error_check_good dbenv-recover [is_valid_env $env] TRUE + puts "complete" + + puts "$msg.2: getting txns from txn_recover" + set txnlist [$env txn_recover] + error_check_good txnlist_len [llength $txnlist] 1 + set tpair [lindex $txnlist 0] + + set gfd [open $gidf r] + set ret [gets $gfd parentgid] + close $gfd + set txn [lindex $tpair 0] + set gid [lindex $tpair 1] + if { $op == "begin" } { + puts "$msg.2: $op new txn" + } else { + puts "$msg.2: $op parent" + } + error_check_good gidcompare $gid $parentgid + if { $op == "prepare" } { + set gid [make_gid prepare_recover:$txn] + set stat [catch {$txn $op $gid} ret] + error_check_good prep_error $stat 1 + error_check_good prep_err \ + [is_substr $ret "transaction already prepared"] 1 + error_check_good txn:prep_abort [$txn abort] 0 + } elseif { $op == "begin" } { + set stat [catch {$env txn} ret] + error_check_good begin_error $stat 1 + error_check_good begin_err \ + [is_substr $ret "not yet committed transactions is incomplete"] 1 + error_check_good txn:prep_abort [$txn abort] 0 + } else { + error_check_good txn:$op [$txn $op] 0 + } + error_check_good envclose [$env close] 0 +} + +proc txn003_check { db key msg gooddata } { + set kd [$db get $key] + set data [lindex [lindex $kd 0] 1] + error_check_good $msg $data $gooddata +} diff --git a/db/test/txn004.tcl b/db/test/txn004.tcl new file mode 100644 index 000000000..5e02bc94c --- /dev/null +++ b/db/test/txn004.tcl @@ -0,0 +1,62 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn004.tcl,v 11.39 2002/05/15 17:14:06 sandstro Exp +# + +# TEST txn004 +# TEST Test of wraparound txnids (txn001) +proc txn004 { } { + source ./include.tcl + global txn_curid + global txn_maxid + + set orig_curid $txn_curid + set orig_maxid $txn_maxid + puts "\tTxn004.1: wraparound txnids" + set txn_curid [expr $txn_maxid - 2] + txn001 "04.1" + puts "\tTxn004.2: closer wraparound txnids" + set txn_curid [expr $txn_maxid - 3] + set txn_maxid [expr $txn_maxid - 2] + txn001 "04.2" + + puts "\tTxn004.3: test wraparound txnids" + txn_idwrap_check $testdir + set txn_curid $orig_curid + set txn_maxid $orig_maxid + return +} + +proc txn_idwrap_check { testdir } { + global txn_curid + global txn_maxid + + env_cleanup $testdir + + # Open/create the txn region + set e [berkdb_env -create -txn -home $testdir] + error_check_good env_open [is_substr $e env] 1 + + set txn1 [$e txn] + error_check_good txn1 [is_valid_txn $txn1 $e] TRUE + error_check_good txn_id_set \ + [$e txn_id_set [expr $txn_maxid - 1] $txn_maxid] 0 + + set txn2 [$e txn] + error_check_good txn2 [is_valid_txn $txn2 $e] TRUE + + # txn3 will require a wraparound txnid + # XXX How can we test it has a wrapped id? + set txn3 [$e txn] + error_check_good wrap_txn3 [is_valid_txn $txn3 $e] TRUE + + error_check_good free_txn1 [$txn1 commit] 0 + error_check_good free_txn2 [$txn2 commit] 0 + error_check_good free_txn3 [$txn3 commit] 0 + + error_check_good close [$e close] 0 +} + diff --git a/db/test/txn005.tcl b/db/test/txn005.tcl new file mode 100644 index 000000000..9ea3df49f --- /dev/null +++ b/db/test/txn005.tcl @@ -0,0 +1,75 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn005.tcl,v 11.35 2002/08/08 15:38:14 bostic Exp +# + +# TEST txn005 +# TEST Test transaction ID wraparound and recovery. +proc txn005 {} { + source ./include.tcl + global txn_curid + global txn_maxid + + env_cleanup $testdir + puts "Txn005: Test transaction wraparound recovery" + + # Open/create the txn region + puts "\tTxn005.a: Create environment" + set e [berkdb_env -create -txn -home $testdir] + error_check_good env_open [is_valid_env $e] TRUE + + set txn1 [$e txn] + error_check_good txn1 [is_valid_txn $txn1 $e] TRUE + + set db [berkdb_open -env $e -txn $txn1 -create -btree txn005.db] + error_check_good db [is_valid_db $db] TRUE + error_check_good txn1_commit [$txn1 commit] 0 + + puts "\tTxn005.b: Set txn ids" + error_check_good txn_id_set \ + [$e txn_id_set [expr $txn_maxid - 1] $txn_maxid] 0 + + # txn2 and txn3 will require a wraparound txnid + set txn2 [$e txn] + error_check_good txn2 [is_valid_txn $txn2 $e] TRUE + + error_check_good put [$db put -txn $txn2 "a" ""] 0 + error_check_good txn2_commit [$txn2 commit] 0 + + error_check_good get_a [$db get "a"] "{a {}}" + + error_check_good close [$db close] 0 + + set txn3 [$e txn] + error_check_good txn3 [is_valid_txn $txn3 $e] TRUE + + set db [berkdb_open -env $e -txn $txn3 -btree txn005.db] + error_check_good db [is_valid_db $db] TRUE + + error_check_good put2 [$db put -txn $txn3 "b" ""] 0 + error_check_good sync [$db sync] 0 + error_check_good txn3_abort [$txn3 abort] 0 + error_check_good dbclose [$db close] 0 + error_check_good eclose [$e close] 0 + + puts "\tTxn005.c: Run recovery" + set stat [catch {exec $util_path/db_recover -h $testdir -e -c} result] + if { $stat == 1 } { + error "FAIL: Recovery error: $result." + } + + puts "\tTxn005.d: Check data" + set e [berkdb_env -txn -home $testdir] + error_check_good env_open [is_valid_env $e] TRUE + + set db [berkdb_open -env $e -auto_commit -btree txn005.db] + error_check_good db [is_valid_db $db] TRUE + + error_check_good get_a [$db get "a"] "{a {}}" + error_check_bad get_b [$db get "b"] "{b {}}" + error_check_good dbclose [$db close] 0 + error_check_good eclose [$e close] 0 +} diff --git a/db/test/txn006.tcl b/db/test/txn006.tcl new file mode 100644 index 000000000..bb9e81dff --- /dev/null +++ b/db/test/txn006.tcl @@ -0,0 +1,47 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn006.tcl,v 1.5 2002/08/01 19:59:19 sue Exp +# +# +#TEST txn006 +#TEST Test dump/load in transactional environment. +proc txn006 { { iter 50 } } { + source ./include.tcl + set testfile txn006.db + + puts "Txn006: Test dump/load in transaction environment" + env_cleanup $testdir + + puts "\tTxn006.a: Create environment and database" + # Open/create the txn region + set e [berkdb_env -create -home $testdir -txn] + error_check_good env_open [is_valid_env $e] TRUE + + # Open/create database + set db [berkdb_open -auto_commit -env $e \ + -create -btree -dup $testfile] + error_check_good db_open [is_valid_db $db] TRUE + + # Start a transaction + set txn [$e txn] + error_check_good txn [is_valid_txn $txn $e] TRUE + + puts "\tTxn006.b: Put data" + # Put some data + for { set i 1 } { $i < $iter } { incr i } { + error_check_good put [$db put -txn $txn key$i data$i] 0 + } + + # End transaction, close db + error_check_good txn_commit [$txn commit] 0 + error_check_good db_close [$db close] 0 + error_check_good env_close [$e close] 0 + + puts "\tTxn006.c: dump/load" + # Dump and load + exec $util_path/db_dump -p -h $testdir $testfile | \ + $util_path/db_load -h $testdir $testfile +} diff --git a/db/test/txn007.tcl b/db/test/txn007.tcl new file mode 100644 index 000000000..151c38e78 --- /dev/null +++ b/db/test/txn007.tcl @@ -0,0 +1,57 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn007.tcl,v 11.3 2002/08/08 15:38:14 bostic Exp +# +#TEST txn007 +#TEST Test of DB_TXN_WRITE_NOSYNC +proc txn007 { { iter 50 } } { + source ./include.tcl + set testfile txn007.db + + puts "Txn007: DB_TXN_WRITE_NOSYNC" + env_cleanup $testdir + + # Open/create the txn region + puts "\tTxn007.a: Create env and database with -wrnosync" + set e [berkdb_env -create -home $testdir -txn -wrnosync] + error_check_good env_open [is_valid_env $e] TRUE + + # Open/create database + set db [berkdb open -auto_commit -env $e \ + -create -btree -dup $testfile] + error_check_good db_open [is_valid_db $db] TRUE + + # Put some data + puts "\tTxn007.b: Put $iter data items in individual transactions" + for { set i 1 } { $i < $iter } { incr i } { + # Start a transaction + set txn [$e txn] + error_check_good txn [is_valid_txn $txn $e] TRUE + $db put -txn $txn key$i data$i + error_check_good txn_commit [$txn commit] 0 + } + set stat [$e log_stat] + puts "\tTxn007.c: Check log stats" + foreach i $stat { + set txt [lindex $i 0] + if { [string equal $txt {Times log written}] == 1 } { + set wrval [lindex $i 1] + } + if { [string equal $txt {Times log flushed}] == 1 } { + set syncval [lindex $i 1] + } + } + error_check_good wrval [expr $wrval >= $iter] 1 + # + # We should have written at least 'iter' number of times, + # but not synced on any of those. + # + set val [expr $wrval - $iter] + error_check_good syncval [expr $syncval <= $val] 1 + + error_check_good db_close [$db close] 0 + error_check_good env_close [$e close] 0 +} diff --git a/db/test/txn008.tcl b/db/test/txn008.tcl new file mode 100644 index 000000000..e9d0a06c9 --- /dev/null +++ b/db/test/txn008.tcl @@ -0,0 +1,32 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn008.tcl,v 11.3 2002/05/10 17:55:54 sue Exp +# + +# TEST txn008 +# TEST Test of wraparound txnids (txn002) +proc txn008 { } { + source ./include.tcl + global txn_curid + global txn_maxid + + set orig_curid $txn_curid + set orig_maxid $txn_maxid + puts "\tTxn008.1: wraparound txnids" + set txn_curid [expr $txn_maxid - 2] + txn002 "08.1" + puts "\tTxn008.2: closer wraparound txnids" + set txn_curid [expr $txn_maxid - 3] + set txn_maxid [expr $txn_maxid - 2] + txn002 "08.2" + + puts "\tTxn008.3: test wraparound txnids" + txn_idwrap_check $testdir + set txn_curid $orig_curid + set txn_maxid $orig_maxid + return +} + diff --git a/db/test/txn009.tcl b/db/test/txn009.tcl new file mode 100644 index 000000000..1b371da54 --- /dev/null +++ b/db/test/txn009.tcl @@ -0,0 +1,32 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996-2002 +# Sleepycat Software. All rights reserved. +# +# Id: txn009.tcl,v 11.3 2002/05/10 17:55:55 sue Exp +# + +# TEST txn009 +# TEST Test of wraparound txnids (txn003) +proc txn009 { } { + source ./include.tcl + global txn_curid + global txn_maxid + + set orig_curid $txn_curid + set orig_maxid $txn_maxid + puts "\tTxn009.1: wraparound txnids" + set txn_curid [expr $txn_maxid - 2] + txn003 "09.1" + puts "\tTxn009.2: closer wraparound txnids" + set txn_curid [expr $txn_maxid - 3] + set txn_maxid [expr $txn_maxid - 2] + txn003 "09.2" + + puts "\tTxn009.3: test wraparound txnids" + txn_idwrap_check $testdir + set txn_curid $orig_curid + set txn_maxid $orig_maxid + return +} + diff --git a/db/txn/txn_util.c b/db/txn/txn_util.c new file mode 100644 index 000000000..8656d2ece --- /dev/null +++ b/db/txn/txn_util.c @@ -0,0 +1,234 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: txn_util.c,v 11.18 2002/08/06 06:25:12 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_shash.h" +#include "dbinc/lock.h" +#include "dbinc/txn.h" + +typedef struct __txn_event TXN_EVENT; +struct __txn_event { + TXN_EVENT_T op; + TAILQ_ENTRY(__txn_event) links; + union { + struct { + /* Delayed remove. */ + char *name; + u_int8_t *fileid; + } r; + struct { + /* Lock event. */ + DB_LOCK lock; + u_int32_t locker; + DB *dbp; + } t; + } u; +}; + +/* + * __txn_remevent -- + * + * Creates a remove event that can be added to the commit list. + * + * PUBLIC: int __txn_remevent __P((DB_ENV *, + * PUBLIC: DB_TXN *, const char *, u_int8_t*)); + */ +int +__txn_remevent(dbenv, txn, name, fileid) + DB_ENV *dbenv; + DB_TXN *txn; + const char *name; + u_int8_t *fileid; +{ + int ret; + TXN_EVENT *e; + + e = NULL; + if ((ret = __os_calloc(dbenv, 1, sizeof(TXN_EVENT), &e)) != 0) + return (ret); + + if ((ret = __os_strdup(dbenv, name, &e->u.r.name)) != 0) + goto err; + + if (fileid != NULL) { + if ((ret = __os_calloc(dbenv, + 1, DB_FILE_ID_LEN, &e->u.r.fileid)) != 0) + return (ret); + memcpy(e->u.r.fileid, fileid, DB_FILE_ID_LEN); + } + + e->op = TXN_REMOVE; + TAILQ_INSERT_TAIL(&txn->events, e, links); + + return (0); + +err: if (e != NULL) + __os_free(dbenv, e); + + return (ret); +} + +/* + * __txn_lockevent -- + * + * Add a lockevent to the commit-queue. The lock event indicates a locker + * trade. + * + * PUBLIC: int __txn_lockevent __P((DB_ENV *, + * PUBLIC: DB_TXN *, DB *, DB_LOCK *, u_int32_t)); + */ +int +__txn_lockevent(dbenv, txn, dbp, lock, locker) + DB_ENV *dbenv; + DB_TXN *txn; + DB *dbp; + DB_LOCK *lock; + u_int32_t locker; +{ + int ret; + TXN_EVENT *e; + + if (!LOCKING_ON(dbenv)) + return (0); + + e = NULL; + if ((ret = __os_calloc(dbenv, 1, sizeof(TXN_EVENT), &e)) != 0) + return (ret); + + e->u.t.locker = locker; + e->u.t.lock = *lock; + e->u.t.dbp = dbp; + e->op = TXN_TRADE; + TAILQ_INSERT_TAIL(&txn->events, e, links); + + return (0); +} + +/* + * __txn_remlock -- + * Remove a lock event because the locker is going away. We can remove + * by lock (using offset) or by locker_id (or by both). + * + * PUBLIC: void __txn_remlock __P((DB_ENV *, DB_TXN *, DB_LOCK *, u_int32_t)); + */ +void +__txn_remlock(dbenv, txn, lock, locker) + DB_ENV *dbenv; + DB_TXN *txn; + DB_LOCK *lock; + u_int32_t locker; +{ + TXN_EVENT *e, *next_e; + + for (e = TAILQ_FIRST(&txn->events); e != NULL; e = next_e) { + next_e = TAILQ_NEXT(e, links); + if ((e->op != TXN_TRADE && e->op != TXN_TRADED) || + (e->u.t.lock.off != lock->off && e->u.t.locker != locker)) + continue; + TAILQ_REMOVE(&txn->events, e, links); + __os_free(dbenv, e); + } + + return; +} + +/* + * __txn_doevents -- + * Process the list of events associated with a transaction. On commit, + * apply the events; on abort, just toss the entries. + * + * PUBLIC: int __txn_doevents __P((DB_ENV *, DB_TXN *, int, int)); + */ +#define DO_TRADE do { \ + memset(&req, 0, sizeof(req)); \ + req.lock = e->u.t.lock; \ + req.op = DB_LOCK_TRADE; \ + t_ret = __lock_vec(dbenv, e->u.t.locker, 0, &req, 1, NULL); \ + if (t_ret == 0) \ + e->u.t.dbp->cur_lid = e->u.t.locker; \ + else if (t_ret == DB_NOTFOUND) \ + t_ret = 0; \ + if (t_ret != 0 && ret == 0) \ + ret = t_ret; \ + e->op = TXN_TRADED; \ +} while (0) + +int +__txn_doevents(dbenv, txn, is_commit, preprocess) + DB_ENV *dbenv; + DB_TXN *txn; + int is_commit, preprocess; +{ + DB_LOCKREQ req; + TXN_EVENT *e; + int ret, t_ret; + + ret = 0; + + /* + * This phase only gets called if we have a phase where we + * release read locks. Since not all paths will call this + * phase, we have to check for it below as well. So, when + * we do the trade, we update the opcode of the entry so that + * we don't try the trade again. + */ + if (preprocess) { + for (e = TAILQ_FIRST(&txn->events); + e != NULL; e = TAILQ_NEXT(e, links)) { + if (e->op != TXN_TRADE) + continue; + DO_TRADE; + } + return (ret); + } + + while ((e = TAILQ_FIRST(&txn->events)) != NULL) { + TAILQ_REMOVE(&txn->events, e, links); + if (!is_commit) + goto dofree; + switch (e->op) { + case TXN_REMOVE: + if (e->u.r.fileid != NULL) { + if ((t_ret = dbenv->memp_nameop(dbenv, + e->u.r.fileid, + NULL, e->u.r.name, NULL)) != 0 && ret == 0) + ret = t_ret; + __os_free(dbenv, e->u.r.fileid); + } else if ((t_ret = + __os_unlink(dbenv, e->u.r.name)) != 0 && ret == 0) + ret = t_ret; + __os_free(dbenv, e->u.r.name); + break; + case TXN_TRADE: + DO_TRADE; + /* Fall through */ + case TXN_TRADED: + /* Downgrade the lock. */ + if ((t_ret = __lock_downgrade(dbenv, + &e->u.t.lock, DB_LOCK_READ, 0)) != 0 && ret == 0) + ret = t_ret; + break; + default: + /* This had better never happen. */ + DB_ASSERT(0); + } +dofree: __os_free(dbenv, e); + } + + return (ret); +} |