summaryrefslogtreecommitdiffstats
path: root/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm
diff options
context:
space:
mode:
Diffstat (limited to 'rubbos/app/httpd-2.0.64/srclib/apr-util/dbm')
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm.obin0 -> 17736 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_berkeleydb.obin0 -> 2504 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_gdbm.obin0 -> 2488 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_ndbm.obin0 -> 2488 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_sdbm.obin0 -> 22032 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile10
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile.in10
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.c207
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.obin0 -> 17632 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.c403
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.obin0 -> 2496 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.c270
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.obin0 -> 2488 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.c227
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.obin0 -> 2488 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.c265
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.obin0 -> 21920 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm.obin0 -> 50192 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_hash.obin0 -> 7848 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_lock.obin0 -> 10704 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_pair.obin0 -> 19064 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile8
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile.in8
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.c588
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.obin0 -> 36664 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.c63
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.obin0 -> 7880 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.c78
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.obin0 -> 10648 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.c319
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.h40
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.lo12
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.obin0 -> 19056 bytes
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_private.h84
-rw-r--r--rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_tune.h40
43 files changed, 2728 insertions, 0 deletions
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm.o
new file mode 100644
index 00000000..cc56df0b
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_berkeleydb.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_berkeleydb.o
new file mode 100644
index 00000000..cb6ad8d6
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_berkeleydb.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_gdbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_gdbm.o
new file mode 100644
index 00000000..86a00a78
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_gdbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_ndbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_ndbm.o
new file mode 100644
index 00000000..1ba908d9
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_ndbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_sdbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_sdbm.o
new file mode 100644
index 00000000..7db2db8c
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/.libs/apr_dbm_sdbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile
new file mode 100644
index 00000000..0565a700
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile
@@ -0,0 +1,10 @@
+
+
+INCLUDES = -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/include -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/include/private -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr/include -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib
+
+TARGETS = apr_dbm.lo apr_dbm_berkeleydb.lo apr_dbm_gdbm.lo apr_dbm_sdbm.lo apr_dbm_ndbm.lo
+
+# bring in rules.mk for standard functionality
+include /bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/build/rules.mk
+
+SUBDIRS = sdbm .
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile.in b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile.in
new file mode 100644
index 00000000..61e15e88
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/Makefile.in
@@ -0,0 +1,10 @@
+VPATH = @srcdir@
+
+INCLUDES = @APRUTIL_PRIV_INCLUDES@ @APR_INCLUDES@ @APRUTIL_INCLUDES@
+
+TARGETS = apr_dbm.lo apr_dbm_berkeleydb.lo apr_dbm_gdbm.lo apr_dbm_sdbm.lo apr_dbm_ndbm.lo
+
+# bring in rules.mk for standard functionality
+@INCLUDE_RULES@
+
+SUBDIRS = sdbm .
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.c
new file mode 100644
index 00000000..88cf08e6
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.c
@@ -0,0 +1,207 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr.h"
+#include "apr_errno.h"
+#include "apr_pools.h"
+#include "apr_strings.h"
+#define APR_WANT_MEMFUNC
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+#include "apr_general.h"
+
+#include "apu.h"
+#include "apu_select_dbm.h"
+#include "apr_dbm.h"
+#include "apr_dbm_private.h"
+
+/* ### note: the setting of DBM_VTABLE will go away once we have multiple
+ ### DBMs in here.
+ ### Well, that day is here. So, do we remove DBM_VTABLE and the old
+ ### API entirely? Oh, what to do. We need an APU_DEFAULT_DBM #define.
+ ### Sounds like a job for autoconf. */
+
+#if APU_USE_SDBM
+#define DBM_VTABLE apr_dbm_type_sdbm
+#elif APU_USE_GDBM
+#define DBM_VTABLE apr_dbm_type_gdbm
+#elif APU_USE_DB
+#define DBM_VTABLE apr_dbm_type_db
+#elif APU_USE_NDBM
+#define DBM_VTABLE apr_dbm_type_ndbm
+#else /* Not in the USE_xDBM list above */
+#error a DBM implementation was not specified
+#endif
+
+APU_DECLARE(apr_status_t) apr_dbm_open_ex(apr_dbm_t **pdb, const char*type,
+ const char *pathname,
+ apr_int32_t mode, apr_fileperms_t perm,
+ apr_pool_t *pool)
+{
+#if APU_HAVE_GDBM
+ if (!strcasecmp(type, "GDBM")) {
+ return (*apr_dbm_type_gdbm.open)(pdb, pathname, mode, perm, pool);
+ }
+#endif
+#if APU_HAVE_SDBM
+ if (!strcasecmp(type, "SDBM")) {
+ return (*apr_dbm_type_sdbm.open)(pdb, pathname, mode, perm, pool);
+ }
+#endif
+#if APU_HAVE_DB
+ if (!strcasecmp(type, "DB")) {
+ return (*apr_dbm_type_db.open)(pdb, pathname, mode, perm, pool);
+ }
+#endif
+#if APU_HAVE_NDBM
+ if (!strcasecmp(type, "NDBM")) {
+ return (*apr_dbm_type_ndbm.open)(pdb, pathname, mode, perm, pool);
+ }
+#endif
+
+ if (!strcasecmp(type, "default")) {
+ return (*DBM_VTABLE.open)(pdb, pathname, mode, perm, pool);
+ }
+
+ return APR_ENOTIMPL;
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_open(apr_dbm_t **pdb, const char *pathname,
+ apr_int32_t mode, apr_fileperms_t perm,
+ apr_pool_t *pool)
+{
+ return (*DBM_VTABLE.open)(pdb, pathname, mode, perm, pool);
+}
+
+APU_DECLARE(void) apr_dbm_close(apr_dbm_t *dbm)
+{
+ (*dbm->type->close)(dbm);
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t *pvalue)
+{
+ return (*dbm->type->fetch)(dbm, key, pvalue);
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_store(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t value)
+{
+ return (*dbm->type->store)(dbm, key, value);
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_delete(apr_dbm_t *dbm, apr_datum_t key)
+{
+ return (*dbm->type->del)(dbm, key);
+}
+
+APU_DECLARE(int) apr_dbm_exists(apr_dbm_t *dbm, apr_datum_t key)
+{
+ return (*dbm->type->exists)(dbm, key);
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey)
+{
+ return (*dbm->type->firstkey)(dbm, pkey);
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
+{
+ return (*dbm->type->nextkey)(dbm, pkey);
+}
+
+APU_DECLARE(void) apr_dbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
+{
+ (*dbm->type->freedatum)(dbm, data);
+}
+
+APU_DECLARE(char *) apr_dbm_geterror(apr_dbm_t *dbm, int *errcode,
+ char *errbuf, apr_size_t errbufsize)
+{
+ if (errcode != NULL)
+ *errcode = dbm->errcode;
+
+ /* assert: errbufsize > 0 */
+
+ if (dbm->errmsg == NULL)
+ *errbuf = '\0';
+ else
+ (void) apr_cpystrn(errbuf, dbm->errmsg, errbufsize);
+ return errbuf;
+}
+
+APU_DECLARE(apr_status_t) apr_dbm_get_usednames_ex(apr_pool_t *p,
+ const char *type,
+ const char *pathname,
+ const char **used1,
+ const char **used2)
+{
+#if APU_HAVE_GDBM
+ if (!strcasecmp(type, "GDBM")) {
+ (*apr_dbm_type_gdbm.getusednames)(p,pathname,used1,used2);
+ return APR_SUCCESS;
+ }
+#endif
+#if APU_HAVE_SDBM
+ if (!strcasecmp(type, "SDBM")) {
+ (*apr_dbm_type_sdbm.getusednames)(p,pathname,used1,used2);
+ return APR_SUCCESS;
+ }
+#endif
+#if APU_HAVE_DB
+ if (!strcasecmp(type, "DB")) {
+ (*apr_dbm_type_db.getusednames)(p,pathname,used1,used2);
+ return APR_SUCCESS;
+ }
+#endif
+#if APU_HAVE_NDBM
+ if (!strcasecmp(type, "NDBM")) {
+ (*apr_dbm_type_ndbm.getusednames)(p,pathname,used1,used2);
+ return APR_SUCCESS;
+ }
+#endif
+
+ if (!strcasecmp(type, "default")) {
+ (*DBM_VTABLE.getusednames)(p, pathname, used1, used2);
+ return APR_SUCCESS;
+ }
+
+ return APR_ENOTIMPL;
+}
+
+APU_DECLARE(void) apr_dbm_get_usednames(apr_pool_t *p,
+ const char *pathname,
+ const char **used1,
+ const char **used2)
+{
+ /* ### one day, a DBM type name will be passed and we'll need to look it
+ ### up. for now, it is constant. */
+
+ (*DBM_VTABLE.getusednames)(p, pathname, used1, used2);
+}
+
+/* Most DBM libraries take a POSIX mode for creating files. Don't trust
+ * the mode_t type, some platforms may not support it, int is safe.
+ */
+APU_DECLARE(int) apr_posix_perms2mode(apr_fileperms_t perm)
+{
+ int mode = 0;
+
+ mode |= 0700 & (perm >> 2); /* User is off-by-2 bits */
+ mode |= 0070 & (perm >> 1); /* Group is off-by-1 bit */
+ mode |= 0007 & (perm); /* World maps 1 for 1 */
+ return mode;
+}
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.lo
new file mode 100644
index 00000000..abd8588b
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.lo
@@ -0,0 +1,12 @@
+# apr_dbm.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/apr_dbm.o'
+
+# Name of the non-PIC object.
+non_pic_object='apr_dbm.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.o
new file mode 100644
index 00000000..7774ac7f
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.c
new file mode 100644
index 00000000..46ededcc
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.c
@@ -0,0 +1,403 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_strings.h"
+#define APR_WANT_MEMFUNC
+#include "apr_want.h"
+
+#define APU_WANT_DB
+#include "apu_want.h"
+
+#if APR_HAVE_STDLIB_H
+#include <stdlib.h> /* for abort() */
+#endif
+
+#include "apu.h"
+
+#if APU_HAVE_DB
+#include "apr_dbm_private.h"
+
+/*
+ * We pick up all varieties of Berkeley DB through db.h (included through
+ * apu_select_dbm.h). This code has been compiled/tested against DB1,
+ * DB_185, DB2, DB3, and DB4.
+ */
+
+#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4)
+/* We will treat anything greater than 4.1 as DB4.
+ * We can treat 4.0 as DB3.
+ */
+#if defined(DB_VERSION_MINOR) && (DB_VERSION_MINOR >= 1)
+#define DB_VER 4
+#else
+#define DB_VER 3
+#endif
+#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
+#define DB_VER 3
+#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2)
+#define DB_VER 2
+#else
+#define DB_VER 1
+#endif
+
+typedef struct {
+ DB *bdb;
+#if DB_VER != 1
+ DBC *curs;
+#endif
+} real_file_t;
+
+
+#if DB_VER == 1
+#define TXN_ARG
+#else
+#define TXN_ARG NULL,
+#endif
+
+#define GET_BDB(f) (((real_file_t *)(f))->bdb)
+
+#define do_fetch(bdb, k, v) ((*(bdb)->get)(bdb, TXN_ARG &(k), &(v), 0))
+
+#if DB_VER == 1
+#include <sys/fcntl.h>
+#define APR_DBM_DBMODE_RO O_RDONLY
+#define APR_DBM_DBMODE_RW O_RDWR
+#define APR_DBM_DBMODE_RWCREATE (O_CREAT | O_RDWR)
+#define APR_DBM_DBMODE_RWTRUNC (O_CREAT | O_RDWR | O_TRUNC)
+#else
+#define APR_DBM_DBMODE_RO DB_RDONLY
+#define APR_DBM_DBMODE_RW 0
+#define APR_DBM_DBMODE_RWCREATE DB_CREATE
+#define APR_DBM_DBMODE_RWTRUNC DB_TRUNCATE
+#endif /* DBVER == 1 */
+
+/* --------------------------------------------------------------------------
+**
+** UTILITY FUNCTIONS
+*/
+
+/* map a DB error to an apr_status_t */
+static apr_status_t db2s(int dberr)
+{
+ if (dberr != 0) {
+ /* ### need to fix this */
+ return APR_OS_START_USEERR + dberr;
+ }
+
+ return APR_SUCCESS;
+}
+
+
+static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
+{
+ apr_status_t rv = APR_SUCCESS;
+
+ /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
+
+ if (dbm_said == APR_SUCCESS) {
+ dbm->errcode = 0;
+ dbm->errmsg = NULL;
+ }
+ else {
+ /* ### need to fix. dberr was tossed in db2s(). */
+ /* ### use db_strerror() */
+ dbm->errcode = dbm_said;
+#if DB_VER == 1 || DB_VER == 2
+ dbm->errmsg = NULL;
+#else
+ dbm->errmsg = db_strerror(dbm_said - APR_OS_START_USEERR);
+#endif
+ rv = dbm_said;
+ }
+
+ return rv;
+}
+
+/* --------------------------------------------------------------------------
+**
+** DEFINE THE VTABLE FUNCTIONS FOR BERKELEY DB
+**
+** ### we may need three sets of these: db1, db2, db3
+*/
+
+static apr_status_t vt_db_open(apr_dbm_t **pdb, const char *pathname,
+ apr_int32_t mode, apr_fileperms_t perm,
+ apr_pool_t *pool)
+{
+ real_file_t file;
+ int dbmode;
+
+ *pdb = NULL;
+
+ switch (mode) {
+ case APR_DBM_READONLY:
+ dbmode = APR_DBM_DBMODE_RO;
+ break;
+ case APR_DBM_READWRITE:
+ dbmode = APR_DBM_DBMODE_RW;
+ break;
+ case APR_DBM_RWCREATE:
+ dbmode = APR_DBM_DBMODE_RWCREATE;
+ break;
+ case APR_DBM_RWTRUNC:
+ dbmode = APR_DBM_DBMODE_RWTRUNC;
+ break;
+ default:
+ return APR_EINVAL;
+ }
+
+ {
+ int dberr;
+
+#if DB_VER >= 3
+ if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) {
+ if ((dberr = (*file.bdb->open)(file.bdb,
+#if DB_VER == 4
+ NULL,
+#endif
+ pathname, NULL,
+ DB_HASH, dbmode,
+ apr_posix_perms2mode(perm))) != 0) {
+ /* close the DB handler */
+ (void) (*file.bdb->close)(file.bdb, 0);
+ }
+ }
+ file.curs = NULL;
+#elif DB_VER == 2
+ dberr = db_open(pathname, DB_HASH, dbmode, apr_posix_perms2mode(perm),
+ NULL, NULL, &file.bdb);
+ file.curs = NULL;
+#else
+ file.bdb = dbopen(pathname, dbmode, apr_posix_perms2mode(perm),
+ DB_HASH, NULL);
+ if (file.bdb == NULL)
+ return APR_EGENERAL; /* ### need a better error */
+ dberr = 0;
+#endif
+ if (dberr != 0)
+ return db2s(dberr);
+ }
+
+ /* we have an open database... return it */
+ *pdb = apr_pcalloc(pool, sizeof(**pdb));
+ (*pdb)->pool = pool;
+ (*pdb)->type = &apr_dbm_type_db;
+ (*pdb)->file = apr_pmemdup(pool, &file, sizeof(file));
+
+ /* ### register a cleanup to close the DBM? */
+
+ return APR_SUCCESS;
+}
+
+static void vt_db_close(apr_dbm_t *dbm)
+{
+ (*GET_BDB(dbm->file)->close)(GET_BDB(dbm->file)
+#if DB_VER != 1
+ , 0
+#endif
+ );
+}
+
+static apr_status_t vt_db_fetch(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t * pvalue)
+{
+ DBT ckey = { 0 };
+ DBT rd = { 0 };
+ int dberr;
+
+ ckey.data = key.dptr;
+ ckey.size = key.dsize;
+
+ dberr = do_fetch(GET_BDB(dbm->file), ckey, rd);
+
+ /* "not found" is not an error. return zero'd value. */
+ if (dberr ==
+#if DB_VER == 1
+ RET_SPECIAL
+#else
+ DB_NOTFOUND
+#endif
+ ) {
+ memset(&rd, 0, sizeof(rd));
+ dberr = 0;
+ }
+
+ pvalue->dptr = rd.data;
+ pvalue->dsize = rd.size;
+
+ /* store the error info into DBM, and return a status code. Also, note
+ that *pvalue should have been cleared on error. */
+ return set_error(dbm, db2s(dberr));
+}
+
+static apr_status_t vt_db_store(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t value)
+{
+ apr_status_t rv;
+ DBT ckey = { 0 };
+ DBT cvalue = { 0 };
+
+ ckey.data = key.dptr;
+ ckey.size = key.dsize;
+
+ cvalue.data = value.dptr;
+ cvalue.size = value.dsize;
+
+ rv = db2s((*GET_BDB(dbm->file)->put)(GET_BDB(dbm->file),
+ TXN_ARG
+ &ckey,
+ &cvalue,
+ 0));
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_db_del(apr_dbm_t *dbm, apr_datum_t key)
+{
+ apr_status_t rv;
+ DBT ckey = { 0 };
+
+ ckey.data = key.dptr;
+ ckey.size = key.dsize;
+
+ rv = db2s((*GET_BDB(dbm->file)->del)(GET_BDB(dbm->file),
+ TXN_ARG
+ &ckey,
+ 0));
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static int vt_db_exists(apr_dbm_t *dbm, apr_datum_t key)
+{
+ DBT ckey = { 0 }; /* converted key */
+ DBT data = { 0 };
+ int dberr;
+
+ ckey.data = key.dptr;
+ ckey.size = key.dsize;
+
+ dberr = do_fetch(GET_BDB(dbm->file), ckey, data);
+
+ /* note: the result data is "loaned" to us; we don't need to free it */
+
+ /* DB returns DB_NOTFOUND if it doesn't exist. but we want to say
+ that *any* error means it doesn't exist. */
+ return dberr == 0;
+}
+
+static apr_status_t vt_db_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ real_file_t *f = dbm->file;
+ DBT first = { 0 };
+ DBT data = { 0 };
+ int dberr;
+
+#if DB_VER == 1
+ dberr = (*f->bdb->seq)(f->bdb, &first, &data, R_FIRST);
+#else
+ if ((dberr = (*f->bdb->cursor)(f->bdb, NULL, &f->curs
+#if DB_VER >= 3 || ((DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5))
+ , 0
+#endif
+ )) == 0) {
+ dberr = (*f->curs->c_get)(f->curs, &first, &data, DB_FIRST);
+ if (dberr == DB_NOTFOUND) {
+ memset(&first, 0, sizeof(first));
+ (*f->curs->c_close)(f->curs);
+ f->curs = NULL;
+ dberr = 0;
+ }
+ }
+#endif
+
+ pkey->dptr = first.data;
+ pkey->dsize = first.size;
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, db2s(dberr));
+}
+
+static apr_status_t vt_db_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ real_file_t *f = dbm->file;
+ DBT ckey = { 0 };
+ DBT data = { 0 };
+ int dberr;
+
+ ckey.data = pkey->dptr;
+ ckey.size = pkey->dsize;
+
+#if DB_VER == 1
+ dberr = (*f->bdb->seq)(f->bdb, &ckey, &data, R_NEXT);
+ if (dberr == RET_SPECIAL) {
+ dberr = 0;
+ ckey.data = NULL;
+ ckey.size = 0;
+ }
+#else
+ if (f->curs == NULL)
+ return APR_EINVAL;
+
+ dberr = (*f->curs->c_get)(f->curs, &ckey, &data, DB_NEXT);
+ if (dberr == DB_NOTFOUND) {
+ (*f->curs->c_close)(f->curs);
+ f->curs = NULL;
+ dberr = 0;
+ ckey.data = NULL;
+ ckey.size = 0;
+ }
+#endif
+
+ pkey->dptr = ckey.data;
+ pkey->dsize = ckey.size;
+
+ /* store any error info into DBM, and return a status code. */
+ /* ### or use db2s(dberr) instead of APR_SUCCESS? */
+ return set_error(dbm, APR_SUCCESS);
+}
+
+static void vt_db_freedatum(apr_dbm_t *dbm, apr_datum_t data)
+{
+ /* nothing to do */
+}
+
+static void vt_db_usednames(apr_pool_t *pool, const char *pathname,
+ const char **used1, const char **used2)
+{
+ *used1 = apr_pstrdup(pool, pathname);
+ *used2 = NULL;
+}
+
+
+APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_db = {
+ "db",
+
+ vt_db_open,
+ vt_db_close,
+ vt_db_fetch,
+ vt_db_store,
+ vt_db_del,
+ vt_db_exists,
+ vt_db_firstkey,
+ vt_db_nextkey,
+ vt_db_freedatum,
+ vt_db_usednames
+};
+
+#endif /* APU_HAVE_DB */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.lo
new file mode 100644
index 00000000..9adf34db
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.lo
@@ -0,0 +1,12 @@
+# apr_dbm_berkeleydb.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/apr_dbm_berkeleydb.o'
+
+# Name of the non-PIC object.
+non_pic_object='apr_dbm_berkeleydb.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.o
new file mode 100644
index 00000000..a3529248
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_berkeleydb.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.c
new file mode 100644
index 00000000..93fb942a
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.c
@@ -0,0 +1,270 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_strings.h"
+
+#if APR_HAVE_STDLIB_H
+#include <stdlib.h> /* for free() */
+#endif
+
+#include "apu.h"
+
+#if APU_HAVE_GDBM
+#include "apr_dbm_private.h"
+
+#include <gdbm.h>
+
+/* this is used in a few places to define a noop "function". it is needed
+ to stop "no effect" warnings from GCC. */
+#define NOOP_FUNCTION if (0) ; else
+
+/* ### define defaults for now; these will go away in a while */
+#define REGISTER_CLEANUP(dbm, pdatum) NOOP_FUNCTION
+#define SET_FILE(pdb, f) ((pdb)->file = (f))
+
+typedef GDBM_FILE real_file_t;
+
+typedef datum *cvt_datum_t;
+#define CONVERT_DATUM(cvt, pinput) ((cvt) = (datum *)(pinput))
+
+typedef datum result_datum_t;
+#define RETURN_DATUM(poutput, rd) (*(poutput) = *(apr_datum_t *)&(rd))
+
+#define APR_DBM_CLOSE(f) gdbm_close(f)
+#define APR_DBM_FETCH(f, k, v) ((v) = gdbm_fetch(f, *(k)), APR_SUCCESS)
+#define APR_DBM_STORE(f, k, v) g2s(gdbm_store(f, *(k), *(v), GDBM_REPLACE))
+#define APR_DBM_DELETE(f, k) g2s(gdbm_delete(f, *(k)))
+#define APR_DBM_FIRSTKEY(f, k) ((k) = gdbm_firstkey(f), APR_SUCCESS)
+#define APR_DBM_NEXTKEY(f, k, nk) ((nk) = gdbm_nextkey(f, *(k)), APR_SUCCESS)
+#define APR_DBM_FREEDPTR(dptr) ((dptr) ? free(dptr) : 0)
+
+#undef REGISTER_CLEANUP
+#define REGISTER_CLEANUP(dbm, pdatum) \
+ if ((pdatum)->dptr) \
+ apr_pool_cleanup_register((dbm)->pool, (pdatum)->dptr, \
+ datum_cleanup, apr_pool_cleanup_null); \
+ else
+
+#define APR_DBM_DBMODE_RO GDBM_READER
+#define APR_DBM_DBMODE_RW GDBM_WRITER
+#define APR_DBM_DBMODE_RWCREATE GDBM_WRCREAT
+#define APR_DBM_DBMODE_RWTRUNC GDBM_NEWDB
+
+/* map a GDBM error to an apr_status_t */
+static apr_status_t g2s(int gerr)
+{
+ if (gerr == -1) {
+ /* ### need to fix this */
+ return APR_EGENERAL;
+ }
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t datum_cleanup(void *dptr)
+{
+ if (dptr)
+ free(dptr);
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
+{
+ apr_status_t rv = APR_SUCCESS;
+
+ /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
+
+ if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) {
+ dbm->errmsg = NULL;
+ }
+ else {
+ dbm->errmsg = gdbm_strerror(gdbm_errno);
+ rv = APR_EGENERAL; /* ### need something better */
+ }
+
+ /* captured it. clear it now. */
+ gdbm_errno = GDBM_NO_ERROR;
+
+ return rv;
+}
+
+/* --------------------------------------------------------------------------
+**
+** DEFINE THE VTABLE FUNCTIONS FOR GDBM
+*/
+
+static apr_status_t vt_gdbm_open(apr_dbm_t **pdb, const char *pathname,
+ apr_int32_t mode, apr_fileperms_t perm,
+ apr_pool_t *pool)
+{
+ real_file_t file;
+ int dbmode;
+
+ *pdb = NULL;
+
+ switch (mode) {
+ case APR_DBM_READONLY:
+ dbmode = APR_DBM_DBMODE_RO;
+ break;
+ case APR_DBM_READWRITE:
+ dbmode = APR_DBM_DBMODE_RW;
+ break;
+ case APR_DBM_RWCREATE:
+ dbmode = APR_DBM_DBMODE_RWCREATE;
+ break;
+ case APR_DBM_RWTRUNC:
+ dbmode = APR_DBM_DBMODE_RWTRUNC;
+ break;
+ default:
+ return APR_EINVAL;
+ }
+
+ {
+ /* Note: stupid cast to get rid of "const" on the pathname */
+ file = gdbm_open((char *) pathname, 0, dbmode,
+ apr_posix_perms2mode(perm), NULL);
+ if (file == NULL)
+ return APR_EGENERAL; /* ### need a better error */
+ }
+
+ /* we have an open database... return it */
+ *pdb = apr_pcalloc(pool, sizeof(**pdb));
+ (*pdb)->pool = pool;
+ (*pdb)->type = &apr_dbm_type_gdbm;
+ SET_FILE(*pdb, file);
+
+ /* ### register a cleanup to close the DBM? */
+
+ return APR_SUCCESS;
+}
+
+static void vt_gdbm_close(apr_dbm_t *dbm)
+{
+ APR_DBM_CLOSE(dbm->file);
+}
+
+static apr_status_t vt_gdbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t * pvalue)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+ result_datum_t rd;
+
+ CONVERT_DATUM(ckey, &key);
+ rv = APR_DBM_FETCH(dbm->file, ckey, rd);
+ RETURN_DATUM(pvalue, rd);
+
+ REGISTER_CLEANUP(dbm, pvalue);
+
+ /* store the error info into DBM, and return a status code. Also, note
+ that *pvalue should have been cleared on error. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_gdbm_store(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t value)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+ cvt_datum_t cvalue;
+
+ CONVERT_DATUM(ckey, &key);
+ CONVERT_DATUM(cvalue, &value);
+ rv = APR_DBM_STORE(dbm->file, ckey, cvalue);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_gdbm_del(apr_dbm_t *dbm, apr_datum_t key)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+
+ CONVERT_DATUM(ckey, &key);
+ rv = APR_DBM_DELETE(dbm->file, ckey);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static int vt_gdbm_exists(apr_dbm_t *dbm, apr_datum_t key)
+{
+ datum *ckey = (datum *)&key;
+
+ return gdbm_exists(dbm->file, *ckey) != 0;
+}
+
+static apr_status_t vt_gdbm_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ apr_status_t rv;
+ result_datum_t rd;
+
+ rv = APR_DBM_FIRSTKEY(dbm->file, rd);
+ RETURN_DATUM(pkey, rd);
+
+ REGISTER_CLEANUP(dbm, pkey);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+ result_datum_t rd;
+
+ CONVERT_DATUM(ckey, pkey);
+ rv = APR_DBM_NEXTKEY(dbm->file, ckey, rd);
+ RETURN_DATUM(pkey, rd);
+
+ REGISTER_CLEANUP(dbm, pkey);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, APR_SUCCESS);
+}
+
+static void vt_gdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
+{
+ (void) apr_pool_cleanup_run(dbm->pool, data.dptr, datum_cleanup);
+}
+
+static void vt_gdbm_usednames(apr_pool_t *pool, const char *pathname,
+ const char **used1, const char **used2)
+{
+ *used1 = apr_pstrdup(pool, pathname);
+ *used2 = NULL;
+}
+
+
+APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_gdbm = {
+ "gdbm",
+
+ vt_gdbm_open,
+ vt_gdbm_close,
+ vt_gdbm_fetch,
+ vt_gdbm_store,
+ vt_gdbm_del,
+ vt_gdbm_exists,
+ vt_gdbm_firstkey,
+ vt_gdbm_nextkey,
+ vt_gdbm_freedatum,
+ vt_gdbm_usednames
+};
+
+#endif /* APU_HAVE_GDBM */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.lo
new file mode 100644
index 00000000..994b4437
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.lo
@@ -0,0 +1,12 @@
+# apr_dbm_gdbm.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/apr_dbm_gdbm.o'
+
+# Name of the non-PIC object.
+non_pic_object='apr_dbm_gdbm.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.o
new file mode 100644
index 00000000..5363f549
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_gdbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.c
new file mode 100644
index 00000000..d770ed44
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.c
@@ -0,0 +1,227 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_strings.h"
+
+#if APR_HAVE_STDLIB_H
+#include <stdlib.h> /* for free() */
+#endif
+
+#include "apu.h"
+
+#if APU_HAVE_NDBM
+#include "apr_dbm_private.h"
+
+#include <ndbm.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+/* this is used in a few places to define a noop "function". it is needed
+ to stop "no effect" warnings from GCC. */
+#define NOOP_FUNCTION if (0) ; else
+
+#define APR_DBM_DBMODE_RO O_RDONLY
+#define APR_DBM_DBMODE_RW O_RDWR
+#define APR_DBM_DBMODE_RWCREATE (O_RDWR|O_CREAT)
+#define APR_DBM_DBMODE_RWTRUNC (O_RDWR|O_CREAT|O_TRUNC)
+
+/* map a NDBM error to an apr_status_t */
+static apr_status_t ndbm2s(int ndbmerr)
+{
+ if (ndbmerr == -1) {
+ /* ### need to fix this */
+ return APR_EGENERAL;
+ }
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
+{
+ apr_status_t rv = APR_SUCCESS;
+
+ /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
+
+ dbm->errmsg = NULL;
+ if (dbm_error((DBM*)dbm->file)) {
+ dbm->errmsg = NULL;
+ rv = APR_EGENERAL; /* ### need something better */
+ }
+
+ /* captured it. clear it now. */
+ dbm_clearerr((DBM*)dbm->file);
+
+ return rv;
+}
+
+/* --------------------------------------------------------------------------
+**
+** DEFINE THE VTABLE FUNCTIONS FOR NDBM
+*/
+
+static apr_status_t vt_ndbm_open(apr_dbm_t **pdb, const char *pathname,
+ apr_int32_t mode, apr_fileperms_t perm,
+ apr_pool_t *pool)
+{
+ DBM *file;
+ int dbmode;
+
+ *pdb = NULL;
+
+ switch (mode) {
+ case APR_DBM_READONLY:
+ dbmode = APR_DBM_DBMODE_RO;
+ break;
+ case APR_DBM_READWRITE:
+ dbmode = APR_DBM_DBMODE_RW;
+ break;
+ case APR_DBM_RWCREATE:
+ dbmode = APR_DBM_DBMODE_RWCREATE;
+ break;
+ case APR_DBM_RWTRUNC:
+ dbmode = APR_DBM_DBMODE_RWTRUNC;
+ break;
+ default:
+ return APR_EINVAL;
+ }
+
+ {
+ file = dbm_open(pathname, dbmode, apr_posix_perms2mode(perm));
+ if (file == NULL)
+ return APR_EGENERAL; /* ### need a better error */
+ }
+
+ /* we have an open database... return it */
+ *pdb = apr_pcalloc(pool, sizeof(**pdb));
+ (*pdb)->pool = pool;
+ (*pdb)->type = &apr_dbm_type_ndbm;
+ (*pdb)->file = file;
+
+ /* ### register a cleanup to close the DBM? */
+
+ return APR_SUCCESS;
+}
+
+static void vt_ndbm_close(apr_dbm_t *dbm)
+{
+ dbm_close(dbm->file);
+}
+
+static apr_status_t vt_ndbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t * pvalue)
+{
+ datum *ckey;
+ datum rd;
+
+ ckey = (datum*)&key;
+ rd = dbm_fetch(dbm->file, *ckey);
+ *pvalue = *(apr_datum_t*)&rd;
+
+ /* store the error info into DBM, and return a status code. Also, note
+ that *pvalue should have been cleared on error. */
+ return set_error(dbm, APR_SUCCESS);
+}
+
+static apr_status_t vt_ndbm_store(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t value)
+{
+ apr_status_t rv;
+ datum *ckey;
+ datum *cvalue;
+
+ ckey = (datum*)&key;
+ cvalue = (datum*)&value;
+ rv = ndbm2s( dbm_store( dbm->file, *ckey, *cvalue, DBM_REPLACE));
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_ndbm_del(apr_dbm_t *dbm, apr_datum_t key)
+{
+ apr_status_t rv;
+ datum *ckey;
+
+ ckey = (datum*)&key;
+ rv = ndbm2s( dbm_delete(dbm->file, *ckey));
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static int vt_ndbm_exists(apr_dbm_t *dbm, apr_datum_t key)
+{
+ datum *ckey = (datum *)&key;
+ datum value;
+
+ value = dbm_fetch( dbm->file, *ckey);
+
+ return value.dptr != NULL;
+}
+
+static apr_status_t vt_ndbm_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ datum rd;
+
+ rd = dbm_firstkey(dbm->file);
+ *pkey = *(apr_datum_t*)&rd;
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, APR_SUCCESS);
+}
+
+static apr_status_t vt_ndbm_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ datum *ckey;
+ datum rd;
+
+ ckey = (datum*)pkey;
+ rd = dbm_nextkey(dbm->file);
+ *pkey = *(apr_datum_t*)&rd;
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, APR_SUCCESS);
+}
+
+static void vt_ndbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
+{
+ /* nothing to do */
+}
+
+static void vt_ndbm_usednames(apr_pool_t *pool, const char *pathname,
+ const char **used1, const char **used2)
+{
+ *used1 = apr_pstrdup(pool, pathname);
+ *used2 = NULL;
+}
+
+
+APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_ndbm = {
+ "ndbm",
+
+ vt_ndbm_open,
+ vt_ndbm_close,
+ vt_ndbm_fetch,
+ vt_ndbm_store,
+ vt_ndbm_del,
+ vt_ndbm_exists,
+ vt_ndbm_firstkey,
+ vt_ndbm_nextkey,
+ vt_ndbm_freedatum,
+ vt_ndbm_usednames
+};
+#endif /* APU_HAVE_NDBM */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.lo
new file mode 100644
index 00000000..62174ed5
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.lo
@@ -0,0 +1,12 @@
+# apr_dbm_ndbm.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/apr_dbm_ndbm.o'
+
+# Name of the non-PIC object.
+non_pic_object='apr_dbm_ndbm.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.o
new file mode 100644
index 00000000..70d457d0
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_ndbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.c
new file mode 100644
index 00000000..dadb1e26
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.c
@@ -0,0 +1,265 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_strings.h"
+#define APR_WANT_MEMFUNC
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "apu.h"
+
+#if APU_HAVE_SDBM
+
+#include "apr_dbm_private.h"
+
+#include "apr_sdbm.h"
+#if APR_HAVE_STDLIB_H
+#include <stdlib.h> /* For abort() */
+#endif
+
+/* this is used in a few places to define a noop "function". it is needed
+ to stop "no effect" warnings from GCC. */
+#define NOOP_FUNCTION if (0) ; else
+
+/* ### define defaults for now; these will go away in a while */
+#define REGISTER_CLEANUP(dbm, pdatum) NOOP_FUNCTION
+#define SET_FILE(pdb, f) ((pdb)->file = (f))
+
+typedef apr_sdbm_t *real_file_t;
+
+typedef apr_sdbm_datum_t cvt_datum_t;
+#define CONVERT_DATUM(cvt, pinput) ((cvt).dptr = (pinput)->dptr, (cvt).dsize = (pinput)->dsize)
+
+typedef apr_sdbm_datum_t result_datum_t;
+#define RETURN_DATUM(poutput, rd) ((poutput)->dptr = (rd).dptr, (poutput)->dsize = (rd).dsize)
+
+#define APR_DBM_CLOSE(f) apr_sdbm_close(f)
+#define APR_DBM_FETCH(f, k, v) apr_sdbm_fetch(f, &(v), (k))
+#define APR_DBM_STORE(f, k, v) apr_sdbm_store(f, (k), (v), APR_SDBM_REPLACE)
+#define APR_DBM_DELETE(f, k) apr_sdbm_delete(f, (k))
+#define APR_DBM_FIRSTKEY(f, k) apr_sdbm_firstkey(f, &(k))
+#define APR_DBM_NEXTKEY(f, k, nk) apr_sdbm_nextkey(f, &(nk))
+#define APR_DBM_FREEDPTR(dptr) NOOP_FUNCTION
+
+#define APR_DBM_DBMODE_RO APR_READ
+#define APR_DBM_DBMODE_RW (APR_READ | APR_WRITE)
+#define APR_DBM_DBMODE_RWCREATE (APR_READ | APR_WRITE | APR_CREATE)
+#define APR_DBM_DBMODE_RWTRUNC (APR_READ | APR_WRITE | APR_CREATE | \
+ APR_TRUNCATE)
+
+static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
+{
+ apr_status_t rv = APR_SUCCESS;
+
+ /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
+
+ if ((dbm->errcode = dbm_said) == APR_SUCCESS) {
+ dbm->errmsg = NULL;
+ }
+ else {
+ dbm->errmsg = "I/O error occurred.";
+ rv = APR_EGENERAL; /* ### need something better */
+ }
+
+ return rv;
+}
+
+/* --------------------------------------------------------------------------
+**
+** DEFINE THE VTABLE FUNCTIONS FOR SDBM
+*/
+
+static apr_status_t vt_sdbm_open(apr_dbm_t **pdb, const char *pathname,
+ apr_int32_t mode, apr_fileperms_t perm,
+ apr_pool_t *pool)
+{
+ real_file_t file;
+ int dbmode;
+
+ *pdb = NULL;
+
+ switch (mode) {
+ case APR_DBM_READONLY:
+ dbmode = APR_DBM_DBMODE_RO;
+ break;
+ case APR_DBM_READWRITE:
+ dbmode = APR_DBM_DBMODE_RW;
+ break;
+ case APR_DBM_RWCREATE:
+ dbmode = APR_DBM_DBMODE_RWCREATE;
+ break;
+ case APR_DBM_RWTRUNC:
+ dbmode = APR_DBM_DBMODE_RWTRUNC;
+ break;
+ default:
+ return APR_EINVAL;
+ }
+
+ {
+ apr_status_t rv;
+
+ rv = apr_sdbm_open(&file, pathname, dbmode, perm, pool);
+ if (rv != APR_SUCCESS)
+ return rv;
+ }
+
+ /* we have an open database... return it */
+ *pdb = apr_pcalloc(pool, sizeof(**pdb));
+ (*pdb)->pool = pool;
+ (*pdb)->type = &apr_dbm_type_sdbm;
+ SET_FILE(*pdb, file);
+
+ /* ### register a cleanup to close the DBM? */
+
+ return APR_SUCCESS;
+}
+
+static void vt_sdbm_close(apr_dbm_t *dbm)
+{
+ APR_DBM_CLOSE(dbm->file);
+}
+
+static apr_status_t vt_sdbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t * pvalue)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+ result_datum_t rd;
+
+ CONVERT_DATUM(ckey, &key);
+ rv = APR_DBM_FETCH(dbm->file, ckey, rd);
+ RETURN_DATUM(pvalue, rd);
+
+ REGISTER_CLEANUP(dbm, pvalue);
+
+ /* store the error info into DBM, and return a status code. Also, note
+ that *pvalue should have been cleared on error. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_sdbm_store(apr_dbm_t *dbm, apr_datum_t key,
+ apr_datum_t value)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+ cvt_datum_t cvalue;
+
+ CONVERT_DATUM(ckey, &key);
+ CONVERT_DATUM(cvalue, &value);
+ rv = APR_DBM_STORE(dbm->file, ckey, cvalue);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_sdbm_del(apr_dbm_t *dbm, apr_datum_t key)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+
+ CONVERT_DATUM(ckey, &key);
+ rv = APR_DBM_DELETE(dbm->file, ckey);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static int vt_sdbm_exists(apr_dbm_t *dbm, apr_datum_t key)
+{
+ int exists;
+ apr_sdbm_datum_t ckey;
+
+ CONVERT_DATUM(ckey, &key);
+
+ {
+ apr_sdbm_datum_t value;
+ if (apr_sdbm_fetch(dbm->file, &value, ckey) != APR_SUCCESS) {
+ exists = 0;
+ }
+ else
+ exists = value.dptr != NULL;
+ }
+
+ return exists;
+}
+
+static apr_status_t vt_sdbm_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ apr_status_t rv;
+ result_datum_t rd;
+
+ rv = APR_DBM_FIRSTKEY(dbm->file, rd);
+ RETURN_DATUM(pkey, rd);
+
+ REGISTER_CLEANUP(dbm, pkey);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, rv);
+}
+
+static apr_status_t vt_sdbm_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey)
+{
+ apr_status_t rv;
+ cvt_datum_t ckey;
+ result_datum_t rd;
+
+ CONVERT_DATUM(ckey, pkey);
+ rv = APR_DBM_NEXTKEY(dbm->file, ckey, rd);
+ RETURN_DATUM(pkey, rd);
+
+ REGISTER_CLEANUP(dbm, pkey);
+
+ /* store any error info into DBM, and return a status code. */
+ return set_error(dbm, APR_SUCCESS);
+}
+
+static void vt_sdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
+{
+ APR_DBM_FREEDPTR(data.dptr);
+}
+
+static void vt_sdbm_usednames(apr_pool_t *pool, const char *pathname,
+ const char **used1, const char **used2)
+{
+ char *work;
+
+ /* ### this could be optimized by computing strlen() once and using
+ ### memcpy and pmemdup instead. but why bother? */
+
+ *used1 = apr_pstrcat(pool, pathname, APR_SDBM_DIRFEXT, NULL);
+ *used2 = work = apr_pstrdup(pool, *used1);
+
+ /* we know the extension is 4 characters */
+ memcpy(&work[strlen(work) - 4], APR_SDBM_PAGFEXT, 4);
+}
+
+
+APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_sdbm = {
+ "sdbm",
+
+ vt_sdbm_open,
+ vt_sdbm_close,
+ vt_sdbm_fetch,
+ vt_sdbm_store,
+ vt_sdbm_del,
+ vt_sdbm_exists,
+ vt_sdbm_firstkey,
+ vt_sdbm_nextkey,
+ vt_sdbm_freedatum,
+ vt_sdbm_usednames
+};
+
+#endif /* APU_HAVE_SDBM */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.lo
new file mode 100644
index 00000000..e22b6de6
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.lo
@@ -0,0 +1,12 @@
+# apr_dbm_sdbm.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/apr_dbm_sdbm.o'
+
+# Name of the non-PIC object.
+non_pic_object='apr_dbm_sdbm.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.o
new file mode 100644
index 00000000..e87fb9a3
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/apr_dbm_sdbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm.o
new file mode 100644
index 00000000..6ace2b94
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_hash.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_hash.o
new file mode 100644
index 00000000..d1806982
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_hash.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_lock.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_lock.o
new file mode 100644
index 00000000..9e12c1f1
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_lock.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_pair.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_pair.o
new file mode 100644
index 00000000..50e32223
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/.libs/sdbm_pair.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile
new file mode 100644
index 00000000..8167095c
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile
@@ -0,0 +1,8 @@
+
+
+INCLUDES = -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/include -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/include/private -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr/include -I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib
+
+TARGETS = sdbm.lo sdbm_hash.lo sdbm_lock.lo sdbm_pair.lo
+
+# bring in rules.mk for standard functionality
+include /bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/build/rules.mk
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile.in b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile.in
new file mode 100644
index 00000000..3b1a9c9c
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/Makefile.in
@@ -0,0 +1,8 @@
+VPATH = @srcdir@
+
+INCLUDES = @APRUTIL_PRIV_INCLUDES@ @APR_INCLUDES@ @APRUTIL_INCLUDES@
+
+TARGETS = sdbm.lo sdbm_hash.lo sdbm_lock.lo sdbm_pair.lo
+
+# bring in rules.mk for standard functionality
+@INCLUDE_RULES@
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.c
new file mode 100644
index 00000000..537a5b72
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.c
@@ -0,0 +1,588 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * sdbm - ndbm work-alike hashed database library
+ * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
+ * author: oz@nexus.yorku.ca
+ * ex-public domain, ported to APR for Apache 2
+ * core routines
+ */
+
+#include "apr.h"
+#include "apr_file_io.h"
+#include "apr_strings.h"
+#include "apr_errno.h"
+#include "apr_sdbm.h"
+
+#include "sdbm_tune.h"
+#include "sdbm_pair.h"
+#include "sdbm_private.h"
+
+#include <string.h> /* for memset() */
+#include <stdlib.h> /* for malloc() and free() */
+
+/*
+ * forward
+ */
+static int getdbit (apr_sdbm_t *, long);
+static apr_status_t setdbit(apr_sdbm_t *, long);
+static apr_status_t getpage(apr_sdbm_t *db, long);
+static apr_status_t getnext(apr_sdbm_datum_t *key, apr_sdbm_t *db);
+static apr_status_t makroom(apr_sdbm_t *, long, int);
+
+/*
+ * useful macros
+ */
+#define bad(x) ((x).dptr == NULL || (x).dsize <= 0)
+#define exhash(item) sdbm_hash((item).dptr, (item).dsize)
+
+/* ### Does anything need these externally? */
+#define sdbm_dirfno(db) ((db)->dirf)
+#define sdbm_pagfno(db) ((db)->pagf)
+
+#define OFF_PAG(off) (apr_off_t) (off) * PBLKSIZ
+#define OFF_DIR(off) (apr_off_t) (off) * DBLKSIZ
+
+static long masks[] = {
+ 000000000000, 000000000001, 000000000003, 000000000007,
+ 000000000017, 000000000037, 000000000077, 000000000177,
+ 000000000377, 000000000777, 000000001777, 000000003777,
+ 000000007777, 000000017777, 000000037777, 000000077777,
+ 000000177777, 000000377777, 000000777777, 000001777777,
+ 000003777777, 000007777777, 000017777777, 000037777777,
+ 000077777777, 000177777777, 000377777777, 000777777777,
+ 001777777777, 003777777777, 007777777777, 017777777777
+};
+
+const apr_sdbm_datum_t sdbm_nullitem = { NULL, 0 };
+
+static apr_status_t database_cleanup(void *data)
+{
+ apr_sdbm_t *db = data;
+
+ /*
+ * Can't rely on apr_sdbm_unlock, since it will merely
+ * decrement the refcnt if several locks are held.
+ */
+ if (db->flags & (SDBM_SHARED_LOCK | SDBM_EXCLUSIVE_LOCK))
+ (void) apr_file_unlock(db->dirf);
+ (void) apr_file_close(db->dirf);
+ (void) apr_file_close(db->pagf);
+ free(db);
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t prep(apr_sdbm_t **pdb, const char *dirname, const char *pagname,
+ apr_int32_t flags, apr_fileperms_t perms, apr_pool_t *p)
+{
+ apr_sdbm_t *db;
+ apr_status_t status;
+
+ *pdb = NULL;
+
+ db = malloc(sizeof(*db));
+ memset(db, 0, sizeof(*db));
+
+ db->pool = p;
+
+ /*
+ * adjust user flags so that WRONLY becomes RDWR,
+ * as required by this package. Also set our internal
+ * flag for RDONLY if needed.
+ */
+ if (!(flags & APR_WRITE)) {
+ db->flags |= SDBM_RDONLY;
+ }
+
+ /*
+ * adjust the file open flags so that we handle locking
+ * on our own (don't rely on any locking behavior within
+ * an apr_file_t, in case it's ever introduced, and set
+ * our own flag.
+ */
+ if (flags & APR_SHARELOCK) {
+ db->flags |= SDBM_SHARED;
+ flags &= ~APR_SHARELOCK;
+ }
+
+ flags |= APR_BINARY | APR_READ;
+
+ /*
+ * open the files in sequence, and stat the dirfile.
+ * If we fail anywhere, undo everything, return NULL.
+ */
+
+ if ((status = apr_file_open(&db->dirf, dirname, flags, perms, p))
+ != APR_SUCCESS)
+ goto error;
+
+ if ((status = apr_file_open(&db->pagf, pagname, flags, perms, p))
+ != APR_SUCCESS)
+ goto error;
+
+ if ((status = apr_sdbm_lock(db, (db->flags & SDBM_RDONLY)
+ ? APR_FLOCK_SHARED
+ : APR_FLOCK_EXCLUSIVE))
+ != APR_SUCCESS)
+ goto error;
+
+ /* apr_pcalloc zeroed the buffers
+ * apr_sdbm_lock stated the dirf->size and invalidated the cache
+ */
+
+ /*
+ * if we are opened in SHARED mode, unlock ourself
+ */
+ if (db->flags & SDBM_SHARED)
+ if ((status = apr_sdbm_unlock(db)) != APR_SUCCESS)
+ goto error;
+
+ /* make sure that we close the database at some point */
+ apr_pool_cleanup_register(p, db, database_cleanup, apr_pool_cleanup_null);
+
+ /* Done! */
+ *pdb = db;
+ return APR_SUCCESS;
+
+error:
+ if (db->dirf && db->pagf)
+ (void) apr_sdbm_unlock(db);
+ if (db->dirf != NULL)
+ (void) apr_file_close(db->dirf);
+ if (db->pagf != NULL) {
+ (void) apr_file_close(db->pagf);
+ }
+ free(db);
+ return status;
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_open(apr_sdbm_t **db, const char *file,
+ apr_int32_t flags,
+ apr_fileperms_t perms, apr_pool_t *p)
+{
+ char *dirname = apr_pstrcat(p, file, APR_SDBM_DIRFEXT, NULL);
+ char *pagname = apr_pstrcat(p, file, APR_SDBM_PAGFEXT, NULL);
+
+ return prep(db, dirname, pagname, flags, perms, p);
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db)
+{
+ return apr_pool_cleanup_run(db->pool, db, database_cleanup);
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db, apr_sdbm_datum_t *val,
+ apr_sdbm_datum_t key)
+{
+ apr_status_t status;
+
+ if (db == NULL || bad(key))
+ return APR_EINVAL;
+
+ if ((status = apr_sdbm_lock(db, APR_FLOCK_SHARED)) != APR_SUCCESS)
+ return status;
+
+ if ((status = getpage(db, exhash(key))) == APR_SUCCESS) {
+ *val = getpair(db->pagbuf, key);
+ /* ### do we want a not-found result? */
+ }
+
+ (void) apr_sdbm_unlock(db);
+
+ return status;
+}
+
+static apr_status_t write_page(apr_sdbm_t *db, const char *buf, long pagno)
+{
+ apr_status_t status;
+ apr_off_t off = OFF_PAG(pagno);
+
+ if ((status = apr_file_seek(db->pagf, APR_SET, &off)) == APR_SUCCESS)
+ status = apr_file_write_full(db->pagf, buf, PBLKSIZ, NULL);
+
+ return status;
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db,
+ const apr_sdbm_datum_t key)
+{
+ apr_status_t status;
+
+ if (db == NULL || bad(key))
+ return APR_EINVAL;
+ if (apr_sdbm_rdonly(db))
+ return APR_EINVAL;
+
+ if ((status = apr_sdbm_lock(db, APR_FLOCK_EXCLUSIVE)) != APR_SUCCESS)
+ return status;
+
+ if ((status = getpage(db, exhash(key))) == APR_SUCCESS) {
+ if (!delpair(db->pagbuf, key))
+ /* ### should we define some APRUTIL codes? */
+ status = APR_EGENERAL;
+ else
+ status = write_page(db, db->pagbuf, db->pagbno);
+ }
+
+ (void) apr_sdbm_unlock(db);
+
+ return status;
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key,
+ apr_sdbm_datum_t val, int flags)
+{
+ int need;
+ register long hash;
+ apr_status_t status;
+
+ if (db == NULL || bad(key))
+ return APR_EINVAL;
+ if (apr_sdbm_rdonly(db))
+ return APR_EINVAL;
+ need = key.dsize + val.dsize;
+ /*
+ * is the pair too big (or too small) for this database ??
+ */
+ if (need < 0 || need > PAIRMAX)
+ return APR_EINVAL;
+
+ if ((status = apr_sdbm_lock(db, APR_FLOCK_EXCLUSIVE)) != APR_SUCCESS)
+ return status;
+
+ if ((status = getpage(db, (hash = exhash(key)))) == APR_SUCCESS) {
+
+ /*
+ * if we need to replace, delete the key/data pair
+ * first. If it is not there, ignore.
+ */
+ if (flags == APR_SDBM_REPLACE)
+ (void) delpair(db->pagbuf, key);
+ else if (!(flags & APR_SDBM_INSERTDUP) && duppair(db->pagbuf, key)) {
+ status = APR_EEXIST;
+ goto error;
+ }
+ /*
+ * if we do not have enough room, we have to split.
+ */
+ if (!fitpair(db->pagbuf, need))
+ if ((status = makroom(db, hash, need)) != APR_SUCCESS)
+ goto error;
+ /*
+ * we have enough room or split is successful. insert the key,
+ * and update the page file.
+ */
+ (void) putpair(db->pagbuf, key, val);
+
+ status = write_page(db, db->pagbuf, db->pagbno);
+ }
+
+error:
+ (void) apr_sdbm_unlock(db);
+
+ return status;
+}
+
+/*
+ * makroom - make room by splitting the overfull page
+ * this routine will attempt to make room for SPLTMAX times before
+ * giving up.
+ */
+static apr_status_t makroom(apr_sdbm_t *db, long hash, int need)
+{
+ long newp;
+ char twin[PBLKSIZ];
+ char *pag = db->pagbuf;
+ char *new = twin;
+ register int smax = SPLTMAX;
+ apr_status_t status;
+
+ do {
+ /*
+ * split the current page
+ */
+ (void) splpage(pag, new, db->hmask + 1);
+ /*
+ * address of the new page
+ */
+ newp = (hash & db->hmask) | (db->hmask + 1);
+
+ /*
+ * write delay, read avoidence/cache shuffle:
+ * select the page for incoming pair: if key is to go to the new page,
+ * write out the previous one, and copy the new one over, thus making
+ * it the current page. If not, simply write the new page, and we are
+ * still looking at the page of interest. current page is not updated
+ * here, as sdbm_store will do so, after it inserts the incoming pair.
+ */
+ if (hash & (db->hmask + 1)) {
+ if ((status = write_page(db, db->pagbuf, db->pagbno))
+ != APR_SUCCESS)
+ return status;
+
+ db->pagbno = newp;
+ (void) memcpy(pag, new, PBLKSIZ);
+ }
+ else {
+ if ((status = write_page(db, new, newp)) != APR_SUCCESS)
+ return status;
+ }
+
+ if ((status = setdbit(db, db->curbit)) != APR_SUCCESS)
+ return status;
+ /*
+ * see if we have enough room now
+ */
+ if (fitpair(pag, need))
+ return APR_SUCCESS;
+ /*
+ * try again... update curbit and hmask as getpage would have
+ * done. because of our update of the current page, we do not
+ * need to read in anything. BUT we have to write the current
+ * [deferred] page out, as the window of failure is too great.
+ */
+ db->curbit = 2 * db->curbit
+ + ((hash & (db->hmask + 1)) ? 2 : 1);
+ db->hmask |= db->hmask + 1;
+
+ if ((status = write_page(db, db->pagbuf, db->pagbno))
+ != APR_SUCCESS)
+ return status;
+
+ } while (--smax);
+
+ /*
+ * if we are here, this is real bad news. After SPLTMAX splits,
+ * we still cannot fit the key. say goodnight.
+ */
+#if 0
+ (void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44);
+#endif
+ /* ### ENOSPC not really appropriate but better than nothing */
+ return APR_ENOSPC;
+
+}
+
+/* Reads 'len' bytes from file 'f' at offset 'off' into buf.
+ * 'off' is given relative to the start of the file.
+ * If EOF is returned while reading, this is taken as success.
+ */
+static apr_status_t read_from(apr_file_t *f, void *buf,
+ apr_off_t off, apr_size_t len)
+{
+ apr_status_t status;
+
+ if ((status = apr_file_seek(f, APR_SET, &off)) != APR_SUCCESS ||
+ ((status = apr_file_read_full(f, buf, len, NULL)) != APR_SUCCESS)) {
+ /* if EOF is reached, pretend we read all zero's */
+ if (status == APR_EOF) {
+ memset(buf, 0, len);
+ status = APR_SUCCESS;
+ }
+ }
+
+ return status;
+}
+
+/*
+ * the following two routines will break if
+ * deletions aren't taken into account. (ndbm bug)
+ */
+APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db,
+ apr_sdbm_datum_t *key)
+{
+ apr_status_t status;
+
+ if ((status = apr_sdbm_lock(db, APR_FLOCK_SHARED)) != APR_SUCCESS)
+ return status;
+
+ /*
+ * start at page 0
+ */
+ if ((status = read_from(db->pagf, db->pagbuf, OFF_PAG(0), PBLKSIZ))
+ == APR_SUCCESS) {
+ db->pagbno = 0;
+ db->blkptr = 0;
+ db->keyptr = 0;
+ status = getnext(key, db);
+ }
+
+ (void) apr_sdbm_unlock(db);
+
+ return status;
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db,
+ apr_sdbm_datum_t *key)
+{
+ apr_status_t status;
+
+ if ((status = apr_sdbm_lock(db, APR_FLOCK_SHARED)) != APR_SUCCESS)
+ return status;
+
+ status = getnext(key, db);
+
+ (void) apr_sdbm_unlock(db);
+
+ return status;
+}
+
+/*
+ * all important binary tree traversal
+ */
+static apr_status_t getpage(apr_sdbm_t *db, long hash)
+{
+ register int hbit;
+ register long dbit;
+ register long pagb;
+ apr_status_t status;
+
+ dbit = 0;
+ hbit = 0;
+ while (dbit < db->maxbno && getdbit(db, dbit))
+ dbit = 2 * dbit + ((hash & (1 << hbit++)) ? 2 : 1);
+
+ debug(("dbit: %d...", dbit));
+
+ db->curbit = dbit;
+ db->hmask = masks[hbit];
+
+ pagb = hash & db->hmask;
+ /*
+ * see if the block we need is already in memory.
+ * note: this lookaside cache has about 10% hit rate.
+ */
+ if (pagb != db->pagbno) {
+ /*
+ * note: here, we assume a "hole" is read as 0s.
+ * if not, must zero pagbuf first.
+ * ### joe: this assumption was surely never correct? but
+ * ### we make it so in read_from anyway.
+ */
+ if ((status = read_from(db->pagf, db->pagbuf, OFF_PAG(pagb), PBLKSIZ))
+ != APR_SUCCESS)
+ return status;
+
+ if (!chkpage(db->pagbuf))
+ return APR_ENOSPC; /* ### better error? */
+ db->pagbno = pagb;
+
+ debug(("pag read: %d\n", pagb));
+ }
+ return APR_SUCCESS;
+}
+
+static int getdbit(apr_sdbm_t *db, long dbit)
+{
+ register long c;
+ register long dirb;
+
+ c = dbit / BYTESIZ;
+ dirb = c / DBLKSIZ;
+
+ if (dirb != db->dirbno) {
+ if (read_from(db->dirf, db->dirbuf, OFF_DIR(dirb), DBLKSIZ)
+ != APR_SUCCESS)
+ return 0;
+
+ db->dirbno = dirb;
+
+ debug(("dir read: %d\n", dirb));
+ }
+
+ return db->dirbuf[c % DBLKSIZ] & (1 << dbit % BYTESIZ);
+}
+
+static apr_status_t setdbit(apr_sdbm_t *db, long dbit)
+{
+ register long c;
+ register long dirb;
+ apr_status_t status;
+ apr_off_t off;
+
+ c = dbit / BYTESIZ;
+ dirb = c / DBLKSIZ;
+
+ if (dirb != db->dirbno) {
+ if ((status = read_from(db->dirf, db->dirbuf, OFF_DIR(dirb), DBLKSIZ))
+ != APR_SUCCESS)
+ return status;
+
+ db->dirbno = dirb;
+
+ debug(("dir read: %d\n", dirb));
+ }
+
+ db->dirbuf[c % DBLKSIZ] |= (1 << dbit % BYTESIZ);
+
+ if (dbit >= db->maxbno)
+ db->maxbno += DBLKSIZ * BYTESIZ;
+
+ off = OFF_DIR(dirb);
+ if ((status = apr_file_seek(db->dirf, APR_SET, &off)) == APR_SUCCESS)
+ status = apr_file_write_full(db->dirf, db->dirbuf, DBLKSIZ, NULL);
+
+ return status;
+}
+
+/*
+* getnext - get the next key in the page, and if done with
+* the page, try the next page in sequence
+*/
+static apr_status_t getnext(apr_sdbm_datum_t *key, apr_sdbm_t *db)
+{
+ apr_status_t status;
+ for (;;) {
+ db->keyptr++;
+ *key = getnkey(db->pagbuf, db->keyptr);
+ if (key->dptr != NULL)
+ return APR_SUCCESS;
+ /*
+ * we either run out, or there is nothing on this page..
+ * try the next one... If we lost our position on the
+ * file, we will have to seek.
+ */
+ db->keyptr = 0;
+ if (db->pagbno != db->blkptr++) {
+ apr_off_t off = OFF_PAG(db->blkptr);
+ if ((status = apr_file_seek(db->pagf, APR_SET, &off)
+ != APR_SUCCESS))
+ return status;
+ }
+
+ db->pagbno = db->blkptr;
+ /* ### EOF acceptable here too? */
+ if ((status = apr_file_read_full(db->pagf, db->pagbuf, PBLKSIZ, NULL))
+ != APR_SUCCESS)
+ return status;
+ if (!chkpage(db->pagbuf))
+ return APR_EGENERAL; /* ### need better error */
+ }
+
+ /* NOTREACHED */
+}
+
+
+APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db)
+{
+ /* ### Should we return true if the first lock is a share lock,
+ * to reflect that apr_sdbm_store and apr_sdbm_delete will fail?
+ */
+ return (db->flags & SDBM_RDONLY) != 0;
+}
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.lo
new file mode 100644
index 00000000..57461acf
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.lo
@@ -0,0 +1,12 @@
+# sdbm.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sdbm.o'
+
+# Name of the non-PIC object.
+non_pic_object='sdbm.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.o
new file mode 100644
index 00000000..c9e780e8
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.c
new file mode 100644
index 00000000..012e3d07
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.c
@@ -0,0 +1,63 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * sdbm - ndbm work-alike hashed database library
+ * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
+ * author: oz@nexus.yorku.ca
+ * status: ex-public domain. keep it that way.
+ *
+ * hashing routine
+ */
+
+#include "apr_sdbm.h"
+#include "sdbm_private.h"
+
+/*
+ * polynomial conversion ignoring overflows
+ * [this seems to work remarkably well, in fact better
+ * then the ndbm hash function. Replace at your own risk]
+ * use: 65599 nice.
+ * 65587 even better.
+ */
+long sdbm_hash(const char *str, int len)
+{
+ register unsigned long n = 0;
+
+#define DUFF /* go ahead and use the loop-unrolled version */
+#ifdef DUFF
+
+#define HASHC n = *str++ + 65599 * n
+
+ if (len > 0) {
+ register int loop = (len + 8 - 1) >> 3;
+
+ switch(len & (8 - 1)) {
+ case 0: do {
+ HASHC; case 7: HASHC;
+ case 6: HASHC; case 5: HASHC;
+ case 4: HASHC; case 3: HASHC;
+ case 2: HASHC; case 1: HASHC;
+ } while (--loop);
+ }
+
+ }
+#else
+ while (len--)
+ n = *str++ + 65599 * n;
+#endif
+ return n;
+}
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.lo
new file mode 100644
index 00000000..9e7cd07e
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.lo
@@ -0,0 +1,12 @@
+# sdbm_hash.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sdbm_hash.o'
+
+# Name of the non-PIC object.
+non_pic_object='sdbm_hash.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.o
new file mode 100644
index 00000000..4b66d75a
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_hash.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.c
new file mode 100644
index 00000000..a001ed41
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.c
@@ -0,0 +1,78 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_file_info.h"
+#include "apr_file_io.h"
+#include "apr_sdbm.h"
+
+#include "sdbm_private.h"
+#include "sdbm_tune.h"
+
+/* NOTE: this function blocks until it acquires the lock */
+APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type)
+{
+ apr_status_t status;
+
+ if (!(type == APR_FLOCK_SHARED || type == APR_FLOCK_EXCLUSIVE))
+ return APR_EINVAL;
+
+ if (db->flags & SDBM_EXCLUSIVE_LOCK) {
+ ++db->lckcnt;
+ return APR_SUCCESS;
+ }
+ else if (db->flags & SDBM_SHARED_LOCK) {
+ /*
+ * Cannot promote a shared lock to an exlusive lock
+ * in a cross-platform compatibile manner.
+ */
+ if (type == APR_FLOCK_EXCLUSIVE)
+ return APR_EINVAL;
+ ++db->lckcnt;
+ return APR_SUCCESS;
+ }
+ /*
+ * zero size: either a fresh database, or one with a single,
+ * unsplit data page: dirpage is all zeros.
+ */
+ if ((status = apr_file_lock(db->dirf, type)) == APR_SUCCESS)
+ {
+ apr_finfo_t finfo;
+ if ((status = apr_file_info_get(&finfo, APR_FINFO_SIZE, db->dirf))
+ != APR_SUCCESS) {
+ (void) apr_file_unlock(db->dirf);
+ return status;
+ }
+
+ SDBM_INVALIDATE_CACHE(db, finfo);
+
+ ++db->lckcnt;
+ if (type == APR_FLOCK_SHARED)
+ db->flags |= SDBM_SHARED_LOCK;
+ else if (type == APR_FLOCK_EXCLUSIVE)
+ db->flags |= SDBM_EXCLUSIVE_LOCK;
+ }
+ return status;
+}
+
+APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db)
+{
+ if (!(db->flags & (SDBM_SHARED_LOCK | SDBM_EXCLUSIVE_LOCK)))
+ return APR_EINVAL;
+ if (--db->lckcnt > 0)
+ return APR_SUCCESS;
+ db->flags &= ~(SDBM_SHARED_LOCK | SDBM_EXCLUSIVE_LOCK);
+ return apr_file_unlock(db->dirf);
+}
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.lo
new file mode 100644
index 00000000..dd635ba2
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.lo
@@ -0,0 +1,12 @@
+# sdbm_lock.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sdbm_lock.o'
+
+# Name of the non-PIC object.
+non_pic_object='sdbm_lock.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.o
new file mode 100644
index 00000000..6337968a
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_lock.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.c b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.c
new file mode 100644
index 00000000..3fe82b66
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.c
@@ -0,0 +1,319 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * sdbm - ndbm work-alike hashed database library
+ * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
+ * author: oz@nexus.yorku.ca
+ * status: ex-public domain.
+ *
+ * page-level routines
+ */
+
+#include "apr_sdbm.h"
+
+#include "sdbm_tune.h"
+#include "sdbm_pair.h"
+#include "sdbm_private.h"
+
+#include <string.h> /* for memset() */
+
+
+#define exhash(item) sdbm_hash((item).dptr, (item).dsize)
+
+/*
+ * forward
+ */
+static int seepair(char *, int, char *, int);
+
+/*
+ * page format:
+ * +------------------------------+
+ * ino | n | keyoff | datoff | keyoff |
+ * +------------+--------+--------+
+ * | datoff | - - - ----> |
+ * +--------+---------------------+
+ * | F R E E A R E A |
+ * +--------------+---------------+
+ * | <---- - - - | data |
+ * +--------+-----+----+----------+
+ * | key | data | key |
+ * +--------+----------+----------+
+ *
+ * calculating the offsets for free area: if the number
+ * of entries (ino[0]) is zero, the offset to the END of
+ * the free area is the block size. Otherwise, it is the
+ * nth (ino[ino[0]]) entry's offset.
+ */
+
+int
+fitpair(pag, need)
+char *pag;
+int need;
+{
+ register int n;
+ register int off;
+ register int avail;
+ register short *ino = (short *) pag;
+
+ off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ;
+ avail = off - (n + 1) * sizeof(short);
+ need += 2 * sizeof(short);
+
+ debug(("avail %d need %d\n", avail, need));
+
+ return need <= avail;
+}
+
+void
+putpair(pag, key, val)
+char *pag;
+apr_sdbm_datum_t key;
+apr_sdbm_datum_t val;
+{
+ register int n;
+ register int off;
+ register short *ino = (short *) pag;
+
+ off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ;
+/*
+ * enter the key first
+ */
+ off -= key.dsize;
+ (void) memcpy(pag + off, key.dptr, key.dsize);
+ ino[n + 1] = off;
+/*
+ * now the data
+ */
+ off -= val.dsize;
+ (void) memcpy(pag + off, val.dptr, val.dsize);
+ ino[n + 2] = off;
+/*
+ * adjust item count
+ */
+ ino[0] += 2;
+}
+
+apr_sdbm_datum_t
+getpair(pag, key)
+char *pag;
+apr_sdbm_datum_t key;
+{
+ register int i;
+ register int n;
+ apr_sdbm_datum_t val;
+ register short *ino = (short *) pag;
+
+ if ((n = ino[0]) == 0)
+ return sdbm_nullitem;
+
+ if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0)
+ return sdbm_nullitem;
+
+ val.dptr = pag + ino[i + 1];
+ val.dsize = ino[i] - ino[i + 1];
+ return val;
+}
+
+int
+duppair(pag, key)
+char *pag;
+apr_sdbm_datum_t key;
+{
+ register short *ino = (short *) pag;
+ return ino[0] > 0 && seepair(pag, ino[0], key.dptr, key.dsize) > 0;
+}
+
+apr_sdbm_datum_t
+getnkey(pag, num)
+char *pag;
+int num;
+{
+ apr_sdbm_datum_t key;
+ register int off;
+ register short *ino = (short *) pag;
+
+ num = num * 2 - 1;
+ if (ino[0] == 0 || num > ino[0])
+ return sdbm_nullitem;
+
+ off = (num > 1) ? ino[num - 1] : PBLKSIZ;
+
+ key.dptr = pag + ino[num];
+ key.dsize = off - ino[num];
+
+ return key;
+}
+
+int
+delpair(pag, key)
+char *pag;
+apr_sdbm_datum_t key;
+{
+ register int n;
+ register int i;
+ register short *ino = (short *) pag;
+
+ if ((n = ino[0]) == 0)
+ return 0;
+
+ if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0)
+ return 0;
+/*
+ * found the key. if it is the last entry
+ * [i.e. i == n - 1] we just adjust the entry count.
+ * hard case: move all data down onto the deleted pair,
+ * shift offsets onto deleted offsets, and adjust them.
+ * [note: 0 < i < n]
+ */
+ if (i < n - 1) {
+ register int m;
+ register char *dst = pag + (i == 1 ? PBLKSIZ : ino[i - 1]);
+ register char *src = pag + ino[i + 1];
+ register int zoo = dst - src;
+
+ debug(("free-up %d ", zoo));
+/*
+ * shift data/keys down
+ */
+ m = ino[i + 1] - ino[n];
+
+#undef DUFF /* just use memmove. it should be plenty fast. */
+#ifdef DUFF
+#define MOVB *--dst = *--src
+
+ if (m > 0) {
+ register int loop = (m + 8 - 1) >> 3;
+
+ switch (m & (8 - 1)) {
+ case 0: do {
+ MOVB; case 7: MOVB;
+ case 6: MOVB; case 5: MOVB;
+ case 4: MOVB; case 3: MOVB;
+ case 2: MOVB; case 1: MOVB;
+ } while (--loop);
+ }
+ }
+#else
+ dst -= m;
+ src -= m;
+ memmove(dst, src, m);
+#endif
+
+/*
+ * adjust offset index up
+ */
+ while (i < n - 1) {
+ ino[i] = ino[i + 2] + zoo;
+ i++;
+ }
+ }
+ ino[0] -= 2;
+ return 1;
+}
+
+/*
+ * search for the key in the page.
+ * return offset index in the range 0 < i < n.
+ * return 0 if not found.
+ */
+static int
+seepair(pag, n, key, siz)
+char *pag;
+register int n;
+register char *key;
+register int siz;
+{
+ register int i;
+ register int off = PBLKSIZ;
+ register short *ino = (short *) pag;
+
+ for (i = 1; i < n; i += 2) {
+ if (siz == off - ino[i] &&
+ memcmp(key, pag + ino[i], siz) == 0)
+ return i;
+ off = ino[i + 1];
+ }
+ return 0;
+}
+
+void
+splpage(pag, new, sbit)
+char *pag;
+char *new;
+long sbit;
+{
+ apr_sdbm_datum_t key;
+ apr_sdbm_datum_t val;
+
+ register int n;
+ register int off = PBLKSIZ;
+ char cur[PBLKSIZ];
+ register short *ino = (short *) cur;
+
+ (void) memcpy(cur, pag, PBLKSIZ);
+ (void) memset(pag, 0, PBLKSIZ);
+ (void) memset(new, 0, PBLKSIZ);
+
+ n = ino[0];
+ for (ino++; n > 0; ino += 2) {
+ key.dptr = cur + ino[0];
+ key.dsize = off - ino[0];
+ val.dptr = cur + ino[1];
+ val.dsize = ino[0] - ino[1];
+/*
+ * select the page pointer (by looking at sbit) and insert
+ */
+ (void) putpair((exhash(key) & sbit) ? new : pag, key, val);
+
+ off = ino[1];
+ n -= 2;
+ }
+
+ debug(("%d split %d/%d\n", ((short *) cur)[0] / 2,
+ ((short *) new)[0] / 2,
+ ((short *) pag)[0] / 2));
+}
+
+/*
+ * check page sanity:
+ * number of entries should be something
+ * reasonable, and all offsets in the index should be in order.
+ * this could be made more rigorous.
+ */
+int
+chkpage(pag)
+char *pag;
+{
+ register int n;
+ register int off;
+ register short *ino = (short *) pag;
+
+ if ((n = ino[0]) < 0 || n > PBLKSIZ / sizeof(short))
+ return 0;
+
+ if (n > 0) {
+ off = PBLKSIZ;
+ for (ino++; n > 0; ino += 2) {
+ if (ino[0] > off || ino[1] > off ||
+ ino[1] > ino[0])
+ return 0;
+ off = ino[1];
+ n -= 2;
+ }
+ }
+ return 1;
+}
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.h b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.h
new file mode 100644
index 00000000..51d10658
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.h
@@ -0,0 +1,40 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SDBM_PAIR_H
+#define SDBM_PAIR_H
+
+/* Mini EMBED (pair.c) */
+#define chkpage apu__sdbm_chkpage
+#define delpair apu__sdbm_delpair
+#define duppair apu__sdbm_duppair
+#define fitpair apu__sdbm_fitpair
+#define getnkey apu__sdbm_getnkey
+#define getpair apu__sdbm_getpair
+#define putpair apu__sdbm_putpair
+#define splpage apu__sdbm_splpage
+
+int fitpair(char *, int);
+void putpair(char *, apr_sdbm_datum_t, apr_sdbm_datum_t);
+apr_sdbm_datum_t getpair(char *, apr_sdbm_datum_t);
+int delpair(char *, apr_sdbm_datum_t);
+int chkpage (char *);
+apr_sdbm_datum_t getnkey(char *, int);
+void splpage(char *, char *, long);
+int duppair(char *, apr_sdbm_datum_t);
+
+#endif /* SDBM_PAIR_H */
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.lo b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.lo
new file mode 100644
index 00000000..85b46e5d
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.lo
@@ -0,0 +1,12 @@
+# sdbm_pair.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.493 2008/02/01 16:58:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/sdbm_pair.o'
+
+# Name of the non-PIC object.
+non_pic_object='sdbm_pair.o'
+
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.o b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.o
new file mode 100644
index 00000000..f6496e0d
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_pair.o
Binary files differ
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_private.h b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_private.h
new file mode 100644
index 00000000..a1ad29d4
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_private.h
@@ -0,0 +1,84 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * sdbm - ndbm work-alike hashed database library
+ * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
+ * author: oz@nexus.yorku.ca
+ */
+
+#ifndef SDBM_PRIVATE_H
+#define SDBM_PRIVATE_H
+
+#include "apr.h"
+#include "apr_pools.h"
+#include "apr_file_io.h"
+#include "apr_errno.h" /* for apr_status_t */
+
+#if 0
+/* if the block/page size is increased, it breaks perl apr_sdbm_t compatibility */
+#define DBLKSIZ 16384
+#define PBLKSIZ 8192
+#define PAIRMAX 8008 /* arbitrary on PBLKSIZ-N */
+#else
+#define DBLKSIZ 4096
+#define PBLKSIZ 1024
+#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */
+#endif
+#define SPLTMAX 10 /* maximum allowed splits */
+
+/* for apr_sdbm_t.flags */
+#define SDBM_RDONLY 0x1 /* data base open read-only */
+#define SDBM_SHARED 0x2 /* data base open for sharing */
+#define SDBM_SHARED_LOCK 0x4 /* data base locked for shared read */
+#define SDBM_EXCLUSIVE_LOCK 0x8 /* data base locked for write */
+
+struct apr_sdbm_t {
+ apr_pool_t *pool;
+ apr_file_t *dirf; /* directory file descriptor */
+ apr_file_t *pagf; /* page file descriptor */
+ apr_int32_t flags; /* status/error flags, see below */
+ long maxbno; /* size of dirfile in bits */
+ long curbit; /* current bit number */
+ long hmask; /* current hash mask */
+ long blkptr; /* current block for nextkey */
+ int keyptr; /* current key for nextkey */
+ long blkno; /* current page to read/write */
+ long pagbno; /* current page in pagbuf */
+ char pagbuf[PBLKSIZ]; /* page file block buffer */
+ long dirbno; /* current block in dirbuf */
+ char dirbuf[DBLKSIZ]; /* directory file block buffer */
+ int lckcnt; /* number of calls to sdbm_lock */
+};
+
+
+#define sdbm_hash apu__sdbm_hash
+#define sdbm_nullitem apu__sdbm_nullitem
+
+extern const apr_sdbm_datum_t sdbm_nullitem;
+
+long sdbm_hash(const char *str, int len);
+
+/*
+ * zero the cache
+ */
+#define SDBM_INVALIDATE_CACHE(db, finfo) \
+ do { db->dirbno = (!finfo.size) ? 0 : -1; \
+ db->pagbno = -1; \
+ db->maxbno = (long)(finfo.size * BYTESIZ); \
+ } while (0);
+
+#endif /* SDBM_PRIVATE_H */
diff --git a/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_tune.h b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_tune.h
new file mode 100644
index 00000000..92ed6a25
--- /dev/null
+++ b/rubbos/app/httpd-2.0.64/srclib/apr-util/dbm/sdbm/sdbm_tune.h
@@ -0,0 +1,40 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * sdbm - ndbm work-alike hashed database library
+ * tuning and portability constructs [not nearly enough]
+ * author: oz@nexus.yorku.ca
+ */
+
+#ifndef SDBM_TUNE_H
+#define SDBM_TUNE_H
+
+#include "apr_errno.h"
+
+/* ### this might be better off as sizeof(char *) */
+#define BYTESIZ 8
+
+/*
+ * misc
+ */
+#ifdef DEBUG
+#define debug(x) printf x
+#else
+#define debug(x)
+#endif
+
+#endif /* SDBM_TUNE_H */